lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1350772273-3958-1-git-send-email-yann.morin.1998@free.fr>
Date:	Sun, 21 Oct 2012 00:31:13 +0200
From:	"Yann E. MORIN" <yann.morin.1998@...e.fr>
To:	Benjamin Poirier <benjamin.poirier@...il.com>
Cc:	Jean Sacren <sakiwit@...il.com>,
	Arnaud Lacombe <lacombar@...il.com>,
	Wang YanQing <udknight@...il.com>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Davidlohr Bueso <dave@....org>, linux-kbuild@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	"Yann E. MORIN" <yann.morin.1998@...e.fr>,
	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
	Yaakov Selkowitz <yselkowitz@...il.com>,
	Michal Marek <mmarek@...e.cz>,
	Benjamin Poirier <benjamin.poirier@...il.com>
Subject: [PATCH] kconfig: fix building the qconf frontend

 - 'offsetof' is already defined in stddef
    - to avoid issues with old systems still missing offsetof, just protect
      our definition between #ifndef...#endif

 - 'new' is a reserved keyword in C++:
    - rename the variable
    - protect the whole file with the usual #ifdef __cplusplus construct

Also, protect the whole file with the #ifdenf LIST_H, not only the macros
defintions.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@...e.fr>
Cc: Benjamin Poirier <benjamin.poirier@...il.com>
---
 scripts/kconfig/list.h |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
index 934bdba..c4fc349 100644
--- a/scripts/kconfig/list.h
+++ b/scripts/kconfig/list.h
@@ -5,7 +5,13 @@
  * Copied from include/linux/...
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
 
 /**
  * container_of - cast a member of a structure out to the containing structure
@@ -49,8 +55,6 @@ struct list_head {
 	     &pos->member != (head); 	\
 	     pos = list_entry(pos->member.next, typeof(*pos), member))
 
-#endif
-
 /**
  * list_empty - tests whether a list is empty
  * @head: the list to test.
@@ -66,25 +70,31 @@ static inline int list_empty(const struct list_head *head)
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-static inline void __list_add(struct list_head *new,
+static inline void __list_add(struct list_head *new_e,
 			      struct list_head *prev,
 			      struct list_head *next)
 {
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
+	next->prev = new_e;
+	new_e->next = next;
+	new_e->prev = prev;
+	prev->next = new_e;
 }
 
 /**
  * list_add_tail - add a new entry
- * @new: new entry to be added
+ * @new_e: new entry to be added
  * @head: list head to add it before
  *
  * Insert a new entry before the specified head.
  * This is useful for implementing queues.
  */
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
+static inline void list_add_tail(struct list_head *new_e, struct list_head *head)
 {
-	__list_add(new, head->prev, head);
+	__list_add(new_e, head->prev, head);
 }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LIST_H */
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ