likewise for NORETURN_ATTR & SENTINEL_ATTR going to the simpler NORETURN & SENTINEL. The goal is to win a bit of screen real estate. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- Here is the result, just to show, but I don't find it interesting enough to add it to the tree. compile-i386.c | 2 +- example.c | 8 ++++---- lib.c | 6 ++---- lib.h | 30 +++++++++++++----------------- parse.c | 2 +- show-parse.c | 4 ++-- 6 files changed, 23 insertions(+), 29 deletions(-) diff --git a/compile-i386.c b/compile-i386.c index 2ee7b35ec..158112805 100644 --- a/compile-i386.c +++ b/compile-i386.c @@ -190,7 +190,7 @@ static struct function *current_func = NULL; static struct textbuf *unit_post_text = NULL; static const char *current_section; -static void emit_comment(const char * fmt, ...) FORMAT_ATTR(1); +static void emit_comment(const char * fmt, ...) PRINTF(1); static void emit_move(struct storage *src, struct storage *dest, struct symbol *ctype, const char *comment); static struct storage *x86_address_gen(struct expression *expr); diff --git a/example.c b/example.c index fd22d8ab2..73e45c0a2 100644 --- a/example.c +++ b/example.c @@ -226,7 +226,7 @@ static struct storage_hash *find_or_create_hash(pseudo_t pseudo, struct storage_ } /* Eventually we should just build it up in memory */ -static void FORMAT_ATTR(2) output_line(struct bb_state *state, const char *fmt, ...) +static void PRINTF(2) output_line(struct bb_state *state, const char *fmt, ...) { va_list args; @@ -235,7 +235,7 @@ static void FORMAT_ATTR(2) output_line(struct bb_state *state, const char *fmt, va_end(args); } -static void FORMAT_ATTR(2) output_label(struct bb_state *state, const char *fmt, ...) +static void PRINTF(2) output_label(struct bb_state *state, const char *fmt, ...) { static char buffer[512]; va_list args; @@ -247,7 +247,7 @@ static void FORMAT_ATTR(2) output_label(struct bb_state *state, const char *fmt, output_line(state, "%s:\n", buffer); } -static void FORMAT_ATTR(2) output_insn(struct bb_state *state, const char *fmt, ...) +static void PRINTF(2) output_insn(struct bb_state *state, const char *fmt, ...) { static char buffer[512]; va_list args; @@ -262,7 +262,7 @@ static void FORMAT_ATTR(2) output_insn(struct bb_state *state, const char *fmt, #define output_insn(state, fmt, arg...) \ output_insn(state, fmt "\t\t# %s" , ## arg , __FUNCTION__) -static void FORMAT_ATTR(2) output_comment(struct bb_state *state, const char *fmt, ...) +static void PRINTF(2) output_comment(struct bb_state *state, const char *fmt, ...) { static char buffer[512]; va_list args; diff --git a/lib.c b/lib.c index 30d1cf6d1..824b97aee 100644 --- a/lib.c +++ b/lib.c @@ -217,8 +217,7 @@ void expression_error(struct expression *expr, const char *fmt, ...) expr->ctype = &bad_ctype; } -NORETURN_ATTR -void error_die(struct position pos, const char * fmt, ...) +void NORETURN error_die(struct position pos, const char * fmt, ...) { va_list args; va_start(args, fmt); @@ -227,8 +226,7 @@ void error_die(struct position pos, const char * fmt, ...) exit(1); } -NORETURN_ATTR -void die(const char *fmt, ...) +void NORETURN die(const char *fmt, ...) { va_list args; static char buffer[512]; diff --git a/lib.h b/lib.h index 0e5f3e4a8..471db03ed 100644 --- a/lib.h +++ b/lib.h @@ -89,25 +89,21 @@ struct token *expect(struct token *, int, const char *); void unexpected(struct token *, const char *errmsg); #ifdef __GNUC__ -#define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1))) -#define NORETURN_ATTR __attribute__ ((__noreturn__)) -#define SENTINEL_ATTR __attribute__ ((__sentinel__)) +#define PRINTF(pos) __attribute__((__format__(__printf__, pos, pos+1))) +#define NORETURN __attribute__((__noreturn__)) +#define SENTINEL __attribute__((__sentinel__)) #else -#define FORMAT_ATTR(pos) -#define NORETURN_ATTR -#define SENTINEL_ATTR +#define PRINTF(pos) +#define NORETURN +#define SENTINEL #endif -FORMAT_ATTR(1) NORETURN_ATTR -extern void die(const char *, ...); - -FORMAT_ATTR(2) NORETURN_ATTR -extern void error_die(struct position, const char *, ...); - -extern void info(struct position, const char *, ...) FORMAT_ATTR(2); -extern void warning(struct position, const char *, ...) FORMAT_ATTR(2); -extern void sparse_error(struct position, const char *, ...) FORMAT_ATTR(2); -extern void expression_error(struct expression *, const char *, ...) FORMAT_ATTR(2); +extern void NORETURN die(const char *, ...) PRINTF(1); +extern void NORETURN error_die(struct position, const char *, ...) PRINTF(2); +extern void info(struct position, const char *, ...) PRINTF(2); +extern void warning(struct position, const char *, ...) PRINTF(2); +extern void sparse_error(struct position, const char *, ...) PRINTF(2); +extern void expression_error(struct expression *, const char *, ...) PRINTF(2); #define ERROR_CURR_PHASE (1 << 0) #define ERROR_PREV_PHASE (1 << 1) @@ -129,7 +125,7 @@ enum phase { #define PASS_FINAL (1UL << PASS__FINAL) -extern void add_pre_buffer(const char *fmt, ...) FORMAT_ATTR(1); +extern void add_pre_buffer(const char *fmt, ...) PRINTF(1); extern int preprocess_only; diff --git a/parse.c b/parse.c index 270ab7bfd..05e1dac01 100644 --- a/parse.c +++ b/parse.c @@ -604,7 +604,7 @@ static void fn_local_symbol(struct symbol *sym) add_symbol(function_symbol_list, sym); } -static int SENTINEL_ATTR match_idents(struct token *token, ...) +static int SENTINEL match_idents(struct token *token, ...) { va_list args; struct ident * next; diff --git a/show-parse.c b/show-parse.c index 72d3f3854..d8bbd164f 100644 --- a/show-parse.c +++ b/show-parse.c @@ -187,7 +187,7 @@ struct type_name { char *end; }; -static void FORMAT_ATTR(2) prepend(struct type_name *name, const char *fmt, ...) +static void PRINTF(2) prepend(struct type_name *name, const char *fmt, ...) { static char buffer[512]; int n; @@ -201,7 +201,7 @@ static void FORMAT_ATTR(2) prepend(struct type_name *name, const char *fmt, ...) memcpy(name->start, buffer, n); } -static void FORMAT_ATTR(2) append(struct type_name *name, const char *fmt, ...) +static void PRINTF(2) append(struct type_name *name, const char *fmt, ...) { static char buffer[512]; int n; -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html