summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-04-05 12:51:15 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-04-05 12:51:15 +0200
commite4a96164b6e52dac6aff7ddad05bd3ed735840a9 (patch)
tree33505e08440533b93dda6d676e6ae74c06eabd95
parent6a33727cb1ae9fe73432912ca07b583cd523a00f (diff)
SCons: add `methods.using_clang` to check used compiler
Also rename `use_gcc` to `using_gcc` to make it clear that it returns a config but does not alter it.
-rw-r--r--SConstruct4
-rw-r--r--methods.py5
-rw-r--r--platform/server/detect.py1
-rw-r--r--platform/x11/detect.py4
4 files changed, 8 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct
index b3875d6801..4a97cb9407 100644
--- a/SConstruct
+++ b/SConstruct
@@ -342,7 +342,7 @@ if selected_platform in platform_list:
shadow_local_warning = []
all_plus_warnings = ['-Wwrite-strings']
- if methods.use_gcc(env):
+ if methods.using_gcc(env):
version = methods.get_compiler_version(env)
if version != None and version[0] >= '7':
shadow_local_warning = ['-Wshadow-local']
@@ -350,7 +350,7 @@ if selected_platform in platform_list:
# FIXME: enable -Wimplicit-fallthrough once #26135 is fixed
# FIXME: enable -Wclobbered once #26351 is fixed
env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-implicit-fallthrough', '-Wno-unused-parameter'] + all_plus_warnings + shadow_local_warning)
- if methods.use_gcc(env):
+ if methods.using_gcc(env):
env['CCFLAGS'] += ['-Wno-clobbered']
elif (env["warnings"] == 'all'):
diff --git a/methods.py b/methods.py
index 7465962187..5bc30dc643 100644
--- a/methods.py
+++ b/methods.py
@@ -668,5 +668,8 @@ def get_compiler_version(env):
else:
return None
-def use_gcc(env):
+def using_gcc(env):
return 'gcc' in os.path.basename(env["CC"])
+
+def using_clang(env):
+ return 'clang' in os.path.basename(env["CC"])
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 39f72db0ad..f13ee72fd2 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -1,7 +1,6 @@
import os
import platform
import sys
-from methods import get_compiler_version, use_gcc
# This file is mostly based on platform/x11/detect.py.
# If editing this file, make sure to apply relevant changes here too.
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 163b9999a9..5cc5ef4ac0 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -2,7 +2,7 @@ import os
import platform
import sys
from compat import decode_utf8
-from methods import get_compiler_version, use_gcc
+from methods import get_compiler_version, using_gcc
def is_active():
return True
@@ -160,7 +160,7 @@ def configure(env):
env.Append(LINKFLAGS=['-pipe'])
# Check for gcc version >= 6 before adding -no-pie
- if use_gcc(env):
+ if using_gcc(env):
version = get_compiler_version(env)
if version != None and version[0] >= '6':
env.Append(CCFLAGS=['-fpie'])