Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for toggling Fortran features #864

Merged
merged 3 commits into from
Apr 7, 2023

Conversation

awvwgk
Copy link
Member

@awvwgk awvwgk commented Apr 2, 2023

This has been hanging around stale long enough, here is a draft implementation for disabling implicit typing and external interfaces by default with opt-in toggles on per package basis. Also allows to switch globally between fixed and free format for source files.

  • implicit-typing: toggle default implicit typing rules
    • option to disable in GFortran
    • option to enable in LFortran
  • implicit-external: toggle implicit external interfaces
    • option to disable in GFortran
    • option to enable in LFortran
  • source-form: select source form ("free", "fixed", or "default")
    • option to set free/fixed form in GFortran
    • option to set fixed form in LFortran

Usage

[fortran]
implicit-typing = true  # default: false
implicit-external = true  # default: false
source-form = "fixed"  # default: "free"

Documentation at fortran-lang/fpm-docs#98
Closes #577
Closes #363

@awvwgk awvwgk added the specification Issue regarding fpm manifest and model label Apr 2, 2023
@awvwgk awvwgk force-pushed the fortran-features branch 2 times, most recently from 29af5a0 to c775b45 Compare April 2, 2023 09:29
@awvwgk awvwgk marked this pull request as ready for review April 2, 2023 09:29
@awvwgk awvwgk requested review from certik and rouson April 2, 2023 09:29
@awvwgk awvwgk force-pushed the fortran-features branch from c775b45 to 9b91431 Compare April 2, 2023 09:32
gnikit
gnikit previously requested changes Apr 2, 2023
Copy link
Member

@gnikit gnikit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice you beat me to it (by many, many hours). I left some comments/patch suggestions for adding support for the other compilers (at least for the fixed/free flag). Have a look and let me know if they are correct, if not you can dismiss them.

src/fpm_compiler.F90 Outdated Show resolved Hide resolved
src/fpm_compiler.F90 Outdated Show resolved Hide resolved
src/fpm_compiler.F90 Outdated Show resolved Hide resolved
@awvwgk
Copy link
Member Author

awvwgk commented Apr 2, 2023

Giannis @gnikit, feel free to commit the changes directly to my branch.

@gnikit
Copy link
Member

gnikit commented Apr 3, 2023

Giannis @gnikit, feel free to commit the changes directly to my branch.

Will do this today

@everythingfunctional
Copy link
Member

Haven't had a chance to look at the actual code changes, but I think your description is a reasonable approach. My only comment is about the "default" for source-form. I'm not sure that's exactly the right spelling for that option. Perhaps "mixed" or "detected" or "assumed" would be better?

@milancurcic
Copy link
Member

I think this is a great change.

The TOML key should be source-form, not source-format. Likewise, use "fixed-form" and "free-form" instead of "fixed-format" and "free-format" in example names.

"default" for the source-form makes sense to me--it reads like "use the compiler default, whatever that is".

@awvwgk awvwgk dismissed gnikit’s stale review April 7, 2023 07:45

Added suggested compiler options

@awvwgk
Copy link
Member Author

awvwgk commented Apr 7, 2023

Thanks everyone for reviewing and providing feedback. While not all compilers currently support these features, we can add those in the future as we discover the correct options. I'll go ahead and merge now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
specification Issue regarding fpm manifest and model
Projects
None yet
4 participants