Use more warning options with modern GCCs.

Other minor changes.
This commit is contained in:
Werner Koch 2008-10-17 19:18:46 +00:00
parent dd96bd44d4
commit 0698c5169f
14 changed files with 82 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2008-10-17 Werner Koch <wk@g10code.com>
* configure.ac: Use more warning options with modern GCCs.
2008-09-29 Werner Koch <wk@g10code.com> 2008-09-29 Werner Koch <wk@g10code.com>
* configure.ac: Require libgcrypt 1.4. * configure.ac: Require libgcrypt 1.4.

View File

@ -1,3 +1,8 @@
2008-10-17 Werner Koch <wk@g10code.com>
* call-scd.c (start_scd) [W32]: Use snprintf again because we now
always use the estream variant.
2008-10-15 Werner Koch <wk@g10code.com> 2008-10-15 Werner Koch <wk@g10code.com>
* call-scd.c (start_scd): Enable assuan loggging if requested. * call-scd.c (start_scd): Enable assuan loggging if requested.

View File

@ -381,10 +381,8 @@ start_scd (ctrl_t ctrl)
char buf[100]; char buf[100];
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
/* Use estream snprintf due to a bug in mingw32 related to the l snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
modifier. */ (unsigned long)get_agent_scd_notify_event ());
estream_snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
(unsigned long)get_agent_scd_notify_event ());
#else #else
snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2); snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
#endif #endif

View File

@ -80,7 +80,7 @@ static struct putval_item_s *putval_list;
/* To help polling clients, we keep tarck of the number of certain /* To help polling clients, we keep track of the number of certain
events. This structure keeps those counters. The counters are events. This structure keeps those counters. The counters are
integers and there should be no problem if they are overflowing as integers and there should be no problem if they are overflowing as
callers need to check only whether a counter changed. The actual callers need to check only whether a counter changed. The actual

View File

@ -1,3 +1,7 @@
2008-10-17 Werner Koch <wk@g10code.com>
* util.h (snprintf) [W32]: Redefine to estream_snprintf.
2008-09-03 Werner Koch <wk@g10code.com> 2008-09-03 Werner Koch <wk@g10code.com>
* convert.c (hex2str): New. * convert.c (hex2str): New.

View File

@ -31,6 +31,8 @@
static void static void
my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr) my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr)
{ {
(void)dummy;
/* Map the log levels. */ /* Map the log levels. */
switch (level) switch (level)
{ {
@ -51,6 +53,8 @@ my_gcry_logger (void *dummy, int level, const char *fmt, va_list arg_ptr)
static void static void
my_gcry_fatalerror_handler (void *opaque, int rc, const char *text) my_gcry_fatalerror_handler (void *opaque, int rc, const char *text)
{ {
(void)opaque;
log_fatal ("libgcrypt problem: %s\n", text ? text : gpg_strerror (rc)); log_fatal ("libgcrypt problem: %s\n", text ? text : gpg_strerror (rc));
abort (); abort ();
} }
@ -64,6 +68,8 @@ my_gcry_outofcore_handler (void *opaque, size_t req_n, unsigned int flags)
{ {
static int been_here; /* Used to protect against recursive calls. */ static int been_here; /* Used to protect against recursive calls. */
(void)opaque;
if (!been_here) if (!been_here)
{ {
been_here = 1; been_here = 1;
@ -140,6 +146,8 @@ print_hexstring (FILE *fp, const void *buffer, size_t length, int reserved)
#define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) #define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A'))
const unsigned char *s; const unsigned char *s;
(void)reserved;
for (s = buffer; length; s++, length--) for (s = buffer; length; s++, length--)
{ {
putc ( tohex ((*s>>4)&15), fp); putc ( tohex ((*s>>4)&15), fp);

View File

@ -46,6 +46,12 @@
#define asprintf estream_asprintf #define asprintf estream_asprintf
#define vasprintf estream_vasprintf #define vasprintf estream_vasprintf
/* Due to a bug in mingw32's snprintf related to the 'l' modifier we
better use our snprintf. */
#ifdef HAVE_W32_SYSTEM
#define snprintf estream_snprintf
#endif
/* GCC attributes. */ /* GCC attributes. */
#if __GNUC__ >= 4 #if __GNUC__ >= 4
@ -260,6 +266,7 @@ int match_multistr (const char *multistr,const char *match);
static inline char * static inline char *
ttyname (int fd) ttyname (int fd)
{ {
(void)fd;
return NULL; return NULL;
} }
#endif /* !HAVE_TTYNAME */ #endif /* !HAVE_TTYNAME */

View File

@ -1248,6 +1248,24 @@ if test "$GCC" = yes; then
if test "$USE_MAINTAINER_MODE" = "yes"; then if test "$USE_MAINTAINER_MODE" = "yes"; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes" CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security" CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wno-missing-field-initializers"
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
AC_MSG_RESULT($_gcc_wopt)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_wopt" = xyes ; then
CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
fi
AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wdeclaration-after-statement"
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
AC_MSG_RESULT($_gcc_wopt)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_wopt" = xyes ; then
CFLAGS="$CFLAGS -Wdeclaration-after-statement"
fi
else else
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
fi fi

View File

@ -1,9 +1,16 @@
2008-10-17 Werner Koch <wk@g10code.com>
* main.h (idea_cipher_warn): Use do while construct in place of an
empty definition.
2008-10-03 David Shaw <dshaw@jabberwocky.com> 2008-10-03 David Shaw <dshaw@jabberwocky.com>
* main.h, mainproc.c (check_sig_and_print), * main.h, mainproc.c (check_sig_and_print)
keylist.c (list_keyblock_print), pkclist.c (do_edit_ownertrust), * keylist.c (list_keyblock_print)
keyedit.c (menu_showphoto), photoid.c (generate_photo_id, * pkclist.c (do_edit_ownertrust)
show_photos), misc.c (pct_expando): Add %v and %V expandos so * keyedit.c (menu_showphoto)
* photoid.c (generate_photo_id, show_photos)
* misc.c (pct_expando): Add %v and %V expandos so
that displaying photo IDs can show the attribute validity that displaying photo IDs can show the attribute validity
tag (%v) and string (%V). Originally by Daniel Gillmor. tag (%v) and string (%V). Originally by Daniel Gillmor.

View File

@ -93,7 +93,7 @@ int openpgp_md_test_algo( int algo );
#ifdef USE_IDEA #ifdef USE_IDEA
void idea_cipher_warn( int show ); void idea_cipher_warn( int show );
#else #else
#define idea_cipher_warn(a) #define idea_cipher_warn(a) do { } while (0)
#endif #endif
struct expando_args struct expando_args

View File

@ -246,7 +246,7 @@ get_it( PKT_pubkey_enc *enc, DEK *dek, PKT_secret_key *sk, u32 *keyid )
log_info(_("cipher algorithm %d%s is unknown or disabled\n"), log_info(_("cipher algorithm %d%s is unknown or disabled\n"),
dek->algo, dek->algo == CIPHER_ALGO_IDEA? " (IDEA)":""); dek->algo, dek->algo == CIPHER_ALGO_IDEA? " (IDEA)":"");
if(dek->algo==CIPHER_ALGO_IDEA) if(dek->algo==CIPHER_ALGO_IDEA)
idea_cipher_warn(0); idea_cipher_warn (0);
} }
dek->algo = 0; dek->algo = 0;
goto leave; goto leave;

View File

@ -31,6 +31,7 @@ static inline void *
dlopen (const char * name, int flag) dlopen (const char * name, int flag)
{ {
void * hd = LoadLibrary (name); void * hd = LoadLibrary (name);
(void)flag;
return hd; return hd;
} }

View File

@ -1,3 +1,8 @@
2008-10-16 Werner Koch <wk@g10code.com>
* command.c (cmd_disconnect): New dummy command.
(register_commands): Register command.
2008-10-15 Werner Koch <wk@g10code.com> 2008-10-15 Werner Koch <wk@g10code.com>
* command.c (scd_command_handler): Return true if there is no more * command.c (scd_command_handler): Return true if there is no more

View File

@ -1638,6 +1638,19 @@ cmd_restart (assuan_context_t ctx, char *line)
} }
/* DISCONNECT
TBD
*/
static int
cmd_disconnect (assuan_context_t ctx, char *line)
{
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
}
/* APDU [--atr] [--more] [hexstring] /* APDU [--atr] [--more] [hexstring]
Send an APDU to the current reader. This command bypasses the high Send an APDU to the current reader. This command bypasses the high
@ -1756,6 +1769,7 @@ register_commands (assuan_context_t ctx)
{ "UNLOCK", cmd_unlock }, { "UNLOCK", cmd_unlock },
{ "GETINFO", cmd_getinfo }, { "GETINFO", cmd_getinfo },
{ "RESTART", cmd_restart }, { "RESTART", cmd_restart },
{ "DISCONNECT", cmd_disconnect },
{ "APDU", cmd_apdu }, { "APDU", cmd_apdu },
{ NULL } { NULL }
}; };