Closed lars18th closed 6 years ago
Thanks for pointing this out, but I need to double check if this is correct. I'm not sure now that optimisations actually get disabled... Let me check first.
Hi @mpbraendli ,
Thanks for pointing this out, but I need to double check if this is correct. I'm not sure now that optimisations actually get disabled... Let me check first.
Did you check it? I'm sure it's a handwriting mistake.
Give me time, I didn't forget about this. I agree there is a mistake, but I need to check what the actual behaviour is.
Observations:
With --enable-debug
, compiler flags include -g -O2
, i.e. with debugging, with optimisations
Without --enable-debug
, compiler flags also include -g -O2
So the option is totally pointless. I'll remove it.
There is one effect: the -DNDEBUG
compile flag. Investigating...
Hi @mpbraendli ,
So you're right and it's really something wrong.
As far as I know the DNDEBUG
is required when --enable-debug
is set. The "only" problem I see is that the compiler options aren't set right when debug is enabled.
FYI, this is what NDEBUG
means: http://en.cppreference.com/w/cpp/error/assert
Please, review the environment of CFLAGS
in your build machine.
I don't see any reference to -O2
in sources. So, I feel you see -g -O2
in the compile flags because the CFLAGS
is set to -g -O2
prior to call to the configure tool.
Performance difference with and without NDEBUG
is small on my machine (less than 1%), and having the assertions enabled can help me discover issues.
I don't have CFLAGS
nor CXXFLAGS
set on my machine and supposed -O2 -g
are defaults. I don't know where they come from.
I confirm it's the default. See https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/C_002b_002b-Compiler.html
Then, perhaps the solution is instruct the autoconf
tool to set the CFLAGS
to the correct value when "debug" or "nodebug" are used.
Usual consensus is to let the user override CFLAGS and CXXFLAGS if he wishes to. I've removed the --enable-debug
flag and updated INSTALL to mention this.
OK.
The description has a small bug. Fixed!