Enable -Wformat=2 if it's supported.

This commit is contained in:
Vladimir Serbinenko 2013-12-21 15:28:28 +01:00
parent bbac6789aa
commit ae558c2ccf
15 changed files with 57 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
Enable -Wformat=2 if it's supported.
2013-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Add -Wmissing-include-dirs -Wmissing-prototypes

View file

@ -433,7 +433,7 @@ esac
gl_INIT
WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations"
EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2"
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"

View file

@ -154,6 +154,8 @@ label_get_minimal_size (void *vself, unsigned *width, unsigned *height)
+ grub_font_get_descent (self->font));
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void
label_set_state (void *vself, int visible, int start __attribute__ ((unused)),
int current, int end __attribute__ ((unused)))
@ -235,6 +237,8 @@ label_set_property (void *vself, const char *name, const char *value)
return GRUB_ERR_NONE;
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
static struct grub_gui_component_ops label_ops =
{
.destroy = label_destroy,

View file

@ -183,6 +183,8 @@ draw_pixmap_bar (grub_gui_progress_bar_t self)
}
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void
draw_text (grub_gui_progress_bar_t self)
{
@ -212,6 +214,8 @@ draw_text (grub_gui_progress_bar_t self)
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
static void
progress_bar_paint (void *vself, const grub_video_rect_t *region)
{

View file

@ -24,6 +24,8 @@
#include <grub/i386/pc/vesa_modes_table.h>
#include <grub/i18n.h>
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
struct legacy_command
{
const char *name;

View file

@ -237,6 +237,8 @@ have_devfs (void)
return dev_devfsd_exists;
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
{
@ -325,6 +327,8 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
return 0;
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
void
grub_hostdisk_flush_initial_buffer (const char *os_dev)
{

View file

@ -229,6 +229,9 @@ grub_partition_msdos_iterate (grub_disk_t disk,
}
#ifdef GRUB_UTIL
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static grub_err_t
pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
unsigned int max_nsectors,
@ -401,6 +404,9 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
N_("your embedding area is unusually small. "
"core.img won't fit in it."));
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
#endif

View file

@ -158,6 +158,8 @@ get_space(grub_size_t need)
}
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static inline void
save_text(const char *fmt, const char *s, int len)
{
@ -183,6 +185,8 @@ save_number(const char *fmt, int number, int len)
out_used += grub_strlen(out_buff + out_used);
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
static inline void
save_char(int c)
{

View file

@ -87,6 +87,8 @@ static error_t argp_parser (int key, char *arg, struct argp_state *state)
return 0;
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
@ -100,6 +102,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct argp argp = {
options, argp_parser, N_("FILENAME COMMAND"),
"\n"N_("\

View file

@ -45,6 +45,8 @@
#include <stdlib.h>
#include <errno.h>
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
char *
grub_install_help_filter (int key, const char *text,
void *input __attribute__ ((unused)))
@ -67,6 +69,8 @@ grub_install_help_filter (int key, const char *text,
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
static int (*compress_func) (const char *src, const char *dest) = NULL;
char *grub_install_copy_buffer;

View file

@ -326,6 +326,8 @@ get_default_platform (void)
#endif
}
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
@ -342,6 +344,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
/* TRANSLATORS: INSTALL_DEVICE isn't an identifier and is the DEVICE you
install to. */
struct argp argp = {

View file

@ -78,6 +78,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 }
};
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
@ -100,6 +102,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments
{
size_t nmodules;

View file

@ -112,6 +112,8 @@ static struct argp_option options[] = {
{0, 0, 0, 0, 0, 0}
};
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
@ -124,6 +126,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
enum {
SYS_AREA_AUTO,
SYS_AREA_COMMON,

View file

@ -661,6 +661,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 }
};
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
@ -674,6 +676,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments
{
char **devices;

View file

@ -94,6 +94,8 @@ static struct argp_option options[] = {
{ 0, 0, 0, 0, 0, 0 }
};
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static char *
help_filter (int key, const char *text, void *input __attribute__ ((unused)))
{
@ -116,6 +118,8 @@ help_filter (int key, const char *text, void *input __attribute__ ((unused)))
}
}
#pragma GCC diagnostic error "-Wformat-nonliteral"
struct arguments
{
char *boot_file;