在 2022-09-07 19:04, i.nixman--- via Gcc-help 写道:
great, but without that patch I still get the error: In file included from ../../../../src/gcc-4.8.1/gcc/cp/except.c:1005:cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 'gnu_inline' attributecfns.gperf:26:14: note: 'const char* libc_name_p(const char*, unsigned int)' previously declared herecfns.gperf:26:14: warning: inline function 'const char* libc_name_p(const char*, unsigned int)' used but never defined
For the sake of simplicity, I suspect it is possible to make `libc_name_p()` a `static __inline` function, as I see it be referenced only ever once in 'except.c'.
When attempting to compile 'except.c' as C++ with GCC 4.8 and with the patch which you have mentioned, this function is a `gnu_inline` function with an implicit `extern` [1], so rule 1.3 [2] applies: Because optimization is not enabled, a call to an external function is emitted; and because no out-of-line definition is available, undefined reference is the result.
Use of the `gnu_inline` attribute on an `extern` function requires there be a definition that is compiled without `gnu_inline` or `inline`. Probably it can be removed when `__cplusplus` is defined.
[1] This differs from C, where `inline` has a distinct meaning from `extern inline`. [2] https://github.com/lhmouse/mcfgthread/wiki/Differences-between-GNU,-C99-and-C---%60inline%60 -- Best regards, LIU Hao
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature