Skip to content

Commit

Permalink
Remove -std=gnu99 CFlag when compiling C++ with clang (#25778)
Browse files Browse the repository at this point in the history
* Remove -std=gnu99 CFlag when compiling C++ with clang

* Use endswith instead of hard-coded slices

* Fix a typo
  • Loading branch information
lidizheng committed Apr 6, 2021
1 parent 03adef1 commit 05ae3c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/python/grpcio/commands.py
Expand Up @@ -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)

Expand Down

0 comments on commit 05ae3c5

Please sign in to comment.