1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
Description: Fix build with GCC 15
GCC 15 defaults to C23, in which the interpretation of function
declarations without parameters changed from undefined (as in K&R) to
`void`. The pccts code already has support for this via __USE_PROTOS,
which is enabled in both standard C and C++.
Origin: upstream, https://github.com/cdrdao/cdrdao/pull/35
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1096421
Forwarded: not-needed
Reviewed-by: Sven Geuer <sge@debian.org>
Last-Update: 2025-08-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
diff --git a/pccts/antlr/gen.c b/pccts/antlr/gen.c
index 7b417c4..ea2482e 100644
--- a/pccts/antlr/gen.c
+++ b/pccts/antlr/gen.c
@@ -47,7 +47,7 @@ static set tokensRefdInBlock;
/* T r a n s l a t i o n T a b l e s */
/* C_Trans[node type] == pointer to function that knows how to translate that node. */
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
void (*C_Trans[NumNodeTypes+1])(...) = {
NULL,
NULL, /* See next table.
@@ -70,7 +70,7 @@ Junctions have many types */
/* C_JTrans[Junction type] == pointer to function that knows how to translate that
* kind of junction node.
*/
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
void (*C_JTrans[NumJuncTypes+1])(...) = {
NULL,
(void (*)(...)) genSubBlk,
diff --git a/pccts/antlr/globals.c b/pccts/antlr/globals.c
index 89b3f04..3c73575 100644
--- a/pccts/antlr/globals.c
+++ b/pccts/antlr/globals.c
@@ -190,7 +190,7 @@ char *CurAmbigbtype;
* representing the FIRST sets for that node (maintains spatial info).
* We use 'struct _tree' not 'tree' due to a g++ 2.4.3 bug.
*/
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
struct _tree *(*fpTraverse[NumNodeTypes+1])(... /* Node *, int, set * */) = {
NULL,
(struct _tree *(*)(...)) tJunc,
@@ -212,7 +212,7 @@ Tree *(*fpTraverse[NumNodeTypes+1])() = {
* that node. (r stands for reach). We use 'struct _set' not 'set'
* due to a g++ 2.4.3 bug.
*/
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
struct _set (*fpReach[NumNodeTypes+1])(... /* Node *, int, set * */) = {
NULL,
(struct _set (*)(...)) rJunc,
@@ -231,7 +231,7 @@ set (*fpReach[NumNodeTypes+1])() = {
#endif
/* fpPrint[node type] == pointer to function that knows how to print that node. */
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
void (*fpPrint[NumNodeTypes+1])(... /* Node * */) = {
NULL,
(void (*)(...)) pJunc,
@@ -312,7 +312,7 @@ FILE *output=NULL; /* current parser output file */
FILE *input=NULL; /* current grammar input file */
char *FileStr[MaxNumFiles];/* Ptr to array of file names on command-line */
int NumFiles=0; /* current grammar file number */
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
void (**fpTrans)(...), /* array of ptrs to funcs that translate nodes */
(**fpJTrans)(...); /* ... that translate junctions */
#else
diff --git a/pccts/antlr/main.c b/pccts/antlr/main.c
index 3eb8b9d..76655cc 100644
--- a/pccts/antlr/main.c
+++ b/pccts/antlr/main.c
@@ -49,7 +49,7 @@ static int tnodes_used_in_guard_predicates_etc; /* MR10 */
typedef struct _Opt {
char *option;
int arg;
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
void (*process)(...);
#else
void (*process)();
@@ -492,7 +492,7 @@ char *t;
}
Opt options[] = {
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
{ "-CC", 0, (void (*)(...)) pCC, "Generate C++ output (default=FALSE)"},
{ "-ck", 1, (void (*)(...)) pCk, "Set compressed lookahead depth; fast approximate lookahead"},
{ "-cr", 0, (void (*)(...)) pCr, "Generate cross reference (default=FALSE)"},
diff --git a/pccts/antlr/proto.h b/pccts/antlr/proto.h
index 930b2de..810afbb 100644
--- a/pccts/antlr/proto.h
+++ b/pccts/antlr/proto.h
@@ -34,37 +34,37 @@ extern int tp;
extern Junction *SynDiag;
extern char Version[];
extern char VersionDef[];
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern void (*fpPrint[])(...);
#else
extern void (*fpPrint[])();
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern struct _set (*fpReach[])(...);
#else
extern struct _set (*fpReach[])();
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern struct _tree *(*fpTraverse[])(...);
#else
extern struct _tree *(*fpTraverse[])();
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern void (**fpTrans)(...);
#else
extern void (**fpTrans)();
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern void (**fpJTrans)(...);
#else
extern void (**fpJTrans)();
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern void (*C_Trans[NumNodeTypes+1])(...);
#else
extern void (*C_Trans[])();
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
extern void (*C_JTrans[NumJuncTypes+1])(...);
#else
extern void (*C_JTrans[])();
diff --git a/pccts/dlg/main.c b/pccts/dlg/main.c
index 342d771..5605f1e 100644
--- a/pccts/dlg/main.c
+++ b/pccts/dlg/main.c
@@ -108,7 +108,7 @@ void p_warn_ambig() { warn_ambig = TRUE; }
void p_cpp() { gen_cpp = TRUE; }
#endif
-#ifdef __cplusplus
+#ifdef __USE_PROTOS
typedef void (*WildFunc)(...);
#else
typedef void (*WildFunc)();
|