From c61d0e178f1dcdb058ff46b23918bb9cbc06f54d Mon Sep 17 00:00:00 2001
From: "Nicolas \"Pixel\" Noble" <pixel@nobis-crew.org>
Date: Mon, 7 Dec 2015 19:30:29 +0100
Subject: [PATCH] Removing code coverage for unreachable code.

---
 Makefile                             | 4 ++--
 include/grpc/support/port_platform.h | 9 +++++++--
 templates/Makefile.template          | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 00fa92171d..537f20b97b 100644
--- a/Makefile
+++ b/Makefile
@@ -189,9 +189,9 @@ CC_gcov = gcc
 CXX_gcov = g++
 LD_gcov = gcc
 LDXX_gcov = g++
-CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage
+CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage -Wno-return-type
 LDFLAGS_gcov = -fprofile-arcs -ftest-coverage -rdynamic
-DEFINES_gcov = _DEBUG DEBUG
+DEFINES_gcov = _DEBUG DEBUG GCOV
 
 
 # General settings.
diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h
index 63e692cdb5..2c3df3f302 100644
--- a/include/grpc/support/port_platform.h
+++ b/include/grpc/support/port_platform.h
@@ -183,7 +183,7 @@
 #endif
 #define GPR_MSG_IOVLEN_TYPE int
 #if TARGET_OS_IPHONE
-#define GPR_FORBID_UNREACHABLE_CODE
+#define GPR_FORBID_UNREACHABLE_CODE 1
 #define GPR_PLATFORM_STRING "ios"
 #define GPR_CPU_IPHONE 1
 #define GPR_PTHREAD_TLS 1
@@ -252,6 +252,11 @@
 #define GPR_PLATFORM_STRING "unknown"
 #endif
 
+#ifdef GCOV
+#undef GPR_FORBID_UNREACHABLE_CODE
+#define GPR_FORBID_UNREACHABLE_CODE 1
+#endif
+
 /* For a common case, assume that the platform has a C99-like stdint.h */
 
 #include <stdint.h>
@@ -337,7 +342,7 @@ typedef uintptr_t gpr_uintptr;
 #endif
 #endif
 
-#ifdef GPR_FORBID_UNREACHABLE_CODE
+#if GPR_FORBID_UNREACHABLE_CODE
 #define GPR_UNREACHABLE_CODE(STATEMENT)
 #else
 #define GPR_UNREACHABLE_CODE(STATEMENT)             \
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 20d14c797f..e01185783d 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -205,9 +205,9 @@
   CXX_gcov = g++
   LD_gcov = gcc
   LDXX_gcov = g++
-  CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage
+  CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage -Wno-return-type
   LDFLAGS_gcov = -fprofile-arcs -ftest-coverage -rdynamic
-  DEFINES_gcov = _DEBUG DEBUG
+  DEFINES_gcov = _DEBUG DEBUG GCOV
 
 
   # General settings.
-- 
GitLab