1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
From 05ae3c5a87ba1037bd4c7a94e6b574c8df847065 Mon Sep 17 00:00:00 2001
From: Lidi Zheng <lidiz@google.com>
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)
|