aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2015-05-16 14:20:45 +0200
committerJan Kratochvil <jan.kratochvil@redhat.com>2015-05-16 14:39:59 +0200
commit3a9558c494e9b461f752ce26382701d4446f0958 (patch)
tree4bfb7710407ffbe123967b57c339f1c25fd372da /gdb/compile/compile.c
parent5c65b58a58a4c77b1ec38b4e31549aaa090b4845 (diff)
downloadfsf-binutils-gdb-3a9558c494e9b461f752ce26382701d4446f0958.zip
fsf-binutils-gdb-3a9558c494e9b461f752ce26382701d4446f0958.tar.gz
fsf-binutils-gdb-3a9558c494e9b461f752ce26382701d4446f0958.tar.bz2
compile: Use -Wall, not -w
For a reason unknown to me GDB was using -w instead of -Wall for 'compile code'. The problem is later patch for 'compile printf' really needs some warnings to be able to catch for example missing format string parameters: (gdb) compile printf "%d\n" GCC does not seem to be able to cancel -w (there is nothing like -no-w). Besides that I think even 'compile code' can benefit from -Wall. That #ifndef change in print_one_macro() is needed otherwise we get macro-redefinition warnings for the GCC built-in macros (as -w is no longer in effect). For example, without the #ifndef/#endif one gets: compile -r -- void _gdb_expr(){int i = 5;}^M /tmp/gdbobj-xpU1yB/out4.c:4:0: warning: "__FILE__" redefined [-Wbuiltin-macro-redefined]^M /tmp/gdbobj-xpU1yB/out4.c:5:0: warning: "__LINE__" redefined^M ... It makes more sense to pick the inferior's version of the macros, hence #ifndef instead of #undef. That new testsuite XFAIL is there as if one changes the struct definition to be compliant with cv-qualifiers (to prevent the warnings): struct struct_type { - struct struct_type *selffield; + volatile struct struct_type *selffield; only then GCC/GDB will hit the crash, described in that GDB PR 18202. gdb/ChangeLog 2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com> * compile/compile-c-support.c (print_one_macro): Use #ifndef. (generate_register_struct): Use __gdb_uintptr for TYPE_CODE_PTR. (c_compute_program): Call generate_register_struct after typedefs. * compile/compile-loc2c.c (push, pushf_register_address) (pushf_register): Cast to GCC_UINTPTR. (do_compile_dwarf_expr_to_c): Use unused attribute. Add space after type. Use GCC_UINTPTR instead of void *. Remove excessive cast. (compile_dwarf_expr_to_c): Use GCC_UINTPTR instead of void *. * compile/compile.c (_initialize_compile): Enable warnings for COMPILE_ARGS. gdb/testsuite/ChangeLog 2015-05-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.compile/compile-ops.exp: Cast param to void. * gdb.compile/compile.exp: Complete type for _gdb_expr. (compile code struct_object.selffield = &struct_object): Add xfail.
Diffstat (limited to 'gdb/compile/compile.c')
-rw-r--r--gdb/compile/compile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 621de66..ab19a5d 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -680,8 +680,11 @@ String quoting is parsed like in shell, for example:\n\
absolute target address.
-fPIC is not used at is would require from GDB to generate .got. */
" -fPIE"
- /* We don't want warnings. */
- " -w"
+ /* We want warnings, except for some commonly happening for GDB commands. */
+ " -Wall "
+ " -Wno-implicit-function-declaration"
+ " -Wno-unused-but-set-variable"
+ " -Wno-unused-variable"
/* Override CU's possible -fstack-protector-strong. */
" -fno-stack-protector"
);