Debian Codegraph @

project/bundles/macports/patches/lang/gcc14/files/patch-libgcc14-alignof.patch

raw
1 diff --git gcc/c-family/c-common.cc gcc/c-family/c-common.cc
2 index 79dac5fccf30d2f640cdcac2406c851d45b35aa4..a038651aa28bf9ca7a45f1e980bc52a07b009de3 100644
3 --- gcc/c-family/c-common.cc
4 +++ gcc/c-family/c-common.cc
5 @@ -388,8 +388,8 @@ static bool nonnull_check_p (tree, unsigned HOST_WIDE_INT);
6 */
7 const struct c_common_resword c_common_reswords[] =
8 {
9 - { "_Alignas", RID_ALIGNAS, D_CONLY },
10 - { "_Alignof", RID_ALIGNOF, D_CONLY },
11 + { "_Alignas", RID_ALIGNAS, D_EXT_C_IN_CXX },
12 + { "_Alignof", RID_ALIGNOF, D_EXT_C_IN_CXX },
13 { "_Atomic", RID_ATOMIC, D_CONLY },
14 { "_BitInt", RID_BITINT, D_CONLY },
15 { "_Bool", RID_BOOL, D_CONLY },
16 diff --git gcc/c-family/c-common.h gcc/c-family/c-common.h
17 index 78414d4519e90168cd01bd910ec1bb05cce1ad4d..5831c8b5af9a0f9c9a0c03b7d975c4c26f7099f7 100644
18 --- gcc/c-family/c-common.h
19 +++ gcc/c-family/c-common.h
20 @@ -445,6 +445,8 @@ extern machine_mode c_default_pointer_mode;
21 #define D_CXX20 0x8000 /* In C++, C++20 only. */
22 #define D_CXX_COROUTINES 0x10000 /* In C++, only with coroutines. */
23 #define D_CXX_MODULES 0x20000 /* In C++, only with modules. */
24 +#define D_EXT_C_IN_CXX 0x40000 /* In C++, allow additional C keywords. */
25 +#define D_EXT_CXX_IN_C 0x80000 /* In C, allow additional C++ keywords. */
26
27 #define D_CXX_CONCEPTS_FLAGS D_CXXONLY | D_CXX_CONCEPTS
28 #define D_CXX_CHAR8_T_FLAGS D_CXXONLY | D_CXX_CHAR8_T
29 diff --git gcc/c-family/c.opt gcc/c-family/c.opt
30 index 418e87fa486bb26db1414ac198fae10584d3048b..7375dcf95efbb042e816bc703c5af02e754a01de 100644
31 --- gcc/c-family/c.opt
32 +++ gcc/c-family/c.opt
33 @@ -1712,6 +1712,10 @@ fallow-extended-attribute-placement
34 C ObjC C++ ObjC++ LTO Var(flag_allow_ext_attr_placement) Init(0)
35 Allow placement of attributes on function definitions.
36
37 +fallow-extra-keywords
38 +C ObjC C++ ObjC++ LTO Var(flag_allow_extra_keywords) Init(0)
39 +Allow additional C keywords in C++ and vice versa.
40 +
41 fcilkplus
42 C ObjC C++ ObjC++ LTO Undocumented Ignore
43 Removed in GCC 8. This switch has no effect.
44 diff --git gcc/config/darwin.cc gcc/config/darwin.cc
45 index e6657753211f6dc03f493504f6aa61ee1a10135c..233710ae566fea8796e8691cdb568ce1b722ef59 100644
46 --- gcc/config/darwin.cc
47 +++ gcc/config/darwin.cc
48 @@ -3959,6 +3959,9 @@ darwin_override_options (void)
49
50 /* The c_dialect...() macros are not available to us here. */
51 darwin_running_cxx = (strstr (lang_hooks.name, "C++") != 0);
52 + /* We need to consume some C keywords in C++. */
53 + if (!OPTION_SET_P (flag_allow_extra_keywords))
54 + flag_allow_extra_keywords = true;
55 }
56
57 #if DARWIN_PPC
58 diff --git gcc/cp/lex.cc gcc/cp/lex.cc
59 index 1110db7f8d074e923e2ac8e51976b537c28b15ac..0c4f93a6787b85abd8fcc13f00f57e9feea0a52a 100644
60 --- gcc/cp/lex.cc
61 +++ gcc/cp/lex.cc
62 @@ -267,6 +267,9 @@ init_reswords (void)
63 {
64 if (c_common_reswords[i].disable & D_CONLY)
65 continue;
66 + if (!flag_allow_extra_keywords
67 + && c_common_reswords[i].disable & D_EXT_C_IN_CXX)
68 + continue;
69 id = get_identifier (c_common_reswords[i].word);
70 C_SET_RID_CODE (id, c_common_reswords[i].rid);
71 ridpointers [(int) c_common_reswords[i].rid] = id;