Skip to content

Commit 3def034

Browse files
fishilicomasahir0y
authored andcommitted
genksyms: add printf format attribute to error_with_pos()
When compiling with -Wsuggest-attribute=format in HOSTCFLAGS, gcc complains that error_with_pos() may be declared with a printf format attribute: scripts/genksyms/genksyms.c:726:3: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] vfprintf(stderr, fmt, args); ^~~~~~~~ This would allow catching printf-format errors at compile time in callers to error_with_pos(). Add this attribute. Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 0833289 commit 3def034

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎scripts/genksyms/genksyms.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct string_list *copy_list_range(struct string_list *start,
7575
int yylex(void);
7676
int yyparse(void);
7777

78-
void error_with_pos(const char *, ...);
78+
void error_with_pos(const char *, ...) __attribute__ ((format(printf, 1, 2)));
7979

8080
/*----------------------------------------------------------------------*/
8181
#define xmalloc(size) ({ void *__ptr = malloc(size); \

0 commit comments

Comments
 (0)