[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
maint: examples: reccalc: really compile cleanly in C99
From: |
Akim Demaille |
Subject: |
maint: examples: reccalc: really compile cleanly in C99 |
Date: |
Sun, 5 Apr 2020 09:00:26 +0200 |
commit 678853da7e43e4b89098d69d276ee12ec07ede95
Author: Akim Demaille <address@hidden>
Date: Sun Apr 5 08:34:40 2020 +0200
examples: reccalc: really compile cleanly in C99
The previous fix does not suffice, and actually managed to make things
worse by defining yyscan_t twice in parse.y...
Reported by kencu.
https://trac.macports.org/ticket/59927#comment:29
* examples/c/reccalc/parse.y (yyscan_t): Define it with the same
guards as used by Flex.
diff --git a/examples/c/reccalc/parse.y b/examples/c/reccalc/parse.y
index 3de58afc..ae80942c 100644
--- a/examples/c/reccalc/parse.y
+++ b/examples/c/reccalc/parse.y
@@ -4,7 +4,11 @@
// Emitted in the header file, before the definition of YYSTYPE.
%code requires
{
+ #ifndef YY_TYPEDEF_YY_SCANNER_T
+ # define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t;
+ #endif
+
typedef struct
{
// Whether to print the intermediate results.
@@ -132,10 +136,6 @@ exp:
%%
// Epilogue (C code).
-
-// We already defined yyscan_t, don't let scan.h define it again.
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
#include "scan.h"
result
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- maint: examples: reccalc: really compile cleanly in C99,
Akim Demaille <=