Skip to content

Commit

Permalink
Add new compile flag: CC_O0 (zero compiler optimizations)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
liviuchircu committed Mar 15, 2019
1 parent 1f821b1 commit fbecd43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile.conf.template
Expand Up @@ -90,6 +90,7 @@ DEFS+= -DDBG_MALLOC #Include additional, debug-enabled allocator flavors
#DEFS+= -DDBG_TCPCON #Attach struct history info to all TCP connections
#DEFS+= -DNOSMP #Do not use SMP compliant locking. Faster but won't work on SMP machines
#DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code
DEFS+= -DCC_O0 #Zero compiler optimizations (FAST compile, SLOW code. For devs)
#DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC
#DEFS+= -DSHM_EXTRA_STATS #Provides tools to get extra statistics for the shared memory used
#DEFS+= -DUNIT_TESTS #Include unit testing code into opensips and modules
Expand Down
2 changes: 1 addition & 1 deletion Makefile.defs
Expand Up @@ -786,7 +786,7 @@ endif
CFLAGS=$(shell echo "$${CFLAGS}")
LDFLAGS+=

ifneq (,$(findstring DBG_MALLOC, $(DEFS)))
ifneq (,$(findstring CC_O0, $(DEFS)))
CC_OPTIMIZE_FLAG?=-O0
endif

Expand Down
8 changes: 7 additions & 1 deletion version.h
Expand Up @@ -105,6 +105,12 @@
#define DBG_MALLOC_STR ""
#endif

#ifdef CC_O0
#define CC_O0_STR ", CC_O0"
#else
#define CC_O0_STR ""
#endif

#ifdef DEBUG_DMALLOC
#define DEBUG_DMALLOC_STR ", DEBUG_DMALLOC"
#else
Expand Down Expand Up @@ -175,7 +181,7 @@
STATS_STR EXTRA_STATS_STR EXTRA_DEBUG_STR \
DISABLE_NAGLE_STR USE_MCAST_STR NO_DEBUG_STR NO_LOG_STR \
SHM_MMAP_STR PKG_MALLOC_STR Q_MALLOC_STR F_MALLOC_STR \
HP_MALLOC_STR DBG_MALLOC_STR \
HP_MALLOC_STR DBG_MALLOC_STR CC_O0_STR \
DEBUG_DMALLOC_STR QM_JOIN_FREE_STR FAST_LOCK_STR NOSMP_STR \
USE_PTHREAD_MUTEX_STR USE_UMUTEX_STR USE_POSIX_SEM_STR \
USE_SYSV_SEM_STR DBG_LOCK_STR
Expand Down

0 comments on commit fbecd43

Please sign in to comment.