2013-04-29 17:59:11

by Yann E. MORIN

[permalink] [raw]
Subject: [pull request] Pull request for branch yem-kconfig-for-next

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(-)

--
.-----------------.--------------------.------------------.--------------------.
| 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. |
'------------------------------^-------^------------------^--------------------'


2013-04-29 18:00:31

by Yann E. MORIN

[permalink] [raw]
Subject: [PATCH 1/1] kconfig: fix lists definition for C++

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.)

Reported-by: Randy Dunlap <[email protected]>
Signed-off-by: "Yann E. MORIN" <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Benjamin Poirier <[email protected]>
---
scripts/kconfig/list.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
index ea1d581..685d80e 100644
--- a/scripts/kconfig/list.h
+++ b/scripts/kconfig/list.h
@@ -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
--
1.8.1.2

2013-04-29 19:28:50

by Randy Dunlap

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

On 04/29/13 10:59, Yann E. MORIN wrote:
> 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.)
>
> Reported-by: Randy Dunlap <[email protected]>
> Signed-off-by: "Yann E. MORIN" <[email protected]>
> Cc: Randy Dunlap <[email protected]>
> Cc: Benjamin Poirier <[email protected]>

Acked-by: Randy Dunlap <[email protected]>

Thanks.

> ---
> scripts/kconfig/list.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
> index ea1d581..685d80e 100644
> --- a/scripts/kconfig/list.h
> +++ b/scripts/kconfig/list.h
> @@ -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
>


--
~Randy

2013-04-29 21:54:20

by Rob Landley

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

On 04/29/2013 02:28:07 PM, Randy Dunlap wrote:
> On 04/29/13 10:59, Yann E. MORIN wrote:
> > 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-

2013-04-29 22:31:03

by Yann E. MORIN

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

Rob, All,

On Mon, Apr 29, 2013 at 04:54:14PM -0500, Rob Landley wrote:
> On 04/29/2013 02:28:07 PM, Randy Dunlap wrote:
> >On 04/29/13 10:59, Yann E. MORIN wrote:
> >> 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.

--
.-----------------.--------------------.------------------.--------------------.
| 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. |
'------------------------------^-------^------------------^--------------------'

2013-04-29 22:57:50

by Rob Landley

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

On 04/29/2013 05:30:54 PM, Yann E. MORIN wrote:
> Rob, All,
>
> On Mon, Apr 29, 2013 at 04:54:14PM -0500, Rob Landley wrote:
> > On 04/29/2013 02:28:07 PM, Randy Dunlap wrote:
> > >On 04/29/13 10:59, Yann E. MORIN wrote:
> > >> 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? ;-)

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-

2013-05-02 08:48:42

by Michal Marek

[permalink] [raw]
Subject: Re: [pull request] Pull request for branch yem-kconfig-for-next

On 29.4.2013 19:59, Yann E. MORIN wrote:
> 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