Closed CHN-beta closed 2 years ago
Seems like gfortran
in GCC 10 package leads to this behavior so it could be considered as a regression. I can't find any changelogs which document this, however, I've found similar issue but the solution found there couldn't be implemented here
@CHN-beta Is compilation of the following code successful?
#if !__has_include(<iostream>)
#error
#endif
#if __has_include("non-existing.h")
#error
#endif
int main() {}
If not, this is due to GCC rather than libint.
BTW, messages will be printed in English by setting LANG=C
.
@CHN-beta Is compilation of the following code successful?
#if !__has_include(<iostream>) #error #endif #if __has_include("non-existing.h") #error #endif int main() {}
If not, this is due to GCC rather than libint.
BTW, messages will be printed in English by setting
LANG=C
.
g++
compiles pass.
g++ main.cpp -o main
But gfortran
does not.
LANG=C gfortran main.F
It complains:
main.F:1:0:
1 | #if !__has_include(<iostream>)
|
Error: missing '(' before "__has_include" operand
main.F:1:0: Error: operator "__has_include" requires a header-name
main.F:1:0: Error: missing binary operator before token "("
main.F:5:0:
5 | #if __has_include("non-existing.h")
|
Error: missing '(' before "__has_include" operand
main.F:5:0: Error: operator "__has_include" requires a header-name
<built-in>:0: confused by earlier errors, bailing out
While libint is using __has_include
in a non-portable way: every call to __has_include
should be enclosed (not in the same line) in a #if defined(__has_include)
, according to https://gcc.gnu.org/onlinedocs/gcc-10.1.0/cpp/_005f_005fhas_005finclude.html
it seems there is something else going on in the traditional-mode preprocessor of gcc 10.1, I've opened a bug for it, let's see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Ok, I came up with a bugfix for gcc-10: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550832.html
Nevertheless, to be portable, calls to __has_include
should be guarded with a
#if defined(__has_include)
But as of now, the real bug is in gcc-10, not in libint.
(I'm sorry, I made a mistake and sent it before I complete edit.)
make install
failed on my machine. The error message is here:("进入目录" in Chinese means "entering directory", and "错误" means error.)
I use Archlinux, with gcc 10.1.0.