[PATCH] headers: avoid bareword attributes

Sebastian Huber sebastian.huber@embedded-brains.de
Fri Aug 25 08:09:00 GMT 2017


On 24/08/17 21:02, Eric Blake wrote:

> On 08/24/2017 12:44 AM, Sebastian Huber wrote:> Hello Eric,
>> On 17/08/17 03:50, Eric Blake wrote:
>>> Always use the __-decorated form of an attribute name in public
>>> headers, as the bareword form is in the user's namespace, and we
>>> don't want compilation to break just because the user defines the
>>> bareword to mean something else.
>>>
>> did you test the clang thread safety analysis after this patch? It not
>> longer works using clang 3.8. I get now errors like this:
>>
> No, I usually compile with gcc, not clang.

The thread safety analysis development for GCC has been stopped in 2012:

https://gcc.gnu.org/ml/gcc/2012-04/msg00714.html

[...]
>> If I revert this change it works.
> I still think this is more likely to be a bug in clang, but I'm also
> okay if we need to revert this part of the patch since it only affects
> attributes that only clang uses, and since I don't test on clang.
>

I also think that this is a clang bug and I will file a bug report, 
however, it will take time to fix this and we should not break existing 
clang support for now.

With this test program

void f0(void) __attribute__((noreturn));
void f1(void) __attribute__((__noreturn__));
void f2(int *l) __attribute__((exclusive_lock_function(*l)));
void f3(int *l) __attribute__((__exclusive_lock_function__(*l)));

I get

clang -c test.c
test.c:4:61: error: use of undeclared identifier 'l'
void f3(int *l) __attribute__((__exclusive_lock_function__(*l)));
                                                             ^
1 error generated.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Newlib mailing list