4444
4545class LLVM (Compiler ):
4646 """Compiler toolchain with LLVM compilers (clang/flang)."""
47- # NAME = 'LLVMcore'
48- # COMPILER_MODULE_NAME = [NAME]
4947 COMPILER_FAMILY = TC_CONSTANT_LLVM
5048 SUBTOOLCHAIN = SYSTEM_TOOLCHAIN_NAME
5149
@@ -79,10 +77,8 @@ class LLVM(Compiler):
7977 'lld_undefined_version' : (True , "-Wl,--undefined-version - Allow unused version in version script" ),
8078 'no_unused_args' : (
8179 True ,
82- (
83- "-Wno-unused-command-line-argument - Avoid some failures in CMake correctly recognizing "
84- "feature due to linker warnings"
85- )
80+ "-Wno-unused-command-line-argument - Avoid some failures in CMake correctly recognizing "
81+ "feature due to linker warnings"
8682 ),
8783 'no_int_conversion_error' : (
8884 True ,
@@ -130,18 +126,21 @@ class LLVM(Compiler):
130126 'no_int_conversion_error' : ['-Wno-error=int-conversion' ],
131127 }
132128
133- COMPILER_OPTIONS = [
134- 'lld_undefined_version' ,
135- ]
129+ # Ensure that compiler options only appear once, so that arguments do not appear multiple times when compiling.
130+ COMPILER_OPTIONS = Compiler .COMPILER_OPTIONS
131+ COMPILER_OPTIONS += ['lld_undefined_version' ]
132+ COMPILER_OPTIONS = list (set (COMPILER_OPTIONS ))
136133
137134 # Options only available for Clang compiler
138- COMPILER_C_OPTIONS = [
135+ COMPILER_C_UNIQUE_OPTIONS = Compiler .COMPILER_C_UNIQUE_OPTIONS
136+ COMPILER_C_UNIQUE_OPTIONS += [
139137 'no_unused_args' ,
140138 'no_int_conversion_error'
141139 ]
140+ COMPILER_C_UNIQUE_OPTIONS = list (set (COMPILER_C_UNIQUE_OPTIONS ))
142141
143142 # Options only available for Flang compiler
144- COMPILER_F_OPTIONS = []
143+ COMPILER_F_UNIQUE_OPTIONS = Compiler . COMPILER_F_UNIQUE_OPTIONS
145144
146145 # used when 'optarch' toolchain option is enabled (and --optarch is not specified)
147146 COMPILER_OPTIMAL_ARCHITECTURE_OPTION = {
@@ -150,6 +149,7 @@ class LLVM(Compiler):
150149 (systemtools .X86_64 , systemtools .AMD ): '-march=native' ,
151150 (systemtools .X86_64 , systemtools .INTEL ): '-march=native' ,
152151 }
152+
153153 # used with --optarch=GENERIC
154154 COMPILER_GENERIC_OPTION = {
155155 (systemtools .RISCV64 , systemtools .RISCV ): '-march=rv64gc -mabi=lp64d' , # default for -mabi is system-dependent
@@ -159,12 +159,10 @@ class LLVM(Compiler):
159159
160160 COMPILER_CC = 'clang'
161161 COMPILER_CXX = 'clang++'
162- COMPILER_C_UNIQUE_OPTIONS = []
163162
164163 COMPILER_F77 = 'flang'
165164 COMPILER_F90 = 'flang'
166165 COMPILER_FC = 'flang'
167- COMPILER_F_UNIQUE_OPTIONS = []
168166
169167 LIB_MULTITHREAD = ['pthread' ]
170168 LIB_MATH = ['m' ]
0 commit comments