git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Don't optimize code in debug build

From
PKPiotr Krukowiecki <piotr.krukowiecki.news@gmail.com>
Date
Feb 13, 2011, 08:32 UTC
Message-ID
<AANLkTinw7DJ3hP7ACcScHTYy-Dvizq-OxefP6e0dEBbR@mail.gmail.com>
Code optimization makes debugging harder.
Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki.news@gmail.com>
---
My first patch to this list, so please be gentle ;)
Patch fixes most important problem. There are other improvement possible:
- "-g" is not needed in normal build IMO, I'd move it to debug
- I'd add -O0 -fno-inline to debug too, but maybe it's too gccish
(OTOH there's -g already)
 Makefile |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index ade7923..32d3a69 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
-- 
1.7.1

-- 
Piotrek
Next: Johannes Sixt
Message 1 of 4 in “Don't optimize code in debug build”
  1. Don't optimize code in debug buildPiotr Krukowiecki, Feb 13, 2011
  2. Johannes SixtFeb 13, 2011
  3. Junio C HamanoFeb 13, 2011
  4. Piotr KrukowieckiFeb 13, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.