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

[flang] Put ISO_Fortran_binding.h where it can be easily used #69121

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

psteinfeld
Copy link
Contributor

The update stems from the discussion in
https://discourse.llvm.org/t/adding-flang-specific-header-files-to-clang/72442

This is my second attempt at this. My first attempt was in pull request #68756.

I decided to put ISO_Fortran_binding.h in a place where it would be accessible with the include: "#include<ISO_Fortran_binding.h>" rather than "#include<fortran/ISO_Fortran_binding.h>" because this is what gfortran implements.

Note that the file is also installed into ".../include/flang", so if a user wanted to access the file from a compiler other than clang, it would be available.

I added a test in ".../flang/test/Examples". To make the test work, I also needed to put ISO_Fortran_binding.h into the build area.

Although the flang project depends on clang, clang may not always be available in a flang build. For example, when building just the "check-flang" target, the "clang" executable may not be available at the time the new test gets run. To account for this, I made the test's script check for the existence of the "clang" executable. If "clang" is not available, it simply prints "PASS". If it is available, it fully builds and executes the test. On success, this will also print "PASS"

The update stems from the discussion in
https://discourse.llvm.org/t/adding-flang-specific-header-files-to-clang/72442

This is my second attempt at this.  My first attempt was in pull request

I decided to put ISO_Fortran_binding.h in a place where it would be
accessible with the include: "#include<ISO_Fortran_binding.h>" rather
than "#include<fortran/ISO_Fortran_binding.h>" because this is what
gfortran implements.

Note that the file is also installed into ".../include/flang", so if a
user wanted to access the file from a compiler other than clang, it
would be available.

I added a test in ".../flang/test/Examples".  To make the test work, I also
needed to put ISO_Fortran_binding.h into the build area.

Although the flang project depends on clang, clang may not always be available
in a flang build.  For example, when building just the "check-flang" target,
the "clang" executable may not be available at the time the new test gets run.
To account for this, I made the test's script check for the existence of the
"clang" executable.  If "clang" is not available, it simply prints "PASS".  If
it is available, it fully builds and executes the test.  On success, this will
also print "PASS"
@psteinfeld psteinfeld self-assigned this Oct 15, 2023
@llvmbot llvmbot added the flang Flang issues not falling into any other category label Oct 15, 2023
Copy link
Contributor

@vzakhari vzakhari left a comment

Choose a reason for hiding this comment

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

Thank you, Pete! LGTM

Copy link
Contributor

@kiranchandramohan kiranchandramohan left a comment

Choose a reason for hiding this comment

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

Nice. :)

@psteinfeld psteinfeld merged commit e6e9084 into llvm:main Oct 19, 2023
jeanPerier added a commit to jeanPerier/llvm-project that referenced this pull request Oct 20, 2023
ISO_Fortran_binding.h was only added to in gcc 10.0. Flang should be
buildable with older versions. Remove the test until a safe way to
check that the compiler can run the test (that it is clang from the
build for instance).

Fix bots failure https://lab.llvm.org/buildbot/#/builders/181/builds/24526
Also in:

https://lab.llvm.org/buildbot/#/builders/160
https://lab.llvm.org/buildbot/#/builders/268
https://lab.llvm.org/buildbot/#/builders/181
jeanPerier added a commit that referenced this pull request Oct 20, 2023
ISO_Fortran_binding.h was only added to in gcc 10.0. Flang should be
buildable with older versions. Remove the test until a safe way to
check that the compiler can run the test (that it is clang from the
build for instance).

Fix bots failure https://lab.llvm.org/buildbot/#/builders/181/builds/24526
Also in:

https://lab.llvm.org/buildbot/#/builders/160
https://lab.llvm.org/buildbot/#/builders/268
https://lab.llvm.org/buildbot/#/builders/181
psteinfeld added a commit that referenced this pull request Oct 20, 2023
@psteinfeld psteinfeld deleted the ps-new-iso-fortran-binding branch October 24, 2023 16:12
psteinfeld added a commit that referenced this pull request Oct 30, 2023
The update stems from the discussion in

https://discourse.llvm.org/t/adding-flang-specific-header-files-to-clang/72442

This is my third attempt at this. My second attempt was in pull request
#69121.

This is my second attempt at this. My first attempt was in pull request
#68756.

This pull request has three changes from the second one:
- I put the test into the Driver directory rather than Examples so that
it would get run without require the define LLVM_BUILD_EXAMPLES.
- When installing ISO_Fortran_binding.h, I changed the location where it
was installed from.
- I changed the test so that it would work when flang was built with
shared libraries.

Here's the information from my previous attempts:

I decided to put ISO_Fortran_binding.h in a place where it would be
accessible with the include: "#include<ISO_Fortran_binding.h>" rather
than "#include<fortran/ISO_Fortran_binding.h>" because this is what
gfortran implements.

Note that the file is also installed into ".../include/flang", so if a
user wanted to access the file from a compiler other than clang, it
would be available.

I added a test in ".../flang/test/Driver". To make the test work, I also
needed to put ISO_Fortran_binding.h into the build area.

Although the flang project depends on clang, clang may not always be
available in a flang build. For example, when building just the
"check-flang" target, the "clang" executable may not be available at the
time the new test gets run. To account for this, I made the test's
script check for the existence of the "clang" executable. If "clang" is
not available, it simply prints "PASS". If it is available, it fully
builds and executes the test. On success, this will also print "PASS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants