compilers: Rename 'get_define' to 'get_builtin_define'

We will use `get_define` to implement a function that fetches the
values of defines from headers.
pull/1511/head
Nirbheek Chauhan 8 years ago
parent 99649e6690
commit d0d7cbd88b
  1. 16
      mesonbuild/compilers.py
  2. 8
      mesonbuild/environment.py

@ -550,11 +550,11 @@ class Compiler:
def get_exelist(self):
return self.exelist[:]
def get_define(self, *args, **kwargs):
raise EnvironmentException('%s does not support get_define.' % self.id)
def get_builtin_define(self, *args, **kwargs):
raise EnvironmentException('%s does not support get_builtin_define.' % self.id)
def has_define(self, *args, **kwargs):
raise EnvironmentException('%s does not support has_define.' % self.id)
def has_builtin_define(self, *args, **kwargs):
raise EnvironmentException('%s does not support has_builtin_define.' % self.id)
def get_always_args(self):
return []
@ -2382,10 +2382,10 @@ class GnuCompiler:
args[args.index('-Wpedantic')] = '-pedantic'
return args
def has_define(self, define):
def has_builtin_define(self, define):
return define in self.defines
def get_define(self, define):
def get_builtin_define(self, define):
if define in self.defines:
return self.defines[define]
@ -2896,10 +2896,10 @@ class GnuFortranCompiler(FortranCompiler):
self.defines = defines or {}
self.id = 'gcc'
def has_define(self, define):
def has_builtin_define(self, define):
return define in self.defines
def get_define(self, define):
def get_builtin_define(self, define):
if define in self.defines:
return self.defines[define]

@ -102,7 +102,7 @@ def detect_windows_arch(compilers):
platform = os.environ.get('Platform', 'x86').lower()
if platform == 'x86':
return platform
if compiler.id == 'gcc' and compiler.has_define('__i386__'):
if compiler.id == 'gcc' and compiler.has_builtin_define('__i386__'):
return 'x86'
return os_arch
@ -129,10 +129,10 @@ def detect_cpu_family(compilers):
# to know is to check the compiler defines.
for c in compilers.values():
try:
if c.has_define('__i386__'):
if c.has_builtin_define('__i386__'):
return 'x86'
except mesonlib.MesonException:
# Ignore compilers that do not support has_define.
# Ignore compilers that do not support has_builtin_define.
pass
return 'x86_64'
# Add fixes here as bugs are reported.
@ -149,7 +149,7 @@ def detect_cpu(compilers):
# Same check as above for cpu_family
for c in compilers.values():
try:
if c.has_define('__i386__'):
if c.has_builtin_define('__i386__'):
return 'i686' # All 64 bit cpus have at least this level of x86 support.
except mesonlib.MesonException:
pass

Loading…
Cancel
Save