[Bug debug/42065] DWARF .debug_macinfo contains unused macros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065 --- Comment #5 from Eric Gallager --- (In reply to Eric Gallager from comment #4) > If -feliminate-unused-debug-symbols and/or -feliminate-unused-debug-types > start removing these, I'd want them to turn on -Wunused-macros automatically > for me as well so I can know about it Does the EnabledBy() thing in .opt files work across the -f/-W option prefix boundary, or are only warnings able to enable other warnings?
[Bug debug/42065] DWARF .debug_macinfo contains unused macros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065 Eric Gallager changed: What|Removed |Added CC||egall at gwmail dot gwu.edu --- Comment #4 from Eric Gallager --- If -feliminate-unused-debug-symbols and/or -feliminate-unused-debug-types start removing these, I'd want them to turn on -Wunused-macros automatically for me as well so I can know about it
[Bug debug/42065] DWARF .debug_macinfo contains unused macros
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065 Martin Sebor changed: What|Removed |Added Keywords||missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed||2017-02-07 CC||msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #3 from Martin Sebor --- It doesn't look like this has changed between GCC 4.5 and GCC 7 so I'll confirm it as a missing space optimization. $ cat t.c && gcc -g3 -Wall -feliminate-unused-debug-symbols -feliminate-unused-debug-types t.c && readelf -wm a.out | grep -e NOT -e USED #define NOT used #define USED(x) x int main (void) { return USED (0); } DW_MACRO_GNU_define_indirect - lineno : 1 macro : NOT used DW_MACRO_GNU_define_indirect - lineno : 2 macro : USED(x) x With GCC 7, even an empty object file contains 345 macro definitions (one for each macro predefined by GCC): $ /build/gcc-trunk/gcc/xgcc -B /build/gcc-trunk/gcc -c -g3 -xc -ot.o -
[Bug debug/42065] DWARF .debug_macinfo contains unused macros
--- Comment #1 from pinskia at gmail dot com 2009-11-16 14:31 --- Subject: Re: New: DWARF .debug_macinfo contains unused macros Sent from my iPhone On Nov 16, 2009, at 6:12 AM, jan dot kratochvil at redhat dot com gcc-bugzi...@gcc.gnu.org wrote: -g3 currently produces huge objects as it contains many unused macros. -g2 produces no macros debug info so GDB cannot provide its expansion. That is by design and the reason why -g is -g2 by default There is no way to store just the used macros. (debuginfo compression driven by Roland McGrath may eliminate them but still...) While even a macro never used by a program can be helpful in most cases IMO it is enough to provide the macro definitions touched by the code being debugged. -feliminate-unused-debug-symbols -feliminate-unused-debug-types have no effect. --- --- --- -- #define NOT used #define USED(x) x int main (void) { return USED (0); } --- --- --- -- Getting: gcc -g3 -o unusedmacro unusedmacro.c -Wall; readelf -wm unusedmacro DW_MACINFO_define - lineno : 1 macro : NOT used DW_MACINFO_define - lineno : 2 macro : USED(x) x or: gcc -g2 -o unusedmacro unusedmacro.c -Wall; readelf -wm unusedmacro nothing printed Expected output: gcc -g3 -o unusedmacro unusedmacro.c -Wall; readelf -wm unusedmacro DW_MACINFO_define - lineno : 2 macro : USED(x) x -- Summary: DWARF .debug_macinfo contains unused macros Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jan dot kratochvil at redhat dot com GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065
[Bug debug/42065] DWARF .debug_macinfo contains unused macros
--- Comment #2 from jan dot kratochvil at redhat dot com 2009-11-16 14:49 --- (In reply to comment #1) -g3 currently produces huge objects as it contains many unused macros. -g2 produces no macros debug info so GDB cannot provide its expansion. That is by design and the reason why -g is -g2 by default OK, thanks for info, still IMO there should be such an additional option. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065