[PATCH] rename FORMAT_ATTR() to __printf(), ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



likewise for NORETURN_ATTR & SENTINEL_ATTR.

The goal is to win a bit of screen real estate. It also doesn't
hurt to be closer to what is done in the kernel.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 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..25f8b5d30 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..02c6ee6a5 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..011c28900 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..44b2fb020 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..02123519d 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..f7be73400 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



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux