Add the following option for the flang-driver
-Werror
With the option given, warnings are treated as error.
A test case is added.
Paths
| Differential D98657
[flang][driver] Add options for -Werror ClosedPublic Authored by arnamoy10 on Mar 15 2021, 1:11 PM.
Details Summary 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 TestsFailed 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
This revision is now accepted and ready to land.Apr 5 2021, 7:32 AM This revision was landed with ongoing or failed builds.Apr 5 2021, 9:49 AM Closed by commit rG7416e8a8431a: [flang][driver] Add options for -Werror (authored by arnamoy10). · Explain Why This revision was automatically updated to reflect the committed changes. 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
Revision Contents
Diff 333843 clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Flang.cpp
flang/include/flang/Frontend/CompilerInvocation.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/test/Driver/driver-help-hidden.f90
flang/test/Driver/driver-help.f90
flang/test/Driver/werror.f90
flang/test/Driver/werror_scan.f
|
clang-tidy: error: 'flang/Frontend/FrontendOptions.h' file not found [clang-diagnostic-error]
not useful