Allow redeclaration of typedef yyscan_t
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 12 Sep 2025 06:13:05 +0000 (08:13 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 12 Sep 2025 06:16:00 +0000 (08:16 +0200)
This is allowed in C11, so we don't need the workaround guards against
it anymore.  This effectively reverts commit 382092a0cd2 that put
these guards in place.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org

contrib/cube/cubedata.h
contrib/seg/segdata.h
src/backend/utils/adt/jsonpath_internal.h
src/bin/pgbench/pgbench.h
src/include/bootstrap/bootstrap.h
src/include/fe_utils/psqlscan_int.h
src/include/replication/syncrep.h
src/include/replication/walsender_private.h
src/pl/plpgsql/src/plpgsql.h

index ad1e2bd69981097b5d21c8f8d5213a43eb6c64e4..8bfcc6e99a27d4a37ca7ad3cd0757f7f9c5d7175 100644 (file)
@@ -62,10 +62,7 @@ typedef struct NDBOX
 /* for cubescan.l and cubeparse.y */
 /* All grammar constructs return strings */
 #define YYSTYPE char *
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 
 /* in cubescan.l */
 extern int cube_yylex(YYSTYPE *yylval_param, yyscan_t yyscanner);
index 4347c31c28e94071b7926270b465af8e932c34b3..7bc7c83dca309153e186b888da1efa25d1c9f1cf 100644 (file)
@@ -16,10 +16,7 @@ extern int   significant_digits(const char *s);
 
 /* for segscan.l and segparse.y */
 union YYSTYPE;
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 
 /* in segscan.l */
 extern int seg_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner);
index f78069857d02bc7edd810350d8995ad43b7cddb5..19567aca6f775934f70ed4c593ea7efce5113d7e 100644 (file)
@@ -22,10 +22,7 @@ typedef struct JsonPathString
    int         total;
 } JsonPathString;
 
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 
 #include "utils/jsonpath.h"
 #include "jsonpath_gram.h"
index f8b7b497d1ee0ed3c0940cc9932cda595eb95f6b..d55d30e0ef95480c0b589b484a454e1f187183b4 100644 (file)
  * here looking like the definitions in exprscan.l.  exprparse.y and
  * pgbench.c also use this to be able to declare things as "yyscan_t".
  */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 
 /*
  * Likewise, we can't see exprparse.y's definition of union YYSTYPE here,
index befc4fa1b3d87329940896d44ea81c9ebfb71ade..5ad347ec290fa73f214b7a9d968e931f88cd3986 100644 (file)
@@ -56,10 +56,7 @@ extern void boot_get_type_io_data(Oid typid,
                                  Oid *typoutput);
 
 union YYSTYPE;
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 
 extern int boot_yyparse(yyscan_t yyscanner);
 extern int boot_yylex_init(yyscan_t *yyscannerp);
index 2a3a9d7c82aaaef0fbea9b4f1ebae96e740ae2c4..a1ebf226cf499eeb010b2ab10d050e23c0458909 100644 (file)
  * validity checking; in actual use, this file should always be included
  * from the body of a flex file, where these symbols are already defined.
  */
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 
 /*
  * We use a stack of flex buffers to handle substitution of psql variables.
index 675669a79f7d3f34380f890c0cb0fd885219cb91..dc2b118b1662966be91b5f340904850077ae89ab 100644 (file)
@@ -97,10 +97,7 @@ extern void SyncRepUpdateSyncStandbysDefined(void);
  * in syncrep_gram.y and syncrep_scanner.l
  */
 union YYSTYPE;
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 extern int syncrep_yyparse(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner);
 extern int syncrep_yylex(union YYSTYPE *yylval_param, char **syncrep_parse_error_msg_p, yyscan_t yyscanner);
 extern void syncrep_yyerror(SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner, const char *str);
index e98701038f506241086495716c662f048c84d0b7..384b8a78b94623c4783695c327cd1f4362a9ef7e 100644 (file)
@@ -141,10 +141,7 @@ extern void WalSndSetState(WalSndState state);
  * repl_scanner.l
  */
 union YYSTYPE;
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 extern int replication_yyparse(Node **replication_parse_result_p, yyscan_t yyscanner);
 extern int replication_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner);
 pg_noreturn extern void replication_yyerror(Node **replication_parse_result_p, yyscan_t yyscanner, const char *message);
index 41e52b8ce7183420b67c5f6a0b298bbb47ba9045..5f193a371839994a16bc503c020641ef71cd56af 100644 (file)
@@ -1307,10 +1307,7 @@ extern void plpgsql_dumptree(PLpgSQL_function *func);
  */
 union YYSTYPE;
 #define YYLTYPE int
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
-#endif
 extern int plpgsql_yylex(union YYSTYPE *yylvalp, YYLTYPE *yyllocp, yyscan_t yyscanner);
 extern int plpgsql_token_length(yyscan_t yyscanner);
 extern void plpgsql_push_back_token(int token, union YYSTYPE *yylvalp, YYLTYPE *yyllocp, yyscan_t yyscanner);