[flang] Generalize the pedantic flag to accept Fortran standards
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Based on the discussion in https://discourse.llvm.org/t/rfc-support-for-std-f2023/89608, adding Fortran standards, other than f2018, to the `-std` flag of flang has several downsides:
- The `-std` flag violates the flang design philosophy of allowing the union of all Fortran standards (or as much of that union as possible) to be enabled by default.
- End users fexpect that the `-std` flag would behave for flang as it does for clang and other compilers, and limit the compiler to the given standard of Fortran.
- Meeting this end user expectation would require a significant amount of work to change flang, as well as a major change to the flang design philosophy from above.
- If such work were done, additional testing would be needed to test each Fortran standard for regressions.
As an alternative I propose to generalize the `-pedantic` flag to take a Fortran standard as an optional argument. This avoids the downsides listed above:
- Passing the `-pedantic` flag disables nothing, so the union of all Fortran stadards would still be enabled, but additional warnings may be issued during compilation.
- The expectation of `-pedantic` is to issue more warnings, but otherwise not change compiler behavior.
- Adding warning for the different Fortran standards features requires minimal additional work and testing.
Contributor guide
Assessment
This issue has not been assessed yet.