Merge pull request #1754 from stefanrueger/no-format-zero-length

Remove gcc warning when printf format is ""
This commit is contained in:
Stefan Rueger
2024-04-25 16:29:44 +00:00
committed by GitHub
3 changed files with 7 additions and 3 deletions

View File

@@ -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()
# =====================================

View File

@@ -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

View File

@@ -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 ])