change Toolchain.get_flag so it doesn't automatically prepend a dash (-) to compiler flags, add deprecation warning for optarch value without leading dash, rename Compiler.COMPILER*_FLAGS to Compiler.COMPILER*_OPTIONS#4698
Conversation
35d3b7b to
24cfdc6
Compare
|
I finally found the place that actually adds the extra - It boils down to using FlagList, and possible CommandFlagList. I need to find a scenario where CommandFlagList was used withmore than a single argument, but it's all so very deeply hidden and obscured it's impossible to tell where the heck these are coming from. Tests indicate it works like so i need to find a scenario where this actually used, to ensure i did fix it correctly. |
614757a to
f9fba39
Compare
| COMPILER_CC = 'clang' | ||
| COMPILER_CXX = 'clang++' | ||
| COMPILER_C_UNIQUE_FLAGS = [] | ||
| COMPILER_C_UNIQUE_OPTIONS = [] |
There was a problem hiding this comment.
Hmm, do we really need to change this?
We have to take into account that people may have their own/custom implementations of classes that derive from Compiler, they will need to be adjusted accordingly (and we have no easy way to produce a clean error message there, I think)...
There was a problem hiding this comment.
A deprecation warning has been implemented by @Micket in Compiler._set_compiler_flags, so this change won't cause any silent breakage.
| expected = {} | ||
| self.assertEqual(res, expected) | ||
|
|
||
| def test_get_flag(self): |
There was a problem hiding this comment.
I think we can keep the test? It's a simpler function of course but can still be tested.
There was a problem hiding this comment.
makes sense, I consider get_flag to be part of the public API
| old_var = getattr(self, f'COMPILER{variant}_FLAGS', None) | ||
| if old_var is not None: | ||
| self.log.deprecated(f'COMPILER{variant}_FLAGS has been renamed to COMPILER{variant}_OPTIONS.', '6.0') | ||
| setattr(self, f'COMPILER{variant}_OPTIONS', old_var) |
There was a problem hiding this comment.
Added warnings and backwards compat to handle the renamed variables to address @boegel review
13aa8c8 to
4d83479
Compare
Toolchain.get_flag so it doesn't automatically prepend a dash (-) to compiler flags, add deprecation warning for optarch value without leading dash, rename Compiler.COMPILER*_FLAGS to Compiler.COMPILER*_OPTIONS
Fixes #4269
It was extremely difficult to read this code, partly because a bunch of variables like:
were, in fact, not flags, but options. I renamed these variables because it was so misleading. To add to this, we also have two COMPILER_FLAGS used for different things (neither of them are flags)