Code Monkey home page Code Monkey logo

Comments (5)

aradi avatar aradi commented on June 1, 2024

I had a look at it with a toy bash script as pre-processor. The ifort option seems to work somewhat differently from what is documented. It writes all the command line arguments it wants to pass to the pre-processor (including the source file name) into a file, and passes that file, prefixed with @ to the pre-processor. The pre-processor is supposed to recognize the @ prefix and treat the content of the file as command line arguments. While GNU cpp seems to be capable to do so (although, I did not find this feature anywhere documented), fypp is currently not.

One could, in theory, implement the same feature in Fypp (one would have to parse sys.argv before optparse sees it) and pass the extracted list of arguments to optparse. But first, it would be good to know, that this is the intended long term behavior of the ifort compiler...

from fypp.

ivan-pi avatar ivan-pi commented on June 1, 2024

So it actually uses response files? They were added also to GCC to support Windows platforms where command-line length limits exist. I small test on MacOS shows response files work here too:

ivan:~/fortran/legacy$ cat debug
-Wall -Werror -g
ivan:~/fortran/legacy$ gfortran @debug -v loop_cycle.f 
Driving: gfortran -Wall -Werror -g -v loop_cycle.f -mmacosx-version-min=12.5.0 -asm_macosx_version_min=12.5 -nodefaultexport -l gfortran -shared-libgcc
...

My initial goal was to write an ifort command wrapper or perhaps simply a configuration file to get a "natural" experience of using the fypp preprocessor without a separate generation step. While non-portable to some extent, it simplifies the writing of build-system files. (Since our cluster has Intel CPUs dominantly, the Intel Fortran compiler is the de-facto standard one, hence I'm willing to sacrifice portability for a nicer developer experience.)

from fypp.

ivan-pi avatar ivan-pi commented on June 1, 2024

I thought I'd mention that fpm on Windows also uses response files in the archiver and linker commands: fortran-lang/fpm#427. Given that fpm is in the process of adding a fypp wrapper (fortran-lang/fpm#729) it might become an issue for fpm sooner or later.

from fypp.

ivan-pi avatar ivan-pi commented on June 1, 2024

I've opened an issue about the undocumented behavior at the Intel Fortran Forum: https://community.intel.com/t5/Intel-Fortran-Compiler/Undocumented-behavior-of-fpp-with-alternative-preprocessor/m-p/1411981#M162675

from fypp.

ivan-pi avatar ivan-pi commented on June 1, 2024

One of the moderators replied that the documentation will be amended. The exact layout of the response file remains somewhat under-specified for my taste. More information can be found here:

The GCC mail archives state the contents of the file are whitespace-separated strings. Presumably, this would mean the separator between option strings are all the tokens recognized by the C library function isspace.

from fypp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.