Skip to content

Commit

Permalink
Prefer Clang over GCC for Objective-C(++)
Browse files Browse the repository at this point in the history
GCC only has very limited support for Objective-C and doesn't support
any of the modern features, so whenever Clang is available, it should be
used instead. Essentially, the only reason to ever use GCC for
Objective-C is that Clang simply does not support the target system.
  • Loading branch information
Midar committed Apr 23, 2024
1 parent bf00ca6 commit f588d40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 4 additions & 5 deletions mesonbuild/compilers/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
# There is currently no pgc++ for Windows, only for Mac and Linux.
defaults['cpp'] = ['icl', 'cl', 'c++', 'g++', 'clang++', 'clang-cl']
defaults['fortran'] = ['ifort', 'gfortran', 'flang', 'pgfortran', 'g95']
# Clang and clang++ are valid, but currently unsupported.
defaults['objc'] = ['cc', 'gcc']
defaults['objcpp'] = ['c++', 'g++']
defaults['objc'] = ['clang-cl', 'gcc']
defaults['objcpp'] = ['clang-cl', 'g++']
defaults['cs'] = ['csc', 'mcs']
else:
if platform.machine().lower() == 'e2k':
Expand All @@ -59,8 +58,8 @@
else:
defaults['c'] = ['cc', 'gcc', 'clang', 'nvc', 'pgcc', 'icc', 'icx']
defaults['cpp'] = ['c++', 'g++', 'clang++', 'nvc++', 'pgc++', 'icpc', 'icpx']
defaults['objc'] = ['cc', 'gcc', 'clang']
defaults['objcpp'] = ['c++', 'g++', 'clang++']
defaults['objc'] = ['clang', 'gcc']
defaults['objcpp'] = ['clang++', 'g++']
defaults['fortran'] = ['gfortran', 'flang', 'nvfortran', 'pgfortran', 'ifort', 'ifx', 'g95']
defaults['cs'] = ['mcs', 'csc']
defaults['d'] = ['ldc2', 'ldc', 'gdc', 'dmd']
Expand Down
5 changes: 4 additions & 1 deletion test cases/cmake/24 mixing languages/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
project('CMake mix', ['c', 'cpp'])
# Explicitly require PIE so that mixing compilers with different defaults for
# whether to use PIE works.
project('CMake mix', ['c', 'cpp'],
default_options: ['b_pie'])

if not add_languages('objc', required : false)
error('MESON_SKIP_TEST: No ObjC compiler')
Expand Down

0 comments on commit f588d40

Please sign in to comment.