Skip to contentSkip to conversation

Pull request for branch yem-kconfig-for-next

GIT PULL In review Yann E. MORIN 4 participants 7 messages Apr 29, 2013 – May 2, 2013

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 kconfig: fix lists definition for C++

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

The C++ compiler is more strict in that it refuses to assign a void* to a struct list_head*.

Fix that by explicitly casting the poisonning constants.

(Tested with all 5 frontends, now.)

---
 scripts/kconfig/list.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/list.h +2 -2
index ea1d581..685d80e 100644
@@ -125,7 +125,7 @@ static inline void __list_del(struct list_head *prev, struct list_head *next)
 static inline void list_del(struct list_head *entry)
 {
 	__list_del(entry->prev, entry->next);
-	entry->next = LIST_POISON1;
-	entry->prev = LIST_POISON2;
+	entry->next = (struct list_head*)LIST_POISON1;
+	entry->prev = (struct list_head*)LIST_POISON2;
 }
 #endif
Signature · 1 line
1.8.1.2
#0 lore raw

From: "Yann E. MORIN" <[email protected]>

Michal,

Please pull this fix to restore compilation of the qconf frontend.

Regards,
Yann E. MORIN.

The following changes since commit 23a5dfdad22a574d19d7cc19b391f9ce0d3c2f21:

Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG" (2013-04-26 23:21:59 +0200)

are available in the git repository at:

git://gitorious.org/linux-kconfig/linux-kconfig.git yem-kconfig-for-next

for you to fetch changes up to 21ca352b71ca252e1933b1538fe89da8a04395c3:

kconfig: fix lists definition for C++ (2013-04-29 19:55:56 +0200)

----------------------------------------------------------------
Yann E. MORIN (1):
kconfig: fix lists definition for C++

 scripts/kconfig/list.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH 1/1] kconfig: fix lists definition for C++

In reply to Yann E. MORIN
Quoted 5 lines · Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

The C++ compiler is more strict in that it refuses to assign a void* to a struct list_head*.

Quoted 8 lines

Fix that by explicitly casting the poisonning constants.

(Tested with all 5 frontends, now.)

Thanks.

Quoted 19 lines
---
 scripts/kconfig/list.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/list.h +2 -2
index ea1d581..685d80e 100644
@@ -125,7 +125,7 @@ static inline void __list_del(struct list_head *prev, struct list_head *next)
 static inline void list_del(struct list_head *entry)
 {
 	__list_del(entry->prev, entry->next);
-	entry->next = LIST_POISON1;
-	entry->prev = LIST_POISON2;
+	entry->next = (struct list_head*)LIST_POISON1;
+	entry->prev = (struct list_head*)LIST_POISON2;
 }
 #endif
Signature · 1 line
~Randy
#3 lore raw

Re: [PATCH 1/1] kconfig: fix lists definition for C++

Quoted 5 lines · Randy Dunlap
Quoted 4 lines · Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

The C++ compiler is more strict in that it refuses to assign a void* to a struct list_head*.

Given that the code _isn't_ C++ (because C is not a subset of C++ but a separate langauge in its own right where "throw" is a legitimate variable name and so on), how is this an issue?

Rob

#4 lore raw

Re: [PATCH 1/1] kconfig: fix lists definition for C++

Rob, All,

Quoted 10 lines · Rob Landley
Quoted 5 lines · Randy Dunlap
Quoted 4 lines · Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

The C++ compiler is more strict in that it refuses to assign a void* to a struct list_head*.

Given that the code _isn't_ C++ (because C is not a subset of C++ but a separate langauge in its own right where "throw" is a legitimate variable name and so on), how is this an issue?

It's an issue because the xconfig frontends is qconf, which as the name implies is using Qt, which *is* C++, and includes list.h.

So, list.h is included by both by C and C++ code.

So yes, list.h can be compiled by a C++ compiler.

Now, granted: list.h should all be enclosed in:

    ifdef __cpluplus
    extern "C" {
    endif
    ...
    ifdef __cpluplus
    }
    endif

Was that the fix you were suggesting between the lines? ;-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

Re: [PATCH 1/1] kconfig: fix lists definition for C++

Quoted 32 lines · Yann E. MORIN

Rob, All,

Quoted 8 lines · Rob Landley
Quoted 5 lines · Randy Dunlap
Quoted 4 lines · Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

The C++ compiler is more strict in that it refuses to assign a void* to a struct list_head*.

Given that the code _isn't_ C++ (because C is not a subset of C++

but a

Quoted 1 line

separate langauge in its own right where "throw" is a legitimate

variable

Quoted 1 line

name and so on), how is this an issue?

It's an issue because the xconfig frontends is qconf, which as the name implies is using Qt, which *is* C++, and includes list.h.

So, list.h is included by both by C and C++ code.

So yes, list.h can be compiled by a C++ compiler.

Now, granted: list.h should all be enclosed in:

    ifdef __cpluplus
    extern "C" {
    endif
    ...
    ifdef __cpluplus
    }
    endif
Quoted 1 line

Was that the fix you were suggesting between the lines? ;-)

It does more clearly document the issue. (A comment about the QT front-end would also be nice. I don't use that one, so I didn't think of it.)

Thanks,

Rob

#6 lore raw
In reply to Yann E. MORIN
Quoted 7 lines · Yann E. MORIN

The following changes since commit 23a5dfdad22a574d19d7cc19b391f9ce0d3c2f21:

Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG" (2013-04-26 23:21:59 +0200)

are available in the git repository at:

git://gitorious.org/linux-kconfig/linux-kconfig.git yem-kconfig-for-next

Pulled, thanks.

Michal