Add the following option for the flang-driver
-Werror
With the option given, warnings are treated as error.
A test case is added.
Differential D98657
[flang][driver] Add options for -Werror arnamoy10 on Mar 15 2021, 1:11 PM. Authored by
Details Add the following option for the flang-driver -Werror With the option given, warnings are treated as error. A test case is added.
Diff Detail
Unit Tests Event TimelineComment Actions Updating to use available option from Options.td instead of creating a new option for -Werror Comment Actions Thank you for adding this @arnamoy10 ! I think that in order to match the semantics of -Werror from f18, this patch needs to be extended a bit. In the following two cases, f18 will exit immediately, whereas flang-new -fc1 will happily carry-on:
Could you try implementing similar semantics here? I've left a few more comments inline.
Comment Actions Thanks @awarzynski for the comments.
Comment Actions I see that -Werror changes the behavior of the driver in 5 different places. I would hope to see 5 new tests to verify each case.
Comment Actions Modifying the test cases to:
Comment Actions I really like how you split your tests into two files:
In every case you added multiple RUN lines to make sure that the behavior is consistent across multiple actions. I think that that's very useful. Ideally, we'd have one central switch for turning warnings into errors and this would be unnecessary. But we're not there yet. In the meantime, could you add a comment explaining why multiple RUN lines are used? I have 2 more suggestions:
These are non-blockers for me.
Comment Actions
Comment Actions How about -Wl option, it will cause link error like " Only -Werror is supported currently" Comment Actions Thanks for pointing it out. The issue was due to restricting -W` options in f18 as well, this has been fixed with 4299ab6c5daf |
clang-tidy: error: 'flang/Frontend/FrontendOptions.h' file not found [clang-diagnostic-error]
not useful