Skip to content

Commit fbecd43

Browse files
committed
Add new compile flag: CC_O0 (zero compiler optimizations)
The idea is to decouple DBG_MALLOC from also completely disabling compiler optimizations. Maybe someone wants to deploy a debugging build to production that doesn't run like a wheelbarrow.
1 parent 1f821b1 commit fbecd43

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Makefile.conf.template

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ DEFS+= -DDBG_MALLOC #Include additional, debug-enabled allocator flavors
9090
#DEFS+= -DDBG_TCPCON #Attach struct history info to all TCP connections
9191
#DEFS+= -DNOSMP #Do not use SMP compliant locking. Faster but won't work on SMP machines
9292
#DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code
93+
DEFS+= -DCC_O0 #Zero compiler optimizations (FAST compile, SLOW code. For devs)
9394
#DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC
9495
#DEFS+= -DSHM_EXTRA_STATS #Provides tools to get extra statistics for the shared memory used
9596
#DEFS+= -DUNIT_TESTS #Include unit testing code into opensips and modules

Makefile.defs

+1-1
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ endif
786786
CFLAGS=$(shell echo "$${CFLAGS}")
787787
LDFLAGS+=
788788

789-
ifneq (,$(findstring DBG_MALLOC, $(DEFS)))
789+
ifneq (,$(findstring CC_O0, $(DEFS)))
790790
CC_OPTIMIZE_FLAG?=-O0
791791
endif
792792

version.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@
105105
#define DBG_MALLOC_STR ""
106106
#endif
107107

108+
#ifdef CC_O0
109+
#define CC_O0_STR ", CC_O0"
110+
#else
111+
#define CC_O0_STR ""
112+
#endif
113+
108114
#ifdef DEBUG_DMALLOC
109115
#define DEBUG_DMALLOC_STR ", DEBUG_DMALLOC"
110116
#else
@@ -175,7 +181,7 @@
175181
STATS_STR EXTRA_STATS_STR EXTRA_DEBUG_STR \
176182
DISABLE_NAGLE_STR USE_MCAST_STR NO_DEBUG_STR NO_LOG_STR \
177183
SHM_MMAP_STR PKG_MALLOC_STR Q_MALLOC_STR F_MALLOC_STR \
178-
HP_MALLOC_STR DBG_MALLOC_STR \
184+
HP_MALLOC_STR DBG_MALLOC_STR CC_O0_STR \
179185
DEBUG_DMALLOC_STR QM_JOIN_FREE_STR FAST_LOCK_STR NOSMP_STR \
180186
USE_PTHREAD_MUTEX_STR USE_UMUTEX_STR USE_POSIX_SEM_STR \
181187
USE_SYSV_SEM_STR DBG_LOCK_STR

0 commit comments

Comments
 (0)