Namespace pollution due to compiler.h in Xenomai 3.1

Jan Kiszka jan.kiszka at siemens.com
Fri Mar 13 15:42:29 CET 2020


On 13.03.20 15:22, Wolfgang Denk wrote:
> Hi,
> 
> In message <20200313141229.7C87C24003E at gemini.denx.de> I wrote:
>>
>>>> We noticed because out application also defines __packed...
>>>
>>> That's indeed bad style which I didn't realize so far. All those
>>> short-hands should be prefixed, e.g. like qt does (Q_NORETURN, Q_LIKELY
>>> etc.).
>>
>> Was there not a rule in ANSI C that the use of double underscores in
>> identifiers is reserved compiler internal definitions?  I would expect
>> that it's ok in compiler.h but incorrect in any application headers.
> 
> For example C99 section 7.1.3 (see [1]):
> 
>          All identifiers that begin with an underscore and either an
>          uppercase letter or another underscore are always reserved
>          for any use.
> 
> [1] https://busybox.net/~landley/c99-draft.html#7.1.3
> 
> 
> So IMHO any definition of __packed... in application code is not
> standard conforming.
> 

That is correct as well and should be fixed in their application.

Still, I don't think Xenomai should use such defines on its own when 
other libs avoid this as well.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux



More information about the Xenomai mailing list