Attribute names with underscores for GCC

Recently, Petr Machata created several trac tickets for requesting the use of attribute names with underscores for GCC. Since there is no link to the GCC's documentation in the tickets, I'd like to put a link to the documentation. In the GCC's manuals --> "Extensions to the C Language Family" --> "Declaring Attributes of Functions", "Specifying Attributes of Variables", and "Specifying Attributes of Types", there is description about attributes with preceding and following `__`: You may also specify attributes with `__' preceding and following each keyword. 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 __noreturn__ instead of noreturn. Here are links to the gcc-2.9.5's documentation: http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84 http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC90 http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC91 I also checked manuals of gcc-3.0.4 and 4.0.4, and found the same description. Hope this helps, Michel

On 1/20/2012 10:16 AM, Michel Morin wrote:
Recently, Petr Machata created several trac tickets for requesting the use of attribute names with underscores for GCC. Since there is no link to the GCC's documentation in the tickets, I'd like to put a link to the documentation.
In the GCC's manuals --> "Extensions to the C Language Family" --> "Declaring Attributes of Functions", "Specifying Attributes of Variables", and "Specifying Attributes of Types", there is description about attributes with preceding and following `__`:
You may also specify attributes with `__' preceding and following each keyword. 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 __noreturn__ instead of noreturn.
Here are links to the gcc-2.9.5's documentation: http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84 http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC90 http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC91
I also checked manuals of gcc-3.0.4 and 4.0.4, and found the same description.
Hope this helps, Michel
Thank you, yes it helps. I was disinclined to make the change, but now I'll accept his patches. -- Eric Niebler BoostPro Computing http://www.boostpro.com

Additional information: Clang has made an effort for gcc-compatibility, and it has supported attribute names with underscores from the first release of clang (shipped with LLVM 2.6). Regards, Michel
participants (2)
-
Eric Niebler
-
Michel Morin