All of lore.kernel.org
 help / color / mirror / Atom feed
* <evl/heap.h> compile conflict with Boost
@ 2022-06-13 14:39 Russell Johnson
  2022-06-13 15:17 ` Julien Blanc
  0 siblings, 1 reply; 16+ messages in thread
From: Russell Johnson @ 2022-06-13 14:39 UTC (permalink / raw)
  To: xenomai

I have a class that includes both <evl/heap.h> and some boost headers.
Whenever I go to compile it, I get an error that looks like it has to do
with the definition of "fallthrough" in <evl/compile.h> conflicting with the
definition of "fallthrough" in Boost. It compiles fine if there is no Boost
header in the class. I use boost throughout my entire app, so I need to
figure how to get both of these libraries to play nice with each other. Any
ideas? ( I am using gcc 8.3 and boost 1.70.0)

 



 

If you cannot see the image above, here is the error from the console:

 

/home/rtlogic/projects/t4-sfhm-test/vendors/boost-1.70.0/software/include/bo
ost/format/parsing.hpp: In function 'bool
boost::io::detail::parse_printf_directive(Iter&, const Iter&,
boost::io::detail::format_item<Ch, Tr, Alloc>*, const Facet&, std::size_t,
unsigned char)':

/opt/evl/include/evl/compiler.h:64:36: error: '__fallthrough__' was not
declared in this scope

#define fallthrough __attribute__((__fallthrough__))

                                    ^~~~~~~~~~~~~~~

/home/rtlogic/projects/t4-sfhm-test/vendors/boost-1.70.0/software/include/bo
ost/config/compiler/gcc.hpp:309:44: note: in expansion of macro
'fallthrough'

#  define BOOST_FALLTHROUGH __attribute__((fallthrough))

                                            ^~~~~~~~~~~

/home/rtlogic/projects/t4-sfhm-test/vendors/boost-1.70.0/software/include/bo
ost/format/parsing.hpp:325:17: note: in expansion of macro
'BOOST_FALLTHROUGH'

                 BOOST_FALLTHROUGH;

                ^~~~~~~~~~~~~~~~~

/opt/evl/include/evl/compiler.h:64:36: note: suggested alternative:
'fallthrough'

#define fallthrough __attribute__((__fallthrough__))

 

____________

Russell Johnson

Software Development Engineer, Kratos Space

Kratos Defense & Security Solutions, Inc.

12515 Academy Ridge View
Colorado Springs, Colorado 80921
Main:  719.472.3323x1192

Direct: 719.884.6392

 <mailto:russell.johnson@kratosdefense.com>
russell.johnson@kratosdefense.com
 <http://www.kratosdefense.com/> www.kratosdefense.com



 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 115340 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/f9ee151d/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 2582 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/f9ee151d/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6759 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/f9ee151d/attachment.bin>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-13 14:39 <evl/heap.h> compile conflict with Boost Russell Johnson
@ 2022-06-13 15:17 ` Julien Blanc
  2022-06-13 21:25   ` [External] - " Russell Johnson
  2022-06-14  6:54   ` Philippe Gerum
  0 siblings, 2 replies; 16+ messages in thread
From: Julien Blanc @ 2022-06-13 15:17 UTC (permalink / raw)
  To: russell.johnson, xenomai

Le lundi 13 juin 2022 à 14:39 +0000, Russell Johnson via Xenomai a
écrit :
>  I use boost throughout my entire app, so I need
> to figure how to get both of these libraries to play nice with each
> other. Any ideas? ( I am using gcc 8.3 and boost 1.70.0)
> 
> /opt/evl/include/evl/compiler.h:64:36: error: '__fallthrough__' was
> not
> declared in this scope
> 
> #define fallthrough __attribute__((__fallthrough__))
> 
>                                     ^~~~~~~~~~~~~~~

This line looks wrong. The correct way to use the fallthrough attribute
(at least with gcc) is __attribute__((fallthrough)) , so that will
conflict with any usage (not only boost's).

It should probably be fixed by:

#define __fallthrough	__attribute__((fallthrough))

Regards,

Julien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [External] - Re: <evl/heap.h> compile conflict with Boost
  2022-06-13 15:17 ` Julien Blanc
@ 2022-06-13 21:25   ` Russell Johnson
  2022-06-14  6:54   ` Philippe Gerum
  1 sibling, 0 replies; 16+ messages in thread
From: Russell Johnson @ 2022-06-13 21:25 UTC (permalink / raw)
  To: Julien Blanc, xenomai

I agree with your proposed fix.


-----Original Message-----
From: Julien Blanc <julien.blanc@sprinte.eu> 
Sent: Monday, June 13, 2022 9:17 AM
To: Russell Johnson <russell.johnson@kratosdefense.com>; xenomai@xenomai.org
Subject: [External] - Re: <evl/heap.h> compile conflict with Boost

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Le lundi 13 juin 2022 à 14:39 +0000, Russell Johnson via Xenomai a écrit :
>  I use boost throughout my entire app, so I need to figure how to get 
> both of these libraries to play nice with each other. Any ideas? ( I 
> am using gcc 8.3 and boost 1.70.0)
>
> /opt/evl/include/evl/compiler.h:64:36: error: '__fallthrough__' was 
> not declared in this scope
>
> #define fallthrough __attribute__((__fallthrough__))
>
>                                     ^~~~~~~~~~~~~~~

This line looks wrong. The correct way to use the fallthrough attribute (at least with gcc) is __attribute__((fallthrough)) , so that will conflict with any usage (not only boost's).

It should probably be fixed by:

#define __fallthrough   __attribute__((fallthrough))

Regards,

Julien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6759 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220613/a0334209/attachment.bin>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-13 15:17 ` Julien Blanc
  2022-06-13 21:25   ` [External] - " Russell Johnson
@ 2022-06-14  6:54   ` Philippe Gerum
  2022-06-14  7:08     ` Julien Blanc
  1 sibling, 1 reply; 16+ messages in thread
From: Philippe Gerum @ 2022-06-14  6:54 UTC (permalink / raw)
  To: Julien Blanc; +Cc: russell.johnson, xenomai


Julien Blanc via Xenomai <xenomai@xenomai.org> writes:

> Le lundi 13 juin 2022 à 14:39 +0000, Russell Johnson via Xenomai a
> écrit :
>>  I use boost throughout my entire app, so I need
>> to figure how to get both of these libraries to play nice with each
>> other. Any ideas? ( I am using gcc 8.3 and boost 1.70.0)
>> 
>> /opt/evl/include/evl/compiler.h:64:36: error: '__fallthrough__' was
>> not
>> declared in this scope
>> 
>> #define fallthrough __attribute__((__fallthrough__))
>> 
>>                                     ^~~~~~~~~~~~~~~
>
> This line looks wrong. The correct way to use the fallthrough attribute
> (at least with gcc) is __attribute__((fallthrough)) , so that will
> conflict with any usage (not only boost's).
>
> It should probably be fixed by:
>
> #define __fallthrough	__attribute__((fallthrough))
>
> Regards,
>
> Julien

6.39. attribute syntax
https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

PS: fixes go with patches.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  6:54   ` Philippe Gerum
@ 2022-06-14  7:08     ` Julien Blanc
  2022-06-14  8:04       ` Philippe Gerum
  0 siblings, 1 reply; 16+ messages in thread
From: Julien Blanc @ 2022-06-14  7:08 UTC (permalink / raw)
  To: rpm, Xenomai

Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
> Julien Blanc via Xenomai 
> > 
> > #define __fallthrough	__attribute__((fallthrough))
> > 
> 
> 6.39. attribute syntax
> https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
> 

Not sure what you mean with this link. The relevant attribute is
documented here: 
https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html

> PS: fixes go with patches.

Indeed, but i'll let Russel do this one as i don't have the opportunity
to test it right now.

Regards,

Julien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  7:08     ` Julien Blanc
@ 2022-06-14  8:04       ` Philippe Gerum
  2022-06-14  8:29         ` Julien Blanc
  0 siblings, 1 reply; 16+ messages in thread
From: Philippe Gerum @ 2022-06-14  8:04 UTC (permalink / raw)
  To: Julien Blanc; +Cc: rpm, Xenomai


Julien Blanc <julien.blanc@sprinte.eu> writes:

> Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
>> Julien Blanc via Xenomai 
>> > 
>> > #define __fallthrough	__attribute__((fallthrough))
>> > 
>> 
>> 6.39. attribute syntax
>> https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
>> 
>
> Not sure what you mean with this link. The relevant attribute is
> documented here: 
> https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
>
>> PS: fixes go with patches.
>
> Indeed, but i'll let Russel do this one as i don't have the opportunity
> to test it right now.
>

The documentation (paragraph 6.39) states that "You may optionally
specify attribute names with ‘__’ preceding and following the name. This
allows you to use them in header files without being concerned about a
possible macro of the same name. For example, you may use the attribute
name __noreturn__ instead of noreturn.".

This is generally used with C attributes as a precaution against
namespace conflicts in the C language space. IOW, making a C++ parser
happy is ok with me as long as this does not introduce potential issues
down the road with regular C code.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  8:04       ` Philippe Gerum
@ 2022-06-14  8:29         ` Julien Blanc
  2022-06-14  8:41           ` Bezdeka, Florian
  2022-06-14  9:01           ` Philippe Gerum
  0 siblings, 2 replies; 16+ messages in thread
From: Julien Blanc @ 2022-06-14  8:29 UTC (permalink / raw)
  To: rpm; +Cc: Xenomai

Le mardi 14 juin 2022 à 10:04 +0200, Philippe Gerum a écrit :
> Julien Blanc <
> julien.blanc@sprinte.eu
> > writes:
> 
> > Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
> > > Julien Blanc via Xenomai 
> > > > #define __fallthrough	__attribute__((fallthrough))
> > > > 
> > > 
> > > 6.39. attribute syntax
> > > https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
> > > 
> > > 
> > 
> > Not sure what you mean with this link. The relevant attribute is
> > documented here: 
> > https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
> > 
> > 
> > > PS: fixes go with patches.
> > 
> > Indeed, but i'll let Russel do this one as i don't have the
> > opportunity
> > to test it right now.
> > 
> 
> The documentation (paragraph 6.39) states that "You may optionally
> specify attribute names with ‘__’ preceding and following the name.
> This allows you to use them in header files without being concerned
> about a possible macro of the same name. For example, you may use the
> attribute name __noreturn__ instead of noreturn.".
> 
> This is generally used with C attributes as a precaution against
> namespace conflicts in the C language space. IOW, making a C++ parser
> happy is ok with me as long as this does not introduce potential
> issues down the road with regular C code.

Missed that part, thanks. The issue here is thus not within the
attribute part, which can be either fallthrough or __fallthrough__, but
only in the macro name, which should be __fallthrough instead of just
fallthrough.

(following untested, although it should be ok, pretty straightforward)

    Fix fallthrough macro
    
    Signed-off-by: Julien Blanc <julien.blanc@sprinte.eu>

diff --git a/vendor/evl/compiler.h b/vendor/evl/compiler.h
index fce2766..8e6ad8c 100644
--- a/vendor/evl/compiler.h
+++ b/vendor/evl/compiler.h
@@ -61,7 +61,7 @@
 #endif
 
 #ifndef __fallthrough
-#define fallthrough    __attribute__((__fallthrough__))
+#define __fallthrough  __attribute__((__fallthrough__))
 #endif
 
 #ifndef __alloc_size



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  8:29         ` Julien Blanc
@ 2022-06-14  8:41           ` Bezdeka, Florian
  2022-06-14  9:01           ` Philippe Gerum
  1 sibling, 0 replies; 16+ messages in thread
From: Bezdeka, Florian @ 2022-06-14  8:41 UTC (permalink / raw)
  To: julien.blanc, rpm; +Cc: Xenomai

On Tue, 2022-06-14 at 08:29 +0000, Julien Blanc via Xenomai wrote:
> Le mardi 14 juin 2022 à 10:04 +0200, Philippe Gerum a écrit :
> > Julien Blanc <
> > julien.blanc@sprinte.eu
> > > writes:
> > 
> > > Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
> > > > Julien Blanc via Xenomai 
> > > > > #define __fallthrough	__attribute__((fallthrough))
> > > > > 
> > > > 
> > > > 6.39. attribute syntax
> > > > https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
> > > > 
> > > > 
> > > 
> > > Not sure what you mean with this link. The relevant attribute is
> > > documented here: 
> > > https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
> > > 
> > > 
> > > > PS: fixes go with patches.
> > > 
> > > Indeed, but i'll let Russel do this one as i don't have the
> > > opportunity
> > > to test it right now.
> > > 
> > 
> > The documentation (paragraph 6.39) states that "You may optionally
> > specify attribute names with ‘__’ preceding and following the name.
> > This allows you to use them in header files without being concerned
> > about a possible macro of the same name. For example, you may use the
> > attribute name __noreturn__ instead of noreturn.".
> > 
> > This is generally used with C attributes as a precaution against
> > namespace conflicts in the C language space. IOW, making a C++ parser
> > happy is ok with me as long as this does not introduce potential
> > issues down the road with regular C code.
> 
> Missed that part, thanks. The issue here is thus not within the
> attribute part, which can be either fallthrough or __fallthrough__, but
> only in the macro name, which should be __fallthrough instead of just
> fallthrough.
> 
> (following untested, although it should be ok, pretty straightforward)
> 
>     Fix fallthrough macro
>     
>     Signed-off-by: Julien Blanc <julien.blanc@sprinte.eu>
> 
> diff --git a/vendor/evl/compiler.h b/vendor/evl/compiler.h
> index fce2766..8e6ad8c 100644
> --- a/vendor/evl/compiler.h
> +++ b/vendor/evl/compiler.h
> @@ -61,7 +61,7 @@
>  #endif
>  
>  #ifndef __fallthrough
> -#define fallthrough    __attribute__((__fallthrough__))
> +#define __fallthrough  __attribute__((__fallthrough__))
>  #endif

Are there no users of "fallthrough"? The ifndef guard and the macro
name seem out of sync, yes, but if the macro is never used within the
evl code base, why do we define it?

Quick search tells me that there are users, so I expect compile errors
now.

>  
>  #ifndef __alloc_size
> 
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  8:29         ` Julien Blanc
  2022-06-14  8:41           ` Bezdeka, Florian
@ 2022-06-14  9:01           ` Philippe Gerum
  2022-06-14  9:44             ` Bezdeka, Florian
  1 sibling, 1 reply; 16+ messages in thread
From: Philippe Gerum @ 2022-06-14  9:01 UTC (permalink / raw)
  To: Julien Blanc; +Cc: rpm, Xenomai


Julien Blanc <julien.blanc@sprinte.eu> writes:

> Le mardi 14 juin 2022 à 10:04 +0200, Philippe Gerum a écrit :
>> Julien Blanc <
>> julien.blanc@sprinte.eu
>> > writes:
>> 
>> > Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
>> > > Julien Blanc via Xenomai 
>> > > > #define __fallthrough	__attribute__((fallthrough))
>> > > > 
>> > > 
>> > > 6.39. attribute syntax
>> > > https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
>> > > 
>> > > 
>> > 
>> > Not sure what you mean with this link. The relevant attribute is
>> > documented here: 
>> > https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
>> > 
>> > 
>> > > PS: fixes go with patches.
>> > 
>> > Indeed, but i'll let Russel do this one as i don't have the
>> > opportunity
>> > to test it right now.
>> > 
>> 
>> The documentation (paragraph 6.39) states that "You may optionally
>> specify attribute names with ‘__’ preceding and following the name.
>> This allows you to use them in header files without being concerned
>> about a possible macro of the same name. For example, you may use the
>> attribute name __noreturn__ instead of noreturn.".
>> 
>> This is generally used with C attributes as a precaution against
>> namespace conflicts in the C language space. IOW, making a C++ parser
>> happy is ok with me as long as this does not introduce potential
>> issues down the road with regular C code.
>
> Missed that part, thanks. The issue here is thus not within the
> attribute part, which can be either fallthrough or __fallthrough__, but
> only in the macro name, which should be __fallthrough instead of just
> fallthrough.

Fine by me now, two remarks though: as Florian noted, this patch breaks
all current users in libevl, plus a meaningful commit log explaining why
such change is needed would helpful for reviewers.
(e.g. fixing conflict with C++ [[fallthough]], and maybe at some point
in the future with the C2X standard).

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  9:01           ` Philippe Gerum
@ 2022-06-14  9:44             ` Bezdeka, Florian
  2022-06-14 10:34               ` Julien Blanc
  0 siblings, 1 reply; 16+ messages in thread
From: Bezdeka, Florian @ 2022-06-14  9:44 UTC (permalink / raw)
  To: rpm, julien.blanc; +Cc: Xenomai

On Tue, 2022-06-14 at 11:01 +0200, Philippe Gerum via Xenomai wrote:
> Julien Blanc <julien.blanc@sprinte.eu> writes:
> 
> > Le mardi 14 juin 2022 à 10:04 +0200, Philippe Gerum a écrit :
> > > Julien Blanc <
> > > julien.blanc@sprinte.eu
> > > > writes:
> > > 
> > > > Le mardi 14 juin 2022 à 08:54 +0200, Philippe Gerum a écrit :
> > > > > Julien Blanc via Xenomai 
> > > > > > #define __fallthrough	__attribute__((fallthrough))
> > > > > > 
> > > > > 
> > > > > 6.39. attribute syntax
> > > > > https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax
> > > > > 
> > > > > 
> > > > 
> > > > Not sure what you mean with this link. The relevant attribute is
> > > > documented here: 
> > > > https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html
> > > > 
> > > > 
> > > > > PS: fixes go with patches.
> > > > 
> > > > Indeed, but i'll let Russel do this one as i don't have the
> > > > opportunity
> > > > to test it right now.
> > > > 
> > > 
> > > The documentation (paragraph 6.39) states that "You may optionally
> > > specify attribute names with ‘__’ preceding and following the name.
> > > This allows you to use them in header files without being concerned
> > > about a possible macro of the same name. For example, you may use the
> > > attribute name __noreturn__ instead of noreturn.".
> > > 
> > > This is generally used with C attributes as a precaution against
> > > namespace conflicts in the C language space. IOW, making a C++ parser
> > > happy is ok with me as long as this does not introduce potential
> > > issues down the road with regular C code.
> > 
> > Missed that part, thanks. The issue here is thus not within the
> > attribute part, which can be either fallthrough or __fallthrough__, but
> > only in the macro name, which should be __fallthrough instead of just
> > fallthrough.
> 
> Fine by me now, two remarks though: as Florian noted, this patch breaks
> all current users in libevl, plus a meaningful commit log explaining why
> such change is needed would helpful for reviewers.
> (e.g. fixing conflict with C++ [[fallthough]], and maybe at some point
> in the future with the C2X standard).
> 

Based on the kernel's fallthrough, introducing evl_fallthrough would
avoid all kinds of conflicts (IMHO):

#ifndev evl_fallthrough
#if __has_attribute(__fallthrough__)
# define evl_fallthrough	__attribute__((__fallthrough__))
#else
# define evl_fallthrough	do {} while (0)  /* fallthrough */
#endif
#endif

All evl internal users would have to be migrated.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14  9:44             ` Bezdeka, Florian
@ 2022-06-14 10:34               ` Julien Blanc
  2022-06-14 10:43                 ` Philippe Gerum
  0 siblings, 1 reply; 16+ messages in thread
From: Julien Blanc @ 2022-06-14 10:34 UTC (permalink / raw)
  To: rpm, florian.bezdeka; +Cc: Xenomai

Le mardi 14 juin 2022 à 09:44 +0000, Bezdeka, Florian a écrit :
> 
> Based on the kernel's fallthrough, introducing evl_fallthrough would
> avoid all kinds of conflicts (IMHO):
> 
> #ifndev evl_fallthrough
> #if __has_attribute(__fallthrough__)
> # define evl_fallthrough	__attribute__((__fallthrough__))
> #else
> # define evl_fallthrough	do {} while (0)  /* fallthrough */
> #endif
> #endif
> 
> All evl internal users would have to be migrated.

In that case, wouldn't it make sense to migrate *all* macros in
compiler.h to an evl-prefix (nonwithstanding the fact that it's gonna
break a lot of code)? Or are they supposed to be already defined and
compiler.h is here just as a fallback (in which case, it makes sense to
stick with the __ prefix) ?

Regards,

Julien

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: <evl/heap.h> compile conflict with Boost
  2022-06-14 10:34               ` Julien Blanc
@ 2022-06-14 10:43                 ` Philippe Gerum
  2022-06-14 13:27                   ` [External] - " Russell Johnson
  0 siblings, 1 reply; 16+ messages in thread
From: Philippe Gerum @ 2022-06-14 10:43 UTC (permalink / raw)
  To: Julien Blanc; +Cc: rpm, florian.bezdeka, Xenomai


Julien Blanc <julien.blanc@sprinte.eu> writes:

> Le mardi 14 juin 2022 à 09:44 +0000, Bezdeka, Florian a écrit :
>> 
>> Based on the kernel's fallthrough, introducing evl_fallthrough would
>> avoid all kinds of conflicts (IMHO):
>> 
>> #ifndev evl_fallthrough
>> #if __has_attribute(__fallthrough__)
>> # define evl_fallthrough	__attribute__((__fallthrough__))
>> #else
>> # define evl_fallthrough	do {} while (0)  /* fallthrough */
>> #endif
>> #endif
>> 
>> All evl internal users would have to be migrated.
>
> In that case, wouldn't it make sense to migrate *all* macros in
> compiler.h to an evl-prefix (nonwithstanding the fact that it's gonna
> break a lot of code)? Or are they supposed to be already defined and
> compiler.h is here just as a fallback (in which case, it makes sense to
> stick with the __ prefix) ?
>

I'd favor the fallthrough -> __fallthrough option to align on other
macros from compiler.h. Using the evl_ prefix for generic,
compiler-level code looks odd.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [External] - Re: <evl/heap.h> compile conflict with Boost
  2022-06-14 10:43                 ` Philippe Gerum
@ 2022-06-14 13:27                   ` Russell Johnson
  2022-06-14 14:05                     ` Philippe Gerum
  0 siblings, 1 reply; 16+ messages in thread
From: Russell Johnson @ 2022-06-14 13:27 UTC (permalink / raw)
  To: Philippe Gerum, Julien Blanc; +Cc: Xenomai

This is what I have been using. I have tested it and it seems to work fine.

Thanks,

 Russell

diff --git a/benchmarks/hectic.c b/benchmarks/hectic.c
index 6b6b3b5..886f7d2 100644
--- a/benchmarks/hectic.c
+++ b/benchmarks/hectic.c
@@ -336,7 +336,7 @@ static void *sleeper_switcher(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -469,7 +469,7 @@ static void *rtup(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -549,7 +549,7 @@ static void *rtus(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -646,7 +646,7 @@ static void *rtuo(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -811,7 +811,7 @@ static int task_create(struct cpu_tasks *cpu,
        case RTUS:
        case RTUO:
                param->swt.flags = HECTIC_OOB_WAIT;
-               fallthrough;
+               __fallthrough;
        case SLEEPER:
        case SWITCHER:
                err = ioctl(cpu->fd, EVL_HECIOC_REGISTER_UTASK, &param->swt);
diff --git a/benchmarks/latmus.c b/benchmarks/latmus.c
index a507e80..59ed448 100644
--- a/benchmarks/latmus.c
+++ b/benchmarks/latmus.c
@@ -1252,10 +1252,10 @@ int main(int argc, char *const argv[])
                        switch (*endptr) {
                        case 'd':
                                timeout *= 24;
-                               fallthrough;
+                               __fallthrough;
                        case 'h':
                                timeout *= 60;
-                               fallthrough;
+                               __fallthrough;
                        case 'm':
                                timeout *= 60;
                                break;
diff --git a/include/evl/compiler.h b/include/evl/compiler.h
index fce2766..8e6ad8c 100644
--- a/include/evl/compiler.h
+++ b/include/evl/compiler.h
@@ -61,7 +61,7 @@
 #endif

 #ifndef __fallthrough
-#define fallthrough    __attribute__((__fallthrough__))
+#define __fallthrough  __attribute__((__fallthrough__))
 #endif

 #ifndef __alloc_size
diff --git a/lib/thread.c b/lib/thread.c
index 4b836cc..dc2ca6c 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -111,7 +111,7 @@ int evl_attach_thread(int flags, const char *fmt, ...)
                break;
        default:
                policy = SCHED_FIFO;
-               fallthrough;
+               __fallthrough;
        case SCHED_FIFO:
        case SCHED_RR:
                priority = param.sched_priority;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6759 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220614/b4791815/attachment.bin>

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [External] - Re: <evl/heap.h> compile conflict with Boost
  2022-06-14 13:27                   ` [External] - " Russell Johnson
@ 2022-06-14 14:05                     ` Philippe Gerum
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Gerum @ 2022-06-14 14:05 UTC (permalink / raw)
  To: Russell Johnson; +Cc: Philippe Gerum, Julien Blanc, Xenomai


Russell Johnson <russell.johnson@kratosdefense.com> writes:

> [[S/MIME Signed Part:Undecided]]
> This is what I have been using. I have tested it and it seems to work fine.
>
> Thanks,
>
>  Russell
>
> diff --git a/benchmarks/hectic.c b/benchmarks/hectic.c
> index 6b6b3b5..886f7d2 100644
> --- a/benchmarks/hectic.c
> +++ b/benchmarks/hectic.c

Ok. It would be nice if you could send a formal patch for inclusion
(i.e. with a signed commit log).

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [External] - Re: <evl/heap.h> compile conflict with Boost
  2022-06-14 15:34     ` [External] - " Russell Johnson
@ 2022-06-14 16:06       ` Philippe Gerum
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Gerum @ 2022-06-14 16:06 UTC (permalink / raw)
  To: Russell Johnson; +Cc: Philippe Gerum, Jan Kiszka, Xenomai


Russell Johnson <russell.johnson@kratosdefense.com> writes:

> [[S/MIME Signed Part:Undecided]]
> Apologies. Here you go.
>
> From 452e8b2ca8ecd53571a6b1f5d8b9ab23cd67f99d Mon Sep 17 00:00:00 2001
> From: Russell Johnson <russell.johnson@kratosdefense.com>
> Date: Tue, 14 Jun 2022 08:10:14 -0600
> Subject: [PATCH] fixing conflict with C++ [[fallthough]], and maybe at some
>  point in the future with the C2X standard
>
> Signed-off-by: Russell Johnson <russell.johnson@kratosdefense.com>
> ---
>  benchmarks/hectic.c    | 10 +++++-----
>  benchmarks/latmus.c    |  4 ++--
>  include/evl/compiler.h |  2 +-
>  lib/thread.c           |  2 +-
>  4 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/benchmarks/hectic.c b/benchmarks/hectic.c
> index 6b6b3b5..886f7d2 100644
> --- a/benchmarks/hectic.c
> +++ b/benchmarks/hectic.c
> @@ -336,7 +336,7 @@ static void *sleeper_switcher(void *cookie)
>                         break;
>                 case 1:
>                         handle_bad_fpreg(param->cpu, ~0, -1);
> -                       fallthrough;
> +                       __fallthrough;
>                 case -1:
>                         clean_exit(EXIT_FAILURE);
>                 }
> @@ -469,7 +469,7 @@ static void *rtup(void *cookie)
>                         break;
>                 case 1:
>                         handle_bad_fpreg(param->cpu, ~0, -1);
> -                       fallthrough;
> +                       __fallthrough;
>                 case -1:
>                         clean_exit(EXIT_FAILURE);
>                 }
> @@ -549,7 +549,7 @@ static void *rtus(void *cookie)
>                         break;
>                 case 1:
>                         handle_bad_fpreg(param->cpu, ~0, -1);
> -                       fallthrough;
> +                       __fallthrough;
>                 case -1:
>                         clean_exit(EXIT_FAILURE);
>                 }
> @@ -646,7 +646,7 @@ static void *rtuo(void *cookie)
>                         break;
>                 case 1:
>                         handle_bad_fpreg(param->cpu, ~0, -1);
> -                       fallthrough;
> +                       __fallthrough;
>                 case -1:
>                         clean_exit(EXIT_FAILURE);
>                 }
> @@ -811,7 +811,7 @@ static int task_create(struct cpu_tasks *cpu,
>         case RTUS:
>         case RTUO:
>                 param->swt.flags = HECTIC_OOB_WAIT;
> -               fallthrough;
> +               __fallthrough;
>         case SLEEPER:
>         case SWITCHER:
>                 err = ioctl(cpu->fd, EVL_HECIOC_REGISTER_UTASK,
> &param->swt);
> diff --git a/benchmarks/latmus.c b/benchmarks/latmus.c
> index a507e80..59ed448 100644
> --- a/benchmarks/latmus.c
> +++ b/benchmarks/latmus.c
> @@ -1252,10 +1252,10 @@ int main(int argc, char *const argv[])
>                         switch (*endptr) {
>                         case 'd':
>                                 timeout *= 24;
> -                               fallthrough;
> +                               __fallthrough;
>                         case 'h':
>                                 timeout *= 60;
> -                               fallthrough;
> +                               __fallthrough;
>                         case 'm':
>                                 timeout *= 60;
>                                 break;
> diff --git a/include/evl/compiler.h b/include/evl/compiler.h
> index fce2766..8e6ad8c 100644
> --- a/include/evl/compiler.h
> +++ b/include/evl/compiler.h
> @@ -61,7 +61,7 @@
>  #endif
>
>  #ifndef __fallthrough
> -#define fallthrough    __attribute__((__fallthrough__))
> +#define __fallthrough  __attribute__((__fallthrough__))
>  #endif
>
>  #ifndef __alloc_size
> diff --git a/lib/thread.c b/lib/thread.c
> index 4b836cc..dc2ca6c 100644
> --- a/lib/thread.c
> +++ b/lib/thread.c
> @@ -111,7 +111,7 @@ int evl_attach_thread(int flags, const char *fmt, ...)
>                 break;
>         default:
>                 policy = SCHED_FIFO;
> -               fallthrough;
> +               __fallthrough;
>         case SCHED_FIFO:
>         case SCHED_RR:
>                 priority = param.sched_priority;

Merged, thanks.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [External] - Re: <evl/heap.h> compile conflict with Boost
  2022-06-14 15:22   ` Philippe Gerum
@ 2022-06-14 15:34     ` Russell Johnson
  2022-06-14 16:06       ` Philippe Gerum
  0 siblings, 1 reply; 16+ messages in thread
From: Russell Johnson @ 2022-06-14 15:34 UTC (permalink / raw)
  To: Philippe Gerum, Jan Kiszka; +Cc: Xenomai

Apologies. Here you go.

From 452e8b2ca8ecd53571a6b1f5d8b9ab23cd67f99d Mon Sep 17 00:00:00 2001
From: Russell Johnson <russell.johnson@kratosdefense.com>
Date: Tue, 14 Jun 2022 08:10:14 -0600
Subject: [PATCH] fixing conflict with C++ [[fallthough]], and maybe at some
 point in the future with the C2X standard

Signed-off-by: Russell Johnson <russell.johnson@kratosdefense.com>
---
 benchmarks/hectic.c    | 10 +++++-----
 benchmarks/latmus.c    |  4 ++--
 include/evl/compiler.h |  2 +-
 lib/thread.c           |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/benchmarks/hectic.c b/benchmarks/hectic.c
index 6b6b3b5..886f7d2 100644
--- a/benchmarks/hectic.c
+++ b/benchmarks/hectic.c
@@ -336,7 +336,7 @@ static void *sleeper_switcher(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -469,7 +469,7 @@ static void *rtup(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -549,7 +549,7 @@ static void *rtus(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -646,7 +646,7 @@ static void *rtuo(void *cookie)
                        break;
                case 1:
                        handle_bad_fpreg(param->cpu, ~0, -1);
-                       fallthrough;
+                       __fallthrough;
                case -1:
                        clean_exit(EXIT_FAILURE);
                }
@@ -811,7 +811,7 @@ static int task_create(struct cpu_tasks *cpu,
        case RTUS:
        case RTUO:
                param->swt.flags = HECTIC_OOB_WAIT;
-               fallthrough;
+               __fallthrough;
        case SLEEPER:
        case SWITCHER:
                err = ioctl(cpu->fd, EVL_HECIOC_REGISTER_UTASK,
&param->swt);
diff --git a/benchmarks/latmus.c b/benchmarks/latmus.c
index a507e80..59ed448 100644
--- a/benchmarks/latmus.c
+++ b/benchmarks/latmus.c
@@ -1252,10 +1252,10 @@ int main(int argc, char *const argv[])
                        switch (*endptr) {
                        case 'd':
                                timeout *= 24;
-                               fallthrough;
+                               __fallthrough;
                        case 'h':
                                timeout *= 60;
-                               fallthrough;
+                               __fallthrough;
                        case 'm':
                                timeout *= 60;
                                break;
diff --git a/include/evl/compiler.h b/include/evl/compiler.h
index fce2766..8e6ad8c 100644
--- a/include/evl/compiler.h
+++ b/include/evl/compiler.h
@@ -61,7 +61,7 @@
 #endif

 #ifndef __fallthrough
-#define fallthrough    __attribute__((__fallthrough__))
+#define __fallthrough  __attribute__((__fallthrough__))
 #endif

 #ifndef __alloc_size
diff --git a/lib/thread.c b/lib/thread.c
index 4b836cc..dc2ca6c 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -111,7 +111,7 @@ int evl_attach_thread(int flags, const char *fmt, ...)
                break;
        default:
                policy = SCHED_FIFO;
-               fallthrough;
+               __fallthrough;
        case SCHED_FIFO:
        case SCHED_RR:
                priority = param.sched_priority;
--
1.8.3.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6759 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20220614/ccefc832/attachment.bin>

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-06-14 16:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 14:39 <evl/heap.h> compile conflict with Boost Russell Johnson
2022-06-13 15:17 ` Julien Blanc
2022-06-13 21:25   ` [External] - " Russell Johnson
2022-06-14  6:54   ` Philippe Gerum
2022-06-14  7:08     ` Julien Blanc
2022-06-14  8:04       ` Philippe Gerum
2022-06-14  8:29         ` Julien Blanc
2022-06-14  8:41           ` Bezdeka, Florian
2022-06-14  9:01           ` Philippe Gerum
2022-06-14  9:44             ` Bezdeka, Florian
2022-06-14 10:34               ` Julien Blanc
2022-06-14 10:43                 ` Philippe Gerum
2022-06-14 13:27                   ` [External] - " Russell Johnson
2022-06-14 14:05                     ` Philippe Gerum
2022-06-14 14:18 Russell Johnson
2022-06-14 15:11 ` Jan Kiszka
2022-06-14 15:22   ` Philippe Gerum
2022-06-14 15:34     ` [External] - " Russell Johnson
2022-06-14 16:06       ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.