ekieri added reviewers: klausler, PeteSteinfeld. ekieri added a comment. Herald added a reviewer: awarzynski.
Hi! Thanks for this patch, and for your interest in contributing to Flang! I will leave it to somebody more experienced to accept the patch -- I am not familiar with this extension, and am not aware on what grounds we decide which extensions to support. I hope that my suggestions and questions can be useful anyway. We keep a list of supported extensions in flang/docs/Extensions.md Please add this extension there. And please also explain its behaviour a bit. I wonder about the behaviour. Is INTENT for non-dummies allowed-but-ignored, or does it change the semantics? For example, is an INTENT(IN) variable supposed to be read-only? And what about combining SAVE, INTENT(OUT)? Or PARAMETER, INTENT(INOUT)? I would also appreciate tests for this behaviour, e.g., a check that modifying an INTENT(IN) non-dummy is allowed or disallowed, as desired. ================ Comment at: clang/include/clang/Driver/Options.td:4734-4735 +def fnon_arg_intent : Flag<["-"],"fnon-arg-intent">, Group<f_Group>, + HelpText<"Allow use of INTENT attribute not for dummy arguments">; + ---------------- Feel free to use my suggestion literally or to work out something better, whichever you prefer. ================ Comment at: flang/lib/Frontend/CompilerInvocation.cpp:536 + // -fnv-non-arg-intent + if (args.hasArg(clang::driver::options::OPT_fnon_arg_intent)) { ---------------- ================ Comment at: flang/lib/Semantics/check-declarations.cpp:536 symbol.attrs().test(Attr::INTENT_INOUT)) { - messages_.Say("INTENT attributes may apply only to a dummy " - "argument"_err_en_US); // C843 + if (!context_.languageFeatures().IsEnabled( + Fortran::common::LanguageFeature::NonDummyArgumentIntent)) ---------------- Please check for the feature-enablement together with the INTENT attributes above. Like this, the check for OPTIONAL below might get lost. ================ Comment at: flang/lib/Semantics/check-declarations.cpp:771 symbol.attrs().test(Attr::INTENT_INOUT)) { - messages_.Say("INTENT attributes may apply only to a dummy " - "argument"_err_en_US); // C843 + if (!context_.languageFeatures().IsEnabled( + Fortran::common::LanguageFeature::NonDummyArgumentIntent)) ---------------- Same as above. ================ Comment at: flang/test/Driver/driver-help-hidden.f90:45 ! CHECK-NEXT: -fno-color-diagnostics Disable colors in diagnostics +! CHECK-NEXT: -fnon-arg-intent Allow use of INTENT attribute not for dummy arguments ! CHECK-NEXT: -fopenacc Enable OpenACC ---------------- Update description as per above. ================ Comment at: flang/test/Driver/driver-help.f90:45 ! HELP-NEXT: -fno-color-diagnostics Disable colors in diagnostics +! HELP-NEXT: -fnon-arg-intent Allow use of INTENT attribute not for dummy arguments ! HELP-NEXT: -fopenacc Enable OpenACC ---------------- Update description as per above. ================ Comment at: flang/test/Driver/driver-help.f90:119 ! HELP-FC1-NEXT: -fno-reformat Dump the cooked character stream in -E mode +! HELP-FC1-NEXT: -fnon-arg-intent Allow use of INTENT attribute not for dummy arguments ! HELP-FC1-NEXT: -fopenacc Enable OpenACC ---------------- Update description as per above. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123113/new/ https://reviews.llvm.org/D123113 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits