1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Use gcc pragmas to suppress some warnings.

* configure.ac (AH_BOTTOM): Add GNUPG_GCC_VERSION macro.
* util/estream-printf.c (pr_float): Use new gcc pragma to ignore a
warning about a non-literal format.
* util/miscutil.c (asctimestamp): Ditto.
* cipher/md.c (md_stop_debug): Use new gcc pragme to ignore a warning
* about a set but unused variable.
This commit is contained in:
Werner Koch 2012-01-10 11:31:00 +01:00
parent b5b6cb57db
commit 667ba59ec5
4 changed files with 141 additions and 112 deletions

View File

@ -508,6 +508,7 @@ md_start_debug( MD_HANDLE md, const char *suffix )
log_debug("md debug: can't open %s\n", buf ); log_debug("md debug: can't open %s\n", buf );
} }
void void
md_stop_debug( MD_HANDLE md ) md_stop_debug( MD_HANDLE md )
{ {
@ -519,6 +520,9 @@ md_stop_debug( MD_HANDLE md )
} }
#ifdef HAVE_U64_TYPEDEF #ifdef HAVE_U64_TYPEDEF
{ /* a kludge to pull in the __muldi3 for Solaris */ { /* a kludge to pull in the __muldi3 for Solaris */
#if GNUPG_GCC_VERSION >= 40600
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
volatile u32 a = (u32)(ulong)md; volatile u32 a = (u32)(ulong)md;
volatile u64 b = 42; volatile u64 b = 42;
volatile u64 c; volatile u64 c;

View File

@ -446,6 +446,13 @@ is intended for making fat binary builds on OS X. */
# define EXEC_TEMPFILE_ONLY # define EXEC_TEMPFILE_ONLY
#endif #endif
/* A macro to help checking the GCC version. */
#ifdef __GNUC__
# define GNUPG_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#endif /*__GNUC__*/
/* Please note that the string version must not contain more /* Please note that the string version must not contain more
than one character because the using code assumes strlen()==1 */ than one character because the using code assumes strlen()==1 */
#ifdef HAVE_DOSISH_SYSTEM #ifdef HAVE_DOSISH_SYSTEM

View File

@ -1051,12 +1051,23 @@ pr_float (estream_printf_out_t outfnc, void *outfncarg,
if ((arg->flags & FLAG_ALT_CONV)) if ((arg->flags & FLAG_ALT_CONV))
*--p = '#'; *--p = '#';
*--p = '%'; *--p = '%';
#if GNUPG_GCC_VERSION >= 40600
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
#ifdef HAVE_LONG_DOUBLE #ifdef HAVE_LONG_DOUBLE
if (use_dbl) if (use_dbl)
sprintf (numbuf, p, adblfloat); sprintf (numbuf, p, adblfloat);
else else
#endif /*HAVE_LONG_DOUBLE*/ #endif /*HAVE_LONG_DOUBLE*/
sprintf (numbuf, p, afloat); sprintf (numbuf, p, afloat);
#if GNUPG_GCC_VERSION >= 40600
# pragma GCC diagnostic pop
#endif
p = numbuf; p = numbuf;
n = strlen (numbuf); n = strlen (numbuf);
pend = p + n; pend = p + n;

View File

@ -232,10 +232,17 @@ asctimestamp( u32 stamp )
tp = localtime( &atime ); tp = localtime( &atime );
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
#if defined(HAVE_NL_LANGINFO) #if defined(HAVE_NL_LANGINFO)
# if GNUPG_GCC_VERSION >= 40600
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
# endif
mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 ); mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 );
if( strstr( fmt, "%Z" ) == NULL ) if( strstr( fmt, "%Z" ) == NULL )
strcat( fmt, " %Z"); strcat( fmt, " %Z");
strftime( buffer, DIM(buffer)-1, fmt, tp ); strftime( buffer, DIM(buffer)-1, fmt, tp );
# if GNUPG_GCC_VERSION >= 40600
# pragma GCC diagnostic pop
# endif
#else #else
/* fixme: we should check whether the locale appends a " %Z" /* fixme: we should check whether the locale appends a " %Z"
* These locales from glibc don't put the " %Z": * These locales from glibc don't put the " %Z":