diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82934f93..f9ddb59d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -80,7 +80,7 @@ if(MSVC) list(APPEND EXTRA_WINDOWS_INCLUDES "msvc") else() set(LIB_MATH m) - add_compile_options(-Wall -Wextra -Wno-unused-parameter) + add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-format-zero-length) endif() # ===================================== diff --git a/src/avrdude.h b/src/avrdude.h index 6b777d30..0ee28466 100644 --- a/src/avrdude.h +++ b/src/avrdude.h @@ -46,7 +46,11 @@ extern const char *pgmid; // Programmer -c string #define mmt_realloc(p, n) cfg_realloc(__func__, p, n) #define mmt_free(p) free(p) -int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int msgmode, int msglvl, const char *format, ...); +int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int msgmode, int msglvl, const char *format, ...) +#if defined(__GNUC__) // Ask gcc to check whether format and parameters match + __attribute__ ((format (printf, 7, 8))) +#endif +; #define MSG_EXT_ERROR (-3) // OS-type error, no -v option, can be suppressed with -qqqqq #define MSG_ERROR (-2) // Avrdude error, no -v option, can be suppressed with -qqqq diff --git a/src/configure.ac b/src/configure.ac index 87647c8f..8b2d4ea3 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -556,7 +556,7 @@ fi # If we are compiling with gcc, enable all warnings and make warnings errors. ENABLE_WARNINGS="" if test "x$GCC" = xyes; then - ENABLE_WARNINGS="-Wall -Wextra -Wno-unused-parameter" + ENABLE_WARNINGS="-Wall -Wextra -Wno-unused-parameter -Wno-format-zero-length" # does this compiler support -Wno-pointer-sign ? AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])