[Asterisk-code-review] Fix compiler error when using ./configure --enable-dev-mode ... (asterisk[certified/11.6])

George Joseph asteriskteam at digium.com
Wed Jul 20 16:15:57 CDT 2016


George Joseph has uploaded a new change for review.

  https://gerrit.asterisk.org/3268

Change subject: Fix compiler error when using ./configure --enable-dev-mode --enable-coverage
......................................................................

Fix compiler error when using ./configure --enable-dev-mode --enable-coverage

When DONT_OPTIMIZE is enabled with dev-mode, it causes a shadow compilation
to be done with output to /dev/null.  This can cause errors with coverage
when GCC attempts to write to /dev/null.gcno.  This change disables
coverage for the shadow compilation.

ASTERISK-24502 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4151/

Change-Id: I64e321f0dc38adf9389f5455f88c3cd740d38470
---
M Makefile.rules
1 file changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/3268/1

diff --git a/Makefile.rules b/Makefile.rules
index 5b4dfab..006df68 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -50,8 +50,10 @@
 endif
 
 ifeq ($(AST_CODE_COVERAGE),yes)
-    _ASTCFLAGS+=-ftest-coverage -fprofile-arcs
+    _ASTCFLAGS_COVERAGE=-ftest-coverage -fprofile-arcs
     _ASTLDFLAGS+=-ftest-coverage -fprofile-arcs
+else
+    _ASTCFLAGS_COVERAGE=
 endif
 
 ifeq ($(findstring $(CONFIG_CFLAGS),$(_ASTCFLAGS)),)
@@ -93,41 +95,41 @@
 ifeq ($(COMPILE_DOUBLE),yes)
 	$(CMD_PREFIX) $(CC) -o /dev/null -c $< $(CC_CFLAGS) $(OPTIMIZE)
 endif
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS)
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 
 %.o: %.i
 	$(ECHO_PREFIX) echo "   [CCi] $< -> $@"
 ifeq ($(COMPILE_DOUBLE),yes)
 	$(CMD_PREFIX) $(CC) -o /dev/null -c $< $(CC_CFLAGS) $(OPTIMIZE)
 endif
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS)
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 
 ifneq ($(COMPILE_DOUBLE),yes)
 %.o: %.c
 	$(ECHO_PREFIX) echo "   [CC] $< -> $@"
-	$(CMD_PREFIX) $(CC) -o $@ -c $< $(MAKE_DEPS) $(CC_CFLAGS)
+	$(CMD_PREFIX) $(CC) -o $@ -c $< $(MAKE_DEPS) $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 endif
 
 %.i: %.c
 	$(ECHO_PREFIX) echo "   [CPP] $< -> $@"
-	$(CMD_PREFIX) $(CC) -o $@ -E $< $(MAKE_DEPS) $(CC_CFLAGS)
+	$(CMD_PREFIX) $(CC) -o $@ -E $< $(MAKE_DEPS) $(CC_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 
 %.oo: %.ii
 	$(ECHO_PREFIX) echo "   [CXXi] $< -> $@"
 ifeq ($(COMPILE_DOUBLE),yes)
 	$(CMD_PREFIX) $(CXX) -o /dev/null -c $< $(CXX_CFLAGS) $(OPTIMIZE)
 endif
-	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(CXX_CFLAGS)
+	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 
 ifneq ($(COMPILE_DOUBLE),yes)
 %.oo: %.cc
 	$(ECHO_PREFIX) echo "   [CXX] $< -> $@"
-	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(MAKE_DEPS) $(CXX_CFLAGS)
+	$(CMD_PREFIX) $(CXX) -o $@ -c $< $(MAKE_DEPS) $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 endif
 
 %.ii: %.cc
 	$(ECHO_PREFIX) echo "   [CPP] $< -> $@"
-	$(CMD_PREFIX) $(CXX) -o $@ -E $< $(MAKE_DEPS) $(CXX_CFLAGS)
+	$(CMD_PREFIX) $(CXX) -o $@ -E $< $(MAKE_DEPS) $(CXX_CFLAGS) $(_ASTCFLAGS_COVERAGE)
 
 %.so: %.o
 ifeq ($(GNU_LD),1)

-- 
To view, visit https://gerrit.asterisk.org/3268
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I64e321f0dc38adf9389f5455f88c3cd740d38470
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/11.6
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>



More information about the asterisk-code-review mailing list