When more recent gcc ports are built without bootstrap, compiling libcc1
plugins results in errors similar to:
In file included from /wrkdirs/share/dim/ports/lang/gcc13/work/gcc-13.2.0/libcc1/libcc1plugin.cc:72:
In file included from /usr/include/c++/v1/vector:321:
In file included from /usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /usr/include/c++/v1/__format/formatter_integral.h:32:
/usr/include/c++/v1/locale:289:36: error: attempt to use a poisoned identifier
289 | __status = (unsigned char*)malloc(__nkw);
| ^
/usr/include/c++/v1/locale:1584:28: error: attempt to use a poisoned identifier
1584 | __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
| ^
This is because gcc's own system.h header poisons these identifiers, and
the libcc1 plugins include <vector> after that. (Note that libstdc++ is
not affected because they seem to have implicitly included <vector>
already at that point.)
Fix it by telling system.h to include <vector> at the correct place, and
removing the explicit includes from libcc1plugin.cc and libcp1plugin.cc.
PR: 275748
MFH: 2023Q4
When building relatively recent gcc ports (with C++ in them) against
libc++ 17, you get errors similar to:
In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/cp/module.cc:208:
In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/system.h:239:
In file included from /usr/include/c++/v1/vector:321:
In file included from /usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /usr/include/c++/v1/locale:202:
/usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
546 | _LIBCPP_INLINE_VISIBILITY
| ^
/usr/include/c++/v1/__config:813:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
813 | # define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
| ^
/usr/include/c++/v1/__config:792:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
792 | __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
| ^
In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/cp/module.cc:208:
In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/system.h:239:
In file included from /usr/include/c++/v1/vector:321:
In file included from /usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /usr/include/c++/v1/locale:202:
/usr/include/c++/v1/__locale:547:37: error: expected ';' at end of declaration list
547 | char_type toupper(char_type __c) const
| ^
/usr/include/c++/v1/__locale:553:48: error: too many arguments provided to function-like macro invocation
553 | const char_type* toupper(char_type* __low, const char_type* __high) const
| ^
/wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/../include/safe-ctype.h:146:9: note: macro 'toupper' defined here
146 | #define toupper(c) do_not_use_toupper_with_safe_ctype
| ^
This is because gcc/system.h includes safe-ctype.h which redefines ctype
macros such as toupper, tolower, etc to "poison" them.
However, it should only include the safe-ctype.h header *after* any C++
headers, such as <list>, <map>, <string>, etc, otherwise these might
transitively include internal ctype headers (such as with libc++ 17),
causing the above conflicts.
Fix it by moving the safe-ctype.h inclusion to later in gcc/system.h,
which solves this issue, and makes it possible to build against libc++
17.
See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111632
PR: 274041
Approved by: salvadore (maintainer)
MFH: 2023Q4
Switch back to STANDARD_BOOTSTRAP on i386, amd64 and aarch64 as default
option instead of LTO_BOOTSTRAP: lto bootstrap produces too many
failures on the package builders for those architectures.
Users wanting to use LTO_BOOTSTRAP can still enable the option
manually.
The option stays enabled by default on powerpc, powerpc64 and
powerpc64le, for which I do not have failure reports from package
builders.
Add an error line that was missing in case _FreeBSD_version < 1000010.
Reported by: gnikl@users.sourceforge.net
Fixes: 8c2a479977 lang/gcc12-devel: Enable support for .init_array and .fini_array