Browse Source

Add -Wsuggest-attribute=format warning, correct warnings thus generated

Add this new warning to the default build flags.  It suggests adding
a ((format)) attribute to xavsprintf_append(), so do that.

Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
David Gibson 2 years ago
parent
commit
e3cde0613b
  1. 3
      Makefile
  2. 3
      meson.build
  3. 2
      util.h

3
Makefile

@ -22,7 +22,8 @@ ASSUME_MASK ?= 0


CPPFLAGS = -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK) CPPFLAGS = -I libfdt -I . -DFDT_ASSUME_MASK=$(ASSUME_MASK)
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs -Wsign-compare \ WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs -Wsign-compare \
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow \
-Wsuggest-attribute=format
CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS) $(EXTRA_CFLAGS) CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS) $(EXTRA_CFLAGS)


BISON = bison BISON = bison

3
meson.build

@ -14,7 +14,8 @@ add_project_arguments(
'-Wstrict-prototypes', '-Wstrict-prototypes',
'-Wmissing-prototypes', '-Wmissing-prototypes',
'-Wredundant-decls', '-Wredundant-decls',
'-Wshadow' '-Wshadow',
'-Wsuggest-attribute=format',
]), ]),
language: 'c' language: 'c'
) )

2
util.h

@ -65,7 +65,7 @@ extern char *xstrndup(const char *s, size_t len);


extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...); extern int PRINTF(2, 3) xasprintf(char **strp, const char *fmt, ...);
extern int PRINTF(2, 3) xasprintf_append(char **strp, const char *fmt, ...); extern int PRINTF(2, 3) xasprintf_append(char **strp, const char *fmt, ...);
extern int xavsprintf_append(char **strp, const char *fmt, va_list ap); extern int PRINTF(2, 0) xavsprintf_append(char **strp, const char *fmt, va_list ap);
extern char *join_path(const char *path, const char *name); extern char *join_path(const char *path, const char *name);


/** /**

Loading…
Cancel
Save