Skip to contentSkip to conversation

gcc 5.1.1 and warnings when building fio on Linux with -flto

DISCUSSION Bruce Cran 2 participants 2 messages Jul 2, 2015 – Jul 3, 2015

lore
Share & tools
lore

Bruce Cran

author
#0 lore raw

Noticed the following warnings when building fio on Linux with gcc 5.1.1 and -flto:

debug.h:38:22: warning: type of ‘fio_debug’ does not match original declaration

 extern unsigned long fio_debug;
                      ^

t/debug.c:5:14: note: previously declared here
unsigned int fio_debug = 0;

lib/libmtd.c: In function ‘mtd_get_dev_info1’:
lib/libmtd.c:751:46: warning: passing argument 3 of ‘dev_read_data’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers]
ret = dev_read_data(lib->mtd_name, mtd_num, &mtd->name,

                                              ^
lib/libmtd.c:184:12: note: expected ‘void *’ but argument is of type ‘const char (*)[128]’
 static int dev_read_data(const char *patt, int mtd_num, void *buf, int 
buf_len)
            ^
lib/libmtd.c:757:46: warning: passing argument 3 of ‘dev_read_data’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers]
  ret = dev_read_data(lib->mtd_type, mtd_num, &mtd->type_str,
                                              ^

lib/libmtd.c:184:12: note: expected ‘void *’ but argument is of type ‘const char (*)[65]’
static int dev_read_data(const char *patt, int mtd_num, void *buf, int
buf_len)

Signature · 1 line
Bruce
#1 lore raw
Quoted 9 lines · Bruce Cran

Noticed the following warnings when building fio on Linux with gcc 5.1.1 and -flto:

debug.h:38:22: warning: type of ‘fio_debug’ does not match original declaration

  extern unsigned long fio_debug;
                       ^

t/debug.c:5:14: note: previously declared here
unsigned int fio_debug = 0;

Fixed that one up.

Quoted 15 lines

lib/libmtd.c: In function ‘mtd_get_dev_info1’:
lib/libmtd.c:751:46: warning: passing argument 3 of ‘dev_read_data’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers]
ret = dev_read_data(lib->mtd_name, mtd_num, &mtd->name,

                                               ^

lib/libmtd.c:184:12: note: expected ‘void *’ but argument is of type ‘const char (*)[128]’
static int dev_read_data(const char *patt, int mtd_num, void *buf, int
buf_len)

             ^

lib/libmtd.c:757:46: warning: passing argument 3 of ‘dev_read_data’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers]
ret = dev_read_data(lib->mtd_type, mtd_num, &mtd->type_str,

Quoted 5 lines
                                               ^

lib/libmtd.c:184:12: note: expected ‘void *’ but argument is of type ‘const char (*)[65]’
static int dev_read_data(const char *patt, int mtd_num, void *buf, int
buf_len)

This one I know about, mtd is in need of some const cleaning. It is currently reading into const strings.

Signature · 1 line
Jens Axboe