Add printf checking

This commit is contained in:
Ali Mashtizadeh 2023-08-22 22:03:53 -04:00
parent 06e247a401
commit 91e2e76c91
3 changed files with 6 additions and 2 deletions

View File

@ -59,7 +59,8 @@ env.Append(CFLAGS = [ "-Wshadow", "-Wno-typedef-redefinition" ])
#env.Append(CXXFLAGS = [ "-Wno-non-template-friend", "-Woverloaded-virtual",
# "-Wcast-qual", "-Wcast-align", "-Wconversion",
# "-Weffc++", "-std=c++0x", "-Werror" ])
env.Append(CPPFLAGS = [ "-fno-builtin", "-fno-stack-protector" ])
env.Append(CPPFLAGS = [ "-fno-builtin", "-fno-stack-protector",
"-Wformat=2", "-Wmissing-format-attribute" ])
if env["WITH_GPROF"] == "1":
env.Append(CPPFLAGS = [ "-pg" ])

View File

@ -3,6 +3,7 @@
#define __STDIO_H__
#include <sys/types.h>
#include <sys/cdefs.h>
typedef struct FILE {
int in_use;
@ -40,7 +41,7 @@ int puts(const char *str);
int printf(const char *fmt, ...);
int fprintf(FILE *stream, const char *fmt, ...);
int sprintf(char *str, const char *fmt, ...);
int snprintf(char *str, size_t size, const char *fmt, ...);
int snprintf(char *str, size_t size, const char *fmt, ...) __printflike(3, 4);;
#endif /* __STDIO_H__ */

View File

@ -16,5 +16,7 @@
#define __hidden __attribute__((__visibility__("hidden")))
#define __printflike(_fmt, _var) __attribute__((__format__(__printf__, _fmt, _var)))
#endif /* __CDEFS_H__ */