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

Import only used variables and procedures #146

Closed
stefabat opened this issue May 8, 2024 · 4 comments
Closed

Import only used variables and procedures #146

stefabat opened this issue May 8, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@stefabat
Copy link
Contributor

stefabat commented May 8, 2024

Currently, the Fortran API triggers a bunch of warnings when compiled with gfortran and the -Wuse-without-only flag, e.g.:

...
Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
/home/stefano/Code/cp2k/tools/toolchain/install/trexio-2.4.2/include/trexio_f.f90:10889:20:

10889 |   use, intrinsic :: iso_c_binding
      |                    1
Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
/home/stefano/Code/cp2k/tools/toolchain/install/trexio-2.4.2/include/trexio_f.f90:10899:20:

10899 |   use, intrinsic :: iso_c_binding
      |                    1
Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
/home/stefano/Code/cp2k/tools/toolchain/install/trexio-2.4.2/include/trexio_f.f90:10912:20:
...

It would be nice if the API file could be generated with the only keyword, specifying only the variables and procedures actually used from iso_c_binding.

@scemama
Copy link
Member

scemama commented May 8, 2024

Thanks! We will clean this for the next release.

@scemama scemama self-assigned this May 8, 2024
@scemama scemama added the enhancement New feature or request label May 8, 2024
@q-posev
Copy link
Member

q-posev commented May 10, 2024

Noted! Do you think the use iso-c-binding call can be omitted in the basic Fortran function interfaces that have bind(C) in their declarations but which do not use any C native types or symbols like c_int32 or c_null_char?

@scemama
Copy link
Member

scemama commented May 13, 2024

Noted! Do you think the use iso-c-binding call can be omitted in the basic Fortran function interfaces that have bind(C) in their declarations but which do not use any C native types or symbols like c_int32 or c_null_char?

I don't think so because of the return type of the function which has to be a C type. Maybe subroutines without arguments will work, I need to try...

@scemama
Copy link
Member

scemama commented May 13, 2024

I created #147 for this request.

@scemama scemama closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants