mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
GCC, meet C++20
I've tried to test a patch to switch -std=gnu++17 C++ default to -std=gnu++20 (will post momentarily), but ran into various problems during GCC bootstraps, our codebase isn't fully C++20 ready. The most common problems are arithmetic or bitwise operations between enumerators of different enum types (or between enumerator and floating point in the testsuite), ambiguous overloaded operator == because of forgotten const qualification of const inside of the argument and then libcody being largely stuck in C++ and incompatible with C++20 which introduced char8_t type and uses it for u8 literals. The following patch fixes various issues I've run into, for libcody this patch just makes sure code including cody.hh can be compiled with -std=gnu++20, libcody itself I have a tweak in the other patch. Nothing in this patch will make the code invalid for C++14. 2025-11-17 Jakub Jelinek <jakub@redhat.com> gcc/ * tree-core.h (enum built_in_function): Avoid arithmetics or bitwise operations between enumerators from different enums. * lto-streamer.h (lto_tag_is_gimple_code_p): Likewise. * gimple.h (gimple_omp_atomic_set_memory_order): Likewise. * common/config/i386/i386-cpuinfo.h (M_CPU_SUBTYPE_START, M_CPU_TYPE): Likewise. * tree-complex.cc (expand_complex_libcall): Likewise. * ipa-modref-tree.h (modref_access_node::operator ==): Change argument type from modref_access_node & to const modref_access_node &. * ipa-modref-tree.cc (modref_access_node::operator ==): Likewise. gcc/cobol/ * symbols.cc (symbol_table_init): Avoid arithmetics or bitwise operations between enumerators from different enums. gcc/fortran/ * parse.cc (gfc_parse_file): Avoid arithmetics or bitwise operations between enumerators from different enums. libcody/ * cody.hh (MessageBuffer::Space): For C++14 or newer use (char) u8' ' instead of Detail::S2C(u8" ").
This commit is contained in:
committed by
Jakub Jelinek
parent
edc821b60c
commit
b4a37c4b8c
@@ -110,7 +110,11 @@ public:
|
||||
/// Add whitespace word separator. Multiple adjacent whitespace is fine.
|
||||
void Space ()
|
||||
{
|
||||
#if __cpp_unicode_characters >= 201411
|
||||
Append ((char) u8' ');
|
||||
#else
|
||||
Append (Detail::S2C(u8" "));
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user