mark unreachable code with a macro
diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h
index 434dd6d..f98038d 100644
--- a/include/grpc/support/port_platform.h
+++ b/include/grpc/support/port_platform.h
@@ -181,6 +181,7 @@
 #ifndef _BSD_SOURCE
 #define _BSD_SOURCE
 #endif
+#define GPR_FORBID_UNREACHABLE_CODE
 #define GPR_MSG_IOVLEN_TYPE int
 #if TARGET_OS_IPHONE
 #define GPR_PLATFORM_STRING "ios"
@@ -336,4 +337,15 @@
 #endif
 #endif
 
+#ifdef GPR_FORBID_UNREACHABLE_CODE
+#define GPR_UNREACHABLE_CODE(STATEMENT)
+#else
+#define GPR_UNREACHABLE_CODE(STATEMENT)             \
+  do {                                              \
+    gpr_log(GPR_ERROR, "Should never reach here."); \
+    abort();                                        \
+    STATEMENT;                                      \
+  } while (0)
+#endif /* GPR_FORBID_UNREACHABLE_CODE */
+
 #endif /* GRPC_SUPPORT_PORT_PLATFORM_H */
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index b59b62a..4b5cd04 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -645,9 +645,7 @@
     case CALL_WAITING_FOR_CONFIG:
     case CALL_WAITING_FOR_CALL:
     case CALL_WAITING_FOR_SEND:
-      gpr_log(GPR_ERROR, "should never reach here");
-      abort();
-      break;
+      GPR_UNREACHABLE_CODE(return );
   }
 }
 
diff --git a/src/core/client_config/uri_parser.c b/src/core/client_config/uri_parser.c
index df9f32d..cbdfffc 100644
--- a/src/core/client_config/uri_parser.c
+++ b/src/core/client_config/uri_parser.c
@@ -37,6 +37,7 @@
 
 #include <grpc/support/alloc.h>
 #include <grpc/support/log.h>
+#include <grpc/support/port_platform.h>
 #include <grpc/support/string_util.h>
 
 /** a size_t default value... maps to all 1's */
@@ -120,8 +121,7 @@
         } else {
           return 1;
         }
-        gpr_log(GPR_ERROR, "should never reach here");
-        abort();
+        GPR_UNREACHABLE_CODE(return 0);
       default:
         (*i) += advance;
         break;
diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c
index 404906d..046770c 100644
--- a/src/core/httpcli/parser.c
+++ b/src/core/httpcli/parser.c
@@ -139,8 +139,7 @@
       }
       break;
     case GRPC_HTTPCLI_BODY:
-      gpr_log(GPR_ERROR, "should never reach here");
-      abort();
+      GPR_UNREACHABLE_CODE(return 0);
   }
 
   parser->cur_line_length = 0;
@@ -165,8 +164,7 @@
       } else {
         return 1;
       }
-      gpr_log(GPR_ERROR, "should never reach here");
-      abort();
+      GPR_UNREACHABLE_CODE(return 0);
     case GRPC_HTTPCLI_BODY:
       if (parser->r.body_length == parser->body_capacity) {
         parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2);
@@ -177,10 +175,7 @@
       parser->r.body_length++;
       return 1;
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
-
-  return 0;
+  GPR_UNREACHABLE_CODE(return 0);
 }
 
 void grpc_httpcli_parser_init(grpc_httpcli_parser *parser) {
diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c
index aca2691..fe20039 100644
--- a/src/core/iomgr/tcp_client_posix.c
+++ b/src/core/iomgr/tcp_client_posix.c
@@ -191,7 +191,7 @@
     goto finish;
   }
 
-  abort();
+  GPR_UNREACHABLE_CODE(return );
 
 finish:
   if (fd != NULL) {
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index 13bd675..99c76dc 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -352,7 +352,7 @@
     gpr_free(addr_str);
   }
 
-  abort();
+  GPR_UNREACHABLE_CODE(return );
 
 error:
   gpr_mu_lock(&sp->server->mu);
diff --git a/src/core/surface/byte_buffer.c b/src/core/surface/byte_buffer.c
index a930949..fb39c45 100644
--- a/src/core/surface/byte_buffer.c
+++ b/src/core/surface/byte_buffer.c
@@ -75,9 +75,7 @@
       return grpc_raw_byte_buffer_create(bb->data.raw.slice_buffer.slices,
                                          bb->data.raw.slice_buffer.count);
   }
-  gpr_log(GPR_INFO, "should never get here");
-  abort();
-  return NULL;
+  GPR_UNREACHABLE_CODE(return NULL);
 }
 
 void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) {
@@ -95,6 +93,5 @@
     case GRPC_BB_RAW:
       return bb->data.raw.slice_buffer.length;
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
+  GPR_UNREACHABLE_CODE(return 0);
 }
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index d15a3bc..bc1b95a 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -429,8 +429,7 @@
     gpr_mu_unlock(&call->completion_mu);
     return &call->completions[i];
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
+  GPR_UNREACHABLE_CODE(return NULL);
 }
 
 static void done_completion(grpc_exec_ctx *exec_ctx, void *call,
diff --git a/src/core/surface/channel_connectivity.c b/src/core/surface/channel_connectivity.c
index f72fb04..ca3c02c 100644
--- a/src/core/surface/channel_connectivity.c
+++ b/src/core/surface/channel_connectivity.c
@@ -100,9 +100,7 @@
   switch (w->phase) {
     case WAITING:
     case CALLED_BACK:
-      gpr_log(GPR_ERROR, "should never reach here");
-      abort();
-      break;
+      GPR_UNREACHABLE_CODE(return );
     case CALLING_BACK:
       w->phase = CALLED_BACK;
       break;
@@ -149,9 +147,7 @@
       w->phase = CALLING_BACK_AND_FINISHED;
       break;
     case CALLING_BACK_AND_FINISHED:
-      gpr_log(GPR_ERROR, "should never reach here");
-      abort();
-      break;
+      GPR_UNREACHABLE_CODE(return );
     case CALLED_BACK:
       delete = 1;
       break;
diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c
index e818ccb..9e552c2 100644
--- a/src/core/surface/completion_queue.c
+++ b/src/core/surface/completion_queue.c
@@ -254,8 +254,7 @@
       return;
     }
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
+  GPR_UNREACHABLE_CODE(return );
 }
 
 grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c
index acfa7c0..07179a4 100644
--- a/src/core/transport/chttp2/frame_data.c
+++ b/src/core/transport/chttp2/frame_data.c
@@ -168,7 +168,5 @@
       }
   }
 
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
-  return GRPC_CHTTP2_CONNECTION_ERROR;
+  GPR_UNREACHABLE_CODE(return GRPC_CHTTP2_CONNECTION_ERROR);
 }
diff --git a/src/core/transport/chttp2/frame_goaway.c b/src/core/transport/chttp2/frame_goaway.c
index 2ff1eda..c5758bc 100644
--- a/src/core/transport/chttp2/frame_goaway.c
+++ b/src/core/transport/chttp2/frame_goaway.c
@@ -152,9 +152,7 @@
       }
       return GRPC_CHTTP2_PARSE_OK;
   }
-  gpr_log(GPR_ERROR, "Should never end up here");
-  abort();
-  return GRPC_CHTTP2_CONNECTION_ERROR;
+  GPR_UNREACHABLE_CODE(return GRPC_CHTTP2_CONNECTION_ERROR);
 }
 
 void grpc_chttp2_goaway_append(gpr_uint32 last_stream_id, gpr_uint32 error_code,
diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c
index 20ea513..20d8312 100644
--- a/src/core/transport/chttp2/hpack_parser.c
+++ b/src/core/transport/chttp2/hpack_parser.c
@@ -1166,9 +1166,7 @@
       append_bytes(str, decoded, 3);
       goto b64_byte0;
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
-  return 1;
+  GPR_UNREACHABLE_CODE(return 1);
 }
 
 /* append a null terminator to a string */
@@ -1313,9 +1311,7 @@
       return 0;
   }
   /* Add code to prevent return without value error */
-  gpr_log(GPR_ERROR, "Should never reach beyond switch in parse_value_string");
-  abort();
-  return 0;
+  GPR_UNREACHABLE_CODE(return 0);
 }
 
 static int parse_value_string_with_indexed_key(grpc_chttp2_hpack_parser *p,
diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c
index f7a0a10..a0977cc 100644
--- a/src/core/transport/chttp2/parsing.c
+++ b/src/core/transport/chttp2/parsing.c
@@ -417,14 +417,10 @@
         transport_parsing->incoming_frame_size -= (gpr_uint32)(end - cur);
         return 1;
       }
-      gpr_log(GPR_ERROR, "should never reach here");
-      abort();
+      GPR_UNREACHABLE_CODE(return 0);
   }
 
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
-
-  return 0;
+  GPR_UNREACHABLE_CODE(return 0);
 }
 
 static int init_frame_parser(grpc_chttp2_transport_parsing *transport_parsing) {
@@ -580,9 +576,7 @@
     case GRPC_CHTTP2_CONNECTION_ERROR:
       return 0;
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
-  return 0;
+  GPR_UNREACHABLE_CODE(return 0);
 }
 
 static void free_timeout(void *p) { gpr_free(p); }
@@ -820,7 +814,5 @@
     case GRPC_CHTTP2_CONNECTION_ERROR:
       return 0;
   }
-  gpr_log(GPR_ERROR, "should never reach here");
-  abort();
-  return 0;
+  GPR_UNREACHABLE_CODE(return 0);
 }
diff --git a/src/core/transport/chttp2/stream_encoder.c b/src/core/transport/chttp2/stream_encoder.c
index 83227e6..6c7f7a9 100644
--- a/src/core/transport/chttp2/stream_encoder.c
+++ b/src/core/transport/chttp2/stream_encoder.c
@@ -428,7 +428,7 @@
       emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st);
       return elem;
     }
-    abort();
+    GPR_UNREACHABLE_CODE(return NULL);
   }
 
   indices_key = c->indices_keys[HASH_FRAGMENT_3(key_hash)];
@@ -442,7 +442,7 @@
       emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st);
       return elem;
     }
-    abort();
+    GPR_UNREACHABLE_CODE(return NULL);
   }
 
   /* no elem, key in the table... fall back to literal emission */
@@ -454,7 +454,7 @@
     emit_lithdr_noidx_v(c, elem, st);
     return elem;
   }
-  abort();
+  GPR_UNREACHABLE_CODE(return NULL);
 }
 
 #define STRLEN_LIT(x) (sizeof(x) - 1)
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index a44e1d2..e09744b 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -153,8 +153,7 @@
         GPR_ASSERT((*req)->in_flight_);
         return true;
     }
-    gpr_log(GPR_ERROR, "Should never reach here");
-    abort();
+    GPR_UNREACHABLE_CODE(return false);
   }
 
   void SetupRequest() { cq_ = grpc_completion_queue_create(nullptr); }