]> granicus.if.org Git - strace/commitdiff
Use macros for gcc attributes
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 29 Mar 2015 22:45:03 +0000 (22:45 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 30 Mar 2015 00:33:06 +0000 (00:33 +0000)
* defs.h (error_msg, perror_msg, error_msg_and_die, perror_msg_and_die,
die_out_of_memory, printllval, printnum_int, printnum_long, tprintf):
Use ATTRIBUTE_* macros for gcc attributes.
* file.c (struct stat64): Likewise.
* statfs.c (struct compat_statfs64): Likewise.
* strace.c (die, exec_or_die, init): Likewise.
* linux/sparc/arch_sigreturn.c: Likewise.
* linux/ubi-user.h: Likewise.

defs.h
file.c
linux/sparc/arch_sigreturn.c
linux/ubi-user.h
statfs.c
strace.c

diff --git a/defs.h b/defs.h
index e1bf7a4dc7be3a6bba23369e445d9a6217d61f13..e6aca3714fac68fc024de5d942128ce93d1f3a49 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -426,11 +426,13 @@ extern unsigned os_release;
 
 enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };
 
-void error_msg(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
-void perror_msg(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
-void error_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
-void perror_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
-void die_out_of_memory(void) __attribute__ ((noreturn));
+void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
+void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
+void error_msg_and_die(const char *fmt, ...)
+       ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
+void perror_msg_and_die(const char *fmt, ...)
+       ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
+void die_out_of_memory(void) ATTRIBUTE_NORETURN;
 
 #if USE_CUSTOM_PRINTF
 /*
@@ -496,7 +498,7 @@ extern int print_quoted_string(const char *, unsigned int, unsigned int);
 #endif
 extern int getllval(struct tcb *, unsigned long long *, int);
 extern int printllval(struct tcb *, const char *, int)
-       __attribute__ ((format (printf, 2, 0)));
+       ATTRIBUTE_FORMAT((printf, 2, 0));
 
 extern void printxval(const struct xlat *, const unsigned int, const char *);
 extern int printargs(struct tcb *);
@@ -513,9 +515,9 @@ extern void dumpiov(struct tcb *, int, long);
 extern void dumpstr(struct tcb *, long, int);
 extern void printstr(struct tcb *, long, long);
 extern void printnum_int(struct tcb *, long, const char *)
-       __attribute__ ((format (printf, 3, 0)));
+       ATTRIBUTE_FORMAT((printf, 3, 0));
 extern void printnum_long(struct tcb *, long, const char *)
-       __attribute__ ((format (printf, 3, 0)));
+       ATTRIBUTE_FORMAT((printf, 3, 0));
 extern void printpath(struct tcb *, long);
 extern void printpathn(struct tcb *, long, unsigned int);
 #define TIMESPEC_TEXT_BUFSIZE (sizeof(long)*3 * 2 + sizeof("{%u, %u}"))
@@ -607,7 +609,7 @@ extern struct tcb *printing_tcp;
 extern void printleader(struct tcb *);
 extern void line_ended(void);
 extern void tabto(void);
-extern void tprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+extern void tprintf(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
 extern void tprints(const char *str);
 
 #if SUPPORTED_PERSONALITIES > 1
diff --git a/file.c b/file.c
index ae74d5ab82b78655c34a5cd6195499f2930a1fd5..9dc75950215baf0414ad32d9450b56bc5f05d966 100644 (file)
--- a/file.c
+++ b/file.c
@@ -305,7 +305,6 @@ sys_fstat(struct tcb *tcp)
  * Linux x86_64 and x32 have unified `struct stat' but their i386 personality
  * needs `struct stat64'.
  * linux/arch/x86/include/uapi/asm/stat.h defines `struct stat64' only for i386.
- * __GNUC__ is needed for the required __attribute__ below.
  *
  * Similarly, aarch64 has a unified `struct stat' but its arm personality
  * needs `struct stat64' (unlike x86, it shouldn't be packed).
@@ -332,7 +331,7 @@ struct stat64 {
        unsigned long long      st_ino;
 }
 #  if defined X86_64 || defined X32
-  __attribute__((packed))
+  ATTRIBUTE_PACKED
 #   define STAT64_SIZE 96
 #  else
 #   define STAT64_SIZE 104
index 9301431793e8f5d4ab3761e45ffd693190088d47..144b3a6d98d5e313b1b953bf8d7336962f95e9d8 100644 (file)
@@ -3,7 +3,7 @@ struct {
        struct pt_regs si_regs;
        int si_mask;
        void *fpu_save;
-       long insns[2] __attribute__ ((aligned (8)));
+       long insns[2] ATTRIBUTE_ALIGNED(8);
        unsigned int extramask[NSIG / 8 / sizeof(int) - 1];
 } frame;
 
index a12c8848302726703252991584afa1c9c002659c..e9e56b357820e598f3b9f1e900a5ceac7979b2f9 100644 (file)
@@ -307,7 +307,7 @@ struct ubi_mkvol_req {
        __s16 name_len;
        __s8 padding2[4];
        char name[UBI_MAX_VOLUME_NAME + 1];
-} __attribute__((packed));
+} ATTRIBUTE_PACKED;
 
 /**
  * struct ubi_rsvol_req - a data structure used in volume re-size requests.
@@ -323,7 +323,7 @@ struct ubi_mkvol_req {
 struct ubi_rsvol_req {
        __s64 bytes;
        __s32 vol_id;
-} __attribute__((packed));
+} ATTRIBUTE_PACKED;
 
 /**
  * struct ubi_rnvol_req - volumes re-name request.
@@ -365,7 +365,7 @@ struct ubi_rnvol_req {
                __s8  padding2[2];
                char    name[UBI_MAX_VOLUME_NAME + 1];
        } ents[UBI_MAX_RNVOL];
-} __attribute__((packed));
+} ATTRIBUTE_PACKED;
 
 /**
  * struct ubi_leb_change_req - a data structure used in atomic LEB change
@@ -389,7 +389,7 @@ struct ubi_leb_change_req {
        __s32 bytes;
        __s8  dtype; /* obsolete, do not use! */
        __s8  padding[7];
-} __attribute__((packed));
+} ATTRIBUTE_PACKED;
 
 /**
  * struct ubi_map_req - a data structure used in map LEB requests.
@@ -401,7 +401,7 @@ struct ubi_map_req {
        __s32 lnum;
        __s8  dtype; /* obsolete, do not use! */
        __s8  padding[3];
-} __attribute__((packed));
+} ATTRIBUTE_PACKED;
 
 
 /**
@@ -415,6 +415,6 @@ struct ubi_set_vol_prop_req {
        __u8  property;
        __u8  padding[7];
        __u64 value;
-}  __attribute__((packed));
+}  ATTRIBUTE_PACKED;
 
 #endif /* __UBI_USER_H__ */
index 214e6b2a813a29f70f20eb297eec57c127c26d26..6373195d2edb3356b3fec84241f64d4cf9d43066 100644 (file)
--- a/statfs.c
+++ b/statfs.c
@@ -125,7 +125,7 @@ struct compat_statfs64 {
        uint32_t f_spare[4];
 }
 #if defined AARCH64 || defined X86_64 || defined X32 || defined IA64
-  __attribute__ ((packed, aligned(4)))
+  ATTRIBUTE_PACKED ATTRIBUTE_ALIGNED(4)
 #endif
 ;
 #if defined AARCH64 || defined ARM
index 513d7cf486b388c90868ad36f1e61137d86c4f84..5eab360313000a5daecb896f79b3312e24230760 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -251,8 +251,8 @@ usage: strace [-CdffhiqrtttTvVxxy] [-I n] [-e expr]...\n\
        exit(exitval);
 }
 
-static void die(void) __attribute__ ((noreturn));
-static void die(void)
+static void ATTRIBUTE_NORETURN
+die(void)
 {
        if (strace_tracer_pid == getpid()) {
                cflag = 0;
@@ -1097,7 +1097,8 @@ struct exec_params {
        char *pathname;
 };
 static struct exec_params params_for_tracee;
-static void __attribute__ ((noinline, noreturn))
+
+static void ATTRIBUTE_NOINLINE ATTRIBUTE_NORETURN
 exec_or_die(void)
 {
        struct exec_params *params = &params_for_tracee;
@@ -1420,7 +1421,7 @@ get_os_release(void)
  * Don't want main() to inline us and defeat the reason
  * we have a separate function.
  */
-static void __attribute__ ((noinline))
+static void ATTRIBUTE_NOINLINE
 init(int argc, char *argv[])
 {
        struct tcb *tcp;