diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2024-04-25 16:03:48 -0700 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-06-26 16:15:47 -0400 |
| commit | ef83d943d96c5d73c09bd6e2abbfdbb15ae73029 (patch) | |
| tree | 652524709fc2af2ff84ffb6be7a21700c61a8de5 | |
| parent | d6bddafa265ce8f6a1d1194c284acc39f4188e46 (diff) | |
| download | meson-ef83d943d96c5d73c09bd6e2abbfdbb15ae73029.tar.gz | |
dependencies/openmp: Simplify error case
Instead of making the variable optional, just return if we hit the error
case, since that's all that's going to happen anyway
| -rw-r--r-- | mesonbuild/dependencies/misc.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index ffccd7089..4011c60fb 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -118,25 +118,24 @@ class OpenMPDependency(SystemDependency): except mesonlib.EnvironmentException as e: mlog.debug('OpenMP support not available in the compiler') mlog.debug(e) - openmp_date = None - - if openmp_date: - try: - self.version = self.VERSIONS[openmp_date] - except KeyError: - mlog.debug(f'Could not find an OpenMP version matching {openmp_date}') - if openmp_date == '_OPENMP': - mlog.debug('This can be caused by flags such as gcc\'s `-fdirectives-only`, which affect preprocessor behavior.') - return + return - # Flang has omp_lib.h - header_names = ('omp.h', 'omp_lib.h') - for name in header_names: - if self.clib_compiler.has_header(name, '', self.env, dependencies=[self], disable_cache=True)[0]: - self.is_found = True - break - else: - mlog.warning('OpenMP found but omp.h missing.', fatal=False) + try: + self.version = self.VERSIONS[openmp_date] + except KeyError: + mlog.debug(f'Could not find an OpenMP version matching {openmp_date}') + if openmp_date == '_OPENMP': + mlog.debug('This can be caused by flags such as gcc\'s `-fdirectives-only`, which affect preprocessor behavior.') + return + + # Flang has omp_lib.h + header_names = ('omp.h', 'omp_lib.h') + for name in header_names: + if self.clib_compiler.has_header(name, '', self.env, dependencies=[self], disable_cache=True)[0]: + self.is_found = True + break + else: + mlog.warning('OpenMP found but omp.h missing.', fatal=False) packages['openmp'] = OpenMPDependency |
