From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Piotr Krukowiecki <piotr.krukowiecki.news@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] Don't optimize code in debug build
Date: Sun, 13 Feb 2011 11:28:24 -0800 [thread overview]
Message-ID: <7vbp2fybs7.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <201102131036.51311.j6t@kdbg.org> (Johannes Sixt's message of "Sun\, 13 Feb 2011 10\:36\:50 +0100")
Johannes Sixt <j6t@kdbg.org> 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.
prev parent reply other threads:[~2011-02-13 19:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-13 8:32 [PATCH] Don't optimize code in debug build Piotr Krukowiecki
2011-02-13 9:36 ` Johannes Sixt
[not found] ` <AANLkTim6OHU8N7t5RQnt6S7x7ez48RSwp=b82McAC4Oq@mail.gmail.com>
2011-02-13 16:26 ` Piotr Krukowiecki
2011-02-13 19:28 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vbp2fybs7.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=piotr.krukowiecki.news@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).