diff options
author | Eric Blake <eblake@redhat.com> | 2014-08-01 19:44:51 +0400 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2014-08-01 19:44:51 +0400 |
commit | ada456dcfed23e2f3f1d92574993aef15e134418 (patch) | |
tree | 957d292ef7b5de776e9c88a95e14b310c0921aed /newlib/libc/machine | |
parent | 02206cd3e4c414635e5094670d440069959c4198 (diff) |
headers: properly decorate attributes
Found by:
find -name '*.h' |xargs grep -i 'attribute.*(([a-z]'
For an example of the type of bugs this causes, try compiling this valid
C11 program (it's valid because 'noreturn' is reserved for use in the
user namespace unless you include <stdnoreturn.h>):
$ cat foo.c
#define noreturn __attribute__((noreturn))
#include <stdlib.h>
$ gcc -c -o foo.o -Wall foo.c
In file included from /usr/include/stdlib.h:11:0,
from foo.c:2:
foo.c:1:18: error: expected ')' before '__attribute__'
#define noreturn __attribute__((noreturn))
^
/usr/include/stdlib.h:66:28: error: expected ',' or ';' before ')' token
_VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn)));
^
* libc/machine/spu/spu_timer_internal.h: Decorate attribute names
with __, for namespace safety.
* libc/machine/xscale/machine/profile.h: Likewise.
* libc/include/stdlib.h: Likewise.
* libc/include/_ansi.h: Likewise.
* libc/include/sys/unistd.h: Likewise.
* libc/sys/linux/linuxthreads/libc-symbols.h: Likewise.
* libc/sys/linux/linuxthreads/internals.h: Likewise.
* libc/sys/linux/machine/i386/weakalias.h: Likewise.
* libc/sys/linux/machine/i386/dl-procinfo.h: Likewise.
* libc/sys/linux/machine/i386/dl-machine.h: Likewise.
* libc/sys/linux/libc-symbols.h: Likewise.
* libc/sys/linux/iconv/gconv_charset.h: Likewise.
* libc/sys/linux/include/resolv.h: Likewise.
* libc/sys/linux/sys/unistd.h: Likewise.
* libc/sys/linux/dl/atomicity.h: Likewise.
* libc/sys/linux/dl/dynamic-link.h: Likewise.
* libc/sys/linux/dl/ldsodefs.h: Likewise.
Diffstat (limited to 'newlib/libc/machine')
-rw-r--r-- | newlib/libc/machine/spu/spu_timer_internal.h | 12 | ||||
-rw-r--r-- | newlib/libc/machine/xscale/machine/profile.h | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/newlib/libc/machine/spu/spu_timer_internal.h b/newlib/libc/machine/spu/spu_timer_internal.h index a438561b9..132235ad8 100644 --- a/newlib/libc/machine/spu/spu_timer_internal.h +++ b/newlib/libc/machine/spu/spu_timer_internal.h @@ -53,12 +53,12 @@ typedef enum spu_timer_state typedef struct spu_timer { - int tmout __attribute__ ((aligned (16))); /* Time until expiration (tb). */ - int intvl __attribute__ ((aligned (16))); /* Interval. */ - int id __attribute__ ((aligned (16))); - spu_timer_state_t state __attribute__ ((aligned (16))); - void (*func) (int) __attribute__ ((aligned (16))); /* Handler. */ - struct spu_timer *next __attribute__ ((aligned (16))); + int tmout __attribute__ ((__aligned__ (16))); /* Time until expiration (tb). */ + int intvl __attribute__ ((__aligned__ (16))); /* Interval. */ + int id __attribute__ ((__aligned__ (16))); + spu_timer_state_t state __attribute__ ((__aligned__ (16))); + void (*func) (int) __attribute__ ((__aligned__ (16))); /* Handler. */ + struct spu_timer *next __attribute__ ((__aligned__ (16))); } spu_timer_t; diff --git a/newlib/libc/machine/xscale/machine/profile.h b/newlib/libc/machine/xscale/machine/profile.h index 90198ba69..9a68cc86b 100644 --- a/newlib/libc/machine/xscale/machine/profile.h +++ b/newlib/libc/machine/xscale/machine/profile.h @@ -33,7 +33,7 @@ #endif #define _MCOUNT_DECL(frompc, selfpc) \ -void __attribute__ ((no_instrument_function)) \ +void __attribute__ ((__no_instrument_function__)) \ mcount_internal (frompc, selfpc) /* mcount_internal expects two arguments @@ -53,8 +53,8 @@ mcount_internal (frompc, selfpc) #ifdef __thumb__ #define MCOUNT \ -void __attribute__ ((naked)) \ - __attribute__ ((no_instrument_function)) \ +void __attribute__ ((__naked__)) \ + __attribute__ ((__no_instrument_function__)) \ mcount (void) \ { \ __asm__("push {r0, r1, r2, r3, lr};" \ @@ -69,8 +69,8 @@ mcount (void) \ } #else #define MCOUNT \ -void __attribute__ ((naked)) \ - __attribute__ ((no_instrument_function)) \ +void __attribute__ ((__naked__)) \ + __attribute__ ((__no_instrument_function__)) \ mcount (void) \ { \ __asm__("stmdb sp!, {r0, r1, r2, r3, lr};" \ |