I go overkill on the debugger flags: -g -g3 -ggdb -gdwarf-4 Being able to debug C-macros has improved my life! (gdb) info macro Py_TYPE Defined at Include/object.h:117 included at Include/pytime.h:6 included at Include/Python.h:65 included at Parser/myreadline.c:12 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
Isn't -g3 sufficient ? ("Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when you use -g3."). [Note: I found -g3 to be extremely costly, but I guess everything has a cost...]
What Are Your GCC Flags?
51–60 of 117 posts
Re: What Are Your GCC Flags?
#52-Waggregate-return - everything returns an aggregate in C++, and that's not necessarily a bad thing.
-Wlong-long - We use long longs.
-Wmissing-declarations - We don't need to declare every internal function before we use it.
-Wmissing-include-dirs - Sadly necessary; gcc seems to include some on its own.
-Wpadded - Everything's padded.
-Wsystem-headers - I only wish I was in a position where this could be useful :)
As K&R would say, let the machine do the dirty work. If a warning check exists, there's probably a good reason for it.
Re: What Are Your GCC Flags?
#53The use of 'bytecode' is strange when refering to gcc and C code, perhaps 'object code', or executable would've been better. Bytecode is usually reserved for things like the JVM, or other cases where an interpreter/JIT is needed to run your code.
- The GNU Compiler Collection can compile Java, as well as other languages with "bytecode".
- GCC actually has a native intermediate language, it's just not very well advertised.
Re: What Are Your GCC Flags?
#54-Wl,-O1 Did you know that you also have an optimization flag for the linker ? Now you know! Ages ago the linker on SUN used to compile templates. What is GCC doing/using this flag for?
See this LWN article: http://lwn.net/Articles/192624/
Re: What Are Your GCC Flags?
#55The use of 'bytecode' is strange when refering to gcc and C code, perhaps 'object code', or executable would've been better. Bytecode is usually reserved for things like the JVM, or other cases where an interpreter/JIT is needed to run your code.
Couple of points: - The GNU Compiler Collection can compile Java, as well as other languages with "bytecode". - GCC actually has a native intermediate language, it's just not very well advertised.
Re: What Are Your GCC Flags?
#56Earlier quoted context omitted.
Isn't -g3 sufficient ? ("Level 3 includes extra information, such as all the macro definitions present in the program. Some debuggers support macro expansion when you use -g3."). [Note: I found -g3 to be extremely costly, but I guess everything has a cost...]
Costly in what sense? Compilation time? Binary size?
Re: What Are Your GCC Flags?
#57Re: What Are Your GCC Flags?
#58Re: What Are Your GCC Flags?
#59Earlier quoted context omitted.
That's fine and dandy. It's not fine when it's an open source project from three years and four compiler versions ago that you want to compile, and find -Werror on every line invocation in a Makefile. What you build with in-house for development/test-farms is not what you should ship as default to users of your project.
find -Werror on every line invocation in a Makefile If it's on every line and not kept in one place in $(CFLAGS), you have bigger problems.
Re: What Are Your GCC Flags?
#60This is probably an unpopular opinion, but: -Werror is fine on your dev machine, but is a very bad idea in the official build system, notably if you do it for a library that you want people to use. As soon as you want to compile with various compilers, systems, use cross-compilation and other funny things that makes it portable, you're going to have a bad time. New compilers will make new warnings, old compilers will…