From d0d7cbd88b71379704cf1e456da749aacdb6687d Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 24 Mar 2017 19:14:33 +0530 Subject: [PATCH] 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. --- mesonbuild/compilers.py | 16 ++++++++-------- mesonbuild/environment.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 5e7db2435..7f3c82e88 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.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] diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 92040c45d..1beb63c15 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -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