Re: [PATCH] Don't optimize code in debug build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Sixt <j6t@xxxxxxxx> writes:

>> @@ -262,7 +262,10 @@ endif
>>
>>  # CFLAGS and LDFLAGS are for the users to override from the command line.
>>
>> -CFLAGS = -g -O2 -Wall
>> +CFLAGS = -g -Wall
>> +ifndef DEBUG
>> +CFLAGS += -O2
>> +endif
>>  LDFLAGS =
>>  ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
>>  ALL_LDFLAGS = $(LDFLAGS)
>
> Instead of this, you can just write
>
>  CFLAGS = -g -Wall
>
> in your config.mak. Is anything wrong with that?

You then need to feed -O2 from the command line when you are not doing a
debugging build.  On the other hand, with the current Makefile, you need
to feed "-g -O0" from the command line when you are doing a debugging
build if you and your debugger get confused when seeing an optimized
binary.  So neither is a very good solution.

But having to feed DEBUG=Yes when running a debug build is not a good
solution either.  A single toggle is simply too coarse-grained; the next
temptation after applying this patch would be to add

	ifdef DEBUG
        CFLAGS += -DDEBUG
        endif

and from there everything goes downhill.  That is the last thing we would
want to see happen.

So I would say the current Makefile is just fine as is.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]