From: Ulya Trofimovich Date: Mon, 20 Jul 2015 18:45:54 +0000 (+0100) Subject: Use 'vfprintf' instead of 'fprintf' to print variadic arguments. X-Git-Tag: 0.15~190 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c973377340129b956c8b272523774775583e213;p=re2c Use 'vfprintf' instead of 'fprintf' to print variadic arguments. Added GCC warninigs -Wformat=2 (reveals this error) and -Wsuggest-attribute=format. --- diff --git a/re2c/configure.ac b/re2c/configure.ac index 693e3ba7..dc49d1a1 100644 --- a/re2c/configure.ac +++ b/re2c/configure.ac @@ -58,7 +58,9 @@ TRY_CXXFLAG([-Wall]) TRY_CXXFLAG([-Wextra]) TRY_CXXFLAG([-Weffc++]) TRY_CXXFLAG([-pedantic]) +TRY_CXXFLAG([-Wformat=2]) TRY_CXXFLAG([-Wredundant-decls]) +TRY_CXXFLAG([-Wsuggest-attribute=format]) TRY_CXXFLAG([-O2]) TRY_CXXFLAG([-Weverything]) diff --git a/re2c/src/conf/msg.cc b/re2c/src/conf/msg.cc index 2becf970..9e3af72f 100644 --- a/re2c/src/conf/msg.cc +++ b/re2c/src/conf/msg.cc @@ -13,7 +13,7 @@ void error (const char * fmt, ...) va_list args; va_start (args, fmt); - fprintf (stderr, fmt, args); + vfprintf (stderr, fmt, args); va_end (args); }