Use macros for gcc attributes

* 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.
This commit is contained in:
Дмитрий Левин 2015-03-29 22:45:03 +00:00
parent c84d0b8363
commit 5647cf86fc
6 changed files with 25 additions and 23 deletions

20
defs.h
View File

@ -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

3
file.c
View File

@ -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

View 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;

View 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__ */

View File

@ -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

View File

@ -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;