[all-commits] [llvm/llvm-project] 796d26: [flang] Fix ISO_Fortran_binding.h to work better w...
Pete Steinfeld via All-commits
all-commits at lists.llvm.org
Mon Feb 26 14:30:00 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 796d26a37d70374e41766df659700a826dc62e34
https://github.com/llvm/llvm-project/commit/796d26a37d70374e41766df659700a826dc62e34
Author: Pete Steinfeld <47540744+psteinfeld at users.noreply.github.com>
Date: 2024-02-26 (Mon, 26 Feb 2024)
Changed paths:
M flang/include/flang/ISO_Fortran_binding.h
A flang/test/Integration/iso-fortran-binding.cpp
Log Message:
-----------
[flang] Fix ISO_Fortran_binding.h to work better with C++ code (#82556)
[flang] Fix ISO_Fortran_binding.h to work better with C++ code
This stems from working on LANL's "dopey" project --
https://github.com/lanl/dopey.
That project contains C++ code which includes the header file
"ISO_Fortran_binding.h". The dopey code wraps that include with an
'extern "C"' clause since the standard (18.5.1, paragraph 1) says that
the file" shall contain C structure definitions, typedef declarations,
...". But the clang++ compiler emits error messages objecting to the
fact that ISO_Fortran_binding.h contains templates.
This change fixes that by preceding the problematic code in
ISO_Fortran_binding.h with language linkage clauses that specify that
they contain C++ code rather than C code.
In the accompanying test, I needed to account for the fact that some
people build the compiler by doing a `make check-flang`. In this case,
the clang compiler which is required by the test will not be built.
Here's an example of a C++ program that shows the problem:
```
extern "C" {
#include "ISO_Fortran_binding.h"
}
int main() {
return 0;
}
```
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list