From 05ae3c5a87ba1037bd4c7a94e6b574c8df847065 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 6 Apr 2021 06:50:40 -0700 Subject: [PATCH] Remove -std=gnu99 CFlag when compiling C++ with clang (#25778) * Remove -std=gnu99 CFlag when compiling C++ with clang * Use endswith instead of hard-coded slices * Fix a typo --- src/python/grpcio/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index f4a3d2bdc041..df8fc46a3cad 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -258,10 +258,14 @@ def compiler_ok_with_extra_std(): old_compile = self.compiler._compile def new_compile(obj, src, ext, cc_args, extra_postargs, pp_opts): - if src[-2:] == '.c': + if src.endswith('.c'): extra_postargs = [ arg for arg in extra_postargs if not '-std=c++' in arg ] + elif src.endswith('.cc') or src.endswith('.cpp'): + extra_postargs = [ + arg for arg in extra_postargs if not '-std=gnu99' in arg + ] return old_compile(obj, src, ext, cc_args, extra_postargs, pp_opts)