@@ -81,13 +81,14 @@ except NameError :
8181o .Add (
8282 "CXX" ,
8383 "The C++ compiler." ,
84- "g++" if Environment ()["PLATFORM" ] != "win32" else "cl" ,
84+ {"darwin" : "clang++" , "win32" : "cl" }.get (Environment ()["PLATFORM" ], "g++" )
85+
8586)
8687
8788o .Add (
8889 "CXXFLAGS" ,
8990 "The extra flags to pass to the C++ compiler during compilation." ,
90- [ "-pipe" , "-Wall" ] if Environment ()["PLATFORM" ] != "win32" else [],
91+ [ "-pipe" , "-Wall" , "-Wextra" ] if Environment ()["PLATFORM" ] != "win32" else [],
9192)
9293
9394o .Add (
@@ -1109,7 +1110,7 @@ if env["PLATFORM"] != "win32" :
11091110 env .Append ( CXXFLAGS = [ "-Wno-unused-local-typedef" , "-Wno-deprecated-declarations" ] )
11101111
11111112 elif env ["PLATFORM" ]== "posix" :
1112- if "g++" in os .path .basename ( env ["CXX" ] ) :
1113+ if "g++" in os .path .basename ( env ["CXX" ] ) and not "clang++" in os . path . basename ( env [ "CXX" ] ) :
11131114 gccVersion = subprocess .check_output ( [ env ["CXX" ], "-dumpversion" ], env = env ["ENV" ], universal_newlines = True )
11141115 gccVersion = gccVersion .strip ()
11151116 gccVersion = [ int ( v ) for v in gccVersion .split ( "." ) ]
@@ -1119,7 +1120,12 @@ if env["PLATFORM"] != "win32" :
11191120 env .Append ( CXXFLAGS = [ "-std=$CXXSTD" , "-fvisibility=hidden" ] )
11201121
11211122 if "clang++" in os .path .basename ( env ["CXX" ] ) :
1122- env .Append ( CXXFLAGS = ["-Wno-unused-local-typedef" ] )
1123+ # Turn off the parts of `-Wall` and `-Wextra` that we don't like.
1124+ env .Append ( CXXFLAGS = ["-Wno-unused-local-typedef" , "-Wno-unused-parameter" ] )
1125+
1126+ elif "g++" in os .path .basename ( env ["CXX" ] ) :
1127+ # Turn off the parts of `-Wextra` that we don't like.
1128+ env .Append ( CXXFLAGS = [ "-Wno-cast-function-type" , "-Wno-unused-parameter" ] )
11231129
11241130 if env ["ASAN" ] :
11251131 env .Append (
0 commit comments