Skip to content

Commit 382092a

Browse files
committed
Prevent redeclaration of typedef yyscan_t
Fix for 1f0de66: We need to prevent redeclaration of typedef yyscan_t. (This will work with C11 but not currently with C99.) The generated scanner files provide their own typedef, but we also need to provide one for the interfaces that we expose. So we need to add some preprocessor guards to avoid a redefinition. (This is how the generated scanner files do it internally as well.) This way everything now works independent of the order in which things are included. Discussion: https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5b7b@eisentraut.org
1 parent 9aea73f commit 382092a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

contrib/cube/cubedata.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ typedef struct NDBOX
6262
/* for cubescan.l and cubeparse.y */
6363
/* All grammar constructs return strings */
6464
#define YYSTYPE char *
65+
#ifndef YY_TYPEDEF_YY_SCANNER_T
66+
#define YY_TYPEDEF_YY_SCANNER_T
6567
typedef void *yyscan_t;
68+
#endif
6669

6770
/* in cubescan.l */
6871
extern int cube_yylex(YYSTYPE *yylval_param, yyscan_t yyscanner);

contrib/seg/segdata.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ extern int significant_digits(const char *s);
1616

1717
/* for segscan.l and segparse.y */
1818
union YYSTYPE;
19+
#ifndef YY_TYPEDEF_YY_SCANNER_T
20+
#define YY_TYPEDEF_YY_SCANNER_T
1921
typedef void *yyscan_t;
22+
#endif
2023

2124
/* in segscan.l */
2225
extern int seg_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner);

0 commit comments

Comments
 (0)