Skip to content

Commit de94223

Browse files
author
Giacomo De Lazzari
committed
Fix handling of compiler flags with whitespace at the ends
This is relative to the previous commit, and fixes the code in some instances where the `args` list ended up with empty arguments or arguments with trailing spaces.
1 parent 5014908 commit de94223

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

simwave/kernel/backend/compiler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ def compile(self, dimension, density, float_precision, operator):
205205
# and consequenty fail; moreover split the compilation flags string to separate
206206
# arguments to ensure proper parsing
207207
args = [self.cc, program_path]
208-
args += self.cflags.split(' ')
208+
args += [flag.strip() for flag in self.cflags.split(' ') if flag.strip() != '']
209209
if float_precision.strip() != '':
210-
args.append("{}".format(float_precision))
210+
args.append("{}".format(float_precision).strip())
211211
if language_c.strip() != '':
212-
args.append(language_c)
212+
args.append(language_c.strip())
213213
args += ["-o", object_path]
214214

215215
print("Compilation command:", ' '.join(args))

0 commit comments

Comments
 (0)