meson-tools icon indicating copy to clipboard operation
meson-tools copied to clipboard

warnings issued with additional build flags

Open vagrantc opened this issue 7 years ago • 2 comments

Using gcc 6.3.0-18, and xypron's autotools branch, I get the following warnings using Debian's standard build flags and hardening flags:

gcc -DPACKAGE_NAME="meson-tools" -DPACKAGE_TARNAME="meson-tools" -DPACKAGE_VERSION="0.2" -DPACKAGE_STRING="meson-tools\ 0.2" -DPACKAGE_BUGREPORT="Andreas\ Färber\ <[email protected]>" -DPACKAGE_URL="" -DPACKAGE="meson-tools" -DVERSION="0.2" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o amlbootsig.o amlbootsig.c gcc -DPACKAGE_NAME="meson-tools" -DPACKAGE_TARNAME="meson-tools" -DPACKAGE_VERSION="0.2" -DPACKAGE_STRING="meson-tools\ 0.2" -DPACKAGE_BUGREPORT="Andreas\ Färber\ <[email protected]>" -DPACKAGE_URL="" -DPACKAGE="meson-tools" -DVERSION="0.2" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o unamlbootsig.o unamlbootsig.c gcc -DPACKAGE_NAME="meson-tools" -DPACKAGE_TARNAME="meson-tools" -DPACKAGE_VERSION="0.2" -DPACKAGE_STRING="meson-tools\ 0.2" -DPACKAGE_BUGREPORT="Andreas\ Färber\ <[email protected]>" -DPACKAGE_URL="" -DPACKAGE="meson-tools" -DVERSION="0.2" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c -o amlinfo.o amlinfo.c amlinfo.c: In function 'info': amlinfo.c:62:11: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'long int' [-Wformat=] printf("FIP header @ 0x%" PRIx64 " (flags 0x%" PRIx64 ")\n", pos, fip_hdr->flags); ^~~~~~~~~~~~~~~~~~ amlinfo.c:86:10: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'long int' [-Wformat=] printf("@AML header @ 0x%" PRIx64 "\n", pos); ^~~~~~~~~~~~~~~~~~~ amlinfo.c:77:5: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] fread((void*)fip_hdr + sizeof(struct FipHeader), 1, sizeof(struct FipEntry), f); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ amlbootsig.c: In function 'boot_sig': unamlbootsig.c: In function 'extract': unamlbootsig.c:49:11: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'long int' [-Wformat=] printf("FIP header @ 0x%" PRIx64 " (flags 0x%" PRIx64 ")\n", pos, fip_hdr->flags); ^~~~~~~~~~~~~~~~~~ amlbootsig.c:205:2: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] fread(src_buf, 1, 0xb000, fin); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ amlbootsig.c: In function 'do_fip': amlbootsig.c:50:2: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] fread(toc_buf, 1, 0x4000, fin); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ unamlbootsig.c:112:10: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type 'long int' [-Wformat=] printf("@AML header @ 0x%" PRIx64 "\n", pos); ^~~~~~~~~~~~~~~~~~~ unamlbootsig.c:54:5: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] fread((void*)fip_hdr + sizeof(struct FipHeader), 1, sizeof(struct FipEntry), fin); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ unamlbootsig.c:61:4: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] fread((void*)fip_hdr + sizeof(struct FipHeader), 1, (n + 1) * sizeof(struct FipEntry), fin); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Without the autotools branch, the warnings are hidden because CFLAGS, LDFLAGS and CPPFLAGS are hard-coded.

vagrantc avatar Jun 08 '17 19:06 vagrantc

Correction: It is quite possible to override CFLAGS and LDFLAGS today. I am doing so for my package: https://build.opensuse.org/package/view_file/hardware/meson-tools/meson-tools.spec?expand=1

If you have individual fixes for the warnings you are seeing, I'd appreciate pull requests with signed off commits (your willingness to relicense for your issue #5 implied). Please do not mangle with Herinrich's proposal, there is no version 0.2 of meson-tools, so I will not merge it as is. Please also do not spread such naming via your Debian packages.

afaerber avatar Jun 08 '17 22:06 afaerber

Apologies, I'm not likely to come up with fixes for those issues; I do get the impression they are actual bugs.

Regarding overriding CFLAGS/LDFLAGS, ok, I guess you can override them, though it would be nicer to not have to. Is CPPFLAGS also respected in this case? other *FLAGS?

I didn't realize that the autotools proposal included inappropriate things like reversioning... perhaps comment on the pull request about that?

vagrantc avatar Jun 09 '17 03:06 vagrantc