On 23/07/2020 19:19, Gedare Bloom wrote:

We don't have any specific rule, but all the examples in GCC docs put
the attributes near the end of the line rather than in the
start/middle. I mentioned this related to Christian's recent patch
with alignment attributes. It might be good for us to define some
conventions for consistency. I lean toward following the GNU
documentation.

ref:https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html

You can't put the attributes between the closing ) and the opening { in a function definition.

https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Attribute-Syntax.html#Attribute-Syntax

I tend to place them in front of the declarator. This is in line with C++11:

https://en.cppreference.com/w/cpp/language/attributes

This enables you to replace some GNU-specific attributes with C++ attributes for example.

Also the C11 _Noreturn is in front of the function declaration:

https://en.cppreference.com/w/c/language/_Noreturn

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to