lang/gpc: build fixes for llvm22

This hack in the GCC 4.2.4 code base

#define U (const unsigned char *)  /* Intended use: U"string" */

clashes with the more recent syntax for string literals of type
char32_t[].  Pick an unobtrusive fix from GCC 4.4 and replace U
with UC.
This commit is contained in:
naddy
2026-06-11 20:34:24 +00:00
parent 081c7afe05
commit 512b1fa46d
6 changed files with 128 additions and 1 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ NOT_FOR_ARCHS = aarch64 m88k mips64 powerpc64 riscv64
COMMENT = GNU Pascal compiler
DISTNAME = gpc-20070904
REVISION = 19
REVISION = 20
CATEGORIES = lang
HOMEPAGE = https://www.gnu-pascal.de/gpc/h-index.html
+15
View File
@@ -0,0 +1,15 @@
Index: gcc/p/typecheck.c
--- gcc/p/typecheck.c.orig
+++ gcc/p/typecheck.c
@@ -3931,7 +3931,11 @@ really_start_incremental_init (tree type)
constructor_constant = 1;
constructor_simple = 1;
constructor_depth = SPELLING_DEPTH ();
+#ifndef GCC_4_1
constructor_elements = NULL_TREE;
+#else
+ constructor_elements = NULL;
+#endif
constructor_pending_elts = NULL_TREE;
constructor_type = type;
@@ -0,0 +1,51 @@
cpp-id-data.h (UC): Was U, conflicts with U...
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b6baa67d7947f
Index: libcpp/directives.c
--- libcpp/directives.c.orig
+++ libcpp/directives.c
@@ -187,7 +187,7 @@ DIRECTIVE_TABLE
did use this notation in its preprocessed output. */
static const directive linemarker_dir =
{
- do_linemarker, U"#", 1, KANDR, IN_I
+ do_linemarker, UC"#", 1, KANDR, IN_I
};
#define SEEN_EOL() (pfile->cur_token[-1].type == CPP_EOF)
@@ -681,7 +681,7 @@ parse_include (cpp_reader *pfile, int *pangle_brackets
const unsigned char *dir;
if (pfile->directive == &dtable[T_PRAGMA])
- dir = U"pragma dependency";
+ dir = UC"pragma dependency";
else
dir = pfile->directive->name;
cpp_error (pfile, CPP_DL_ERROR, "#%s expects \"FILENAME\" or <FILENAME>",
@@ -1060,7 +1060,7 @@ register_pragma_1 (cpp_reader *pfile, const char *spac
if (space)
{
- node = cpp_lookup (pfile, U space, strlen (space));
+ node = cpp_lookup (pfile, UC space, strlen (space));
entry = lookup_pragma_entry (*chain, node);
if (!entry)
{
@@ -1089,7 +1089,7 @@ register_pragma_1 (cpp_reader *pfile, const char *spac
}
/* Check for duplicates. */
- node = cpp_lookup (pfile, U name, strlen (name));
+ node = cpp_lookup (pfile, UC name, strlen (name));
entry = lookup_pragma_entry (*chain, node);
if (entry == NULL)
{
@@ -1237,7 +1237,7 @@ restore_registered_pragmas (cpp_reader *pfile, struct
{
if (pe->is_nspace)
sd = restore_registered_pragmas (pfile, pe->u.space, sd);
- pe->pragma = cpp_lookup (pfile, U *sd, strlen (*sd));
+ pe->pragma = cpp_lookup (pfile, UC *sd, strlen (*sd));
free (*sd);
sd++;
}
@@ -0,0 +1,15 @@
cpp-id-data.h (UC): Was U, conflicts with U...
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b6baa67d7947f
Index: libcpp/include/cpp-id-data.h
--- libcpp/include/cpp-id-data.h.orig
+++ libcpp/include/cpp-id-data.h
@@ -22,7 +22,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, M
typedef unsigned char uchar;
#endif
-#define U (const unsigned char *) /* Intended use: U"string" */
+#define UC (const unsigned char *) /* Intended use: UC"string" */
/* Chained list of answers to an assertion. */
struct answer GTY(())
+20
View File
@@ -0,0 +1,20 @@
cpp-id-data.h (UC): Was U, conflicts with U...
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b6baa67d7947f
Index: libcpp/lex.c
--- libcpp/lex.c.orig
+++ libcpp/lex.c
@@ -39,10 +39,10 @@ struct token_spelling
};
static const unsigned char *const digraph_spellings[] =
-{ U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" };
+{ UC"%:", UC"%:%:", UC"<:", UC":>", UC"<%", UC"%>" };
-#define OP(e, s) { SPELL_OPERATOR, U s },
-#define TK(e, s) { SPELL_ ## s, U #e },
+#define OP(e, s) { SPELL_OPERATOR, UC s },
+#define TK(e, s) { SPELL_ ## s, UC #e },
static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE };
#undef OP
#undef TK
+26
View File
@@ -0,0 +1,26 @@
cpp-id-data.h (UC): Was U, conflicts with U...
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b6baa67d7947f
Index: libcpp/macro.c
--- libcpp/macro.c.orig
+++ libcpp/macro.c
@@ -154,7 +154,7 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashno
{
cpp_errno (pfile, CPP_DL_WARNING,
"could not determine file timestamp");
- pbuffer->timestamp = U"\"??? ??? ?? ??:??:?? ????\"";
+ pbuffer->timestamp = UC"\"??? ??? ?? ??:??:?? ????\"";
}
}
}
@@ -252,8 +252,8 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashno
cpp_errno (pfile, CPP_DL_WARNING,
"could not determine date and time");
- pfile->date = U"\"??? ?? ????\"";
- pfile->time = U"\"??:??:??\"";
+ pfile->date = UC"\"??? ?? ????\"";
+ pfile->time = UC"\"??:??:??\"";
}
}