I started committing the cube and seg pieces. There were a couple of complaints from the buildfarm, like

ccache clang -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -Wmissing-variable-declarations -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -g -O2 -fno-common -fsanitize=alignment -fsanitize-trap=alignment -Wno-deprecated-declarations -Werror -fvisibility=hidden -I. -I. -I../../src/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -DWRITE_READ_PARSE_PLAN_TREES -DSTRESS_SORT_INT_MIN -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/include -I/usr/local/ssl/include -c -o segscan.o segscan.c segscan.c:348:15: error: redefinition of typedef 'yyscan_t' is a C11 feature [-Werror,-Wtypedef-redefinition]
typedef void* yyscan_t;
              ^
./segdata.h:19:15: note: previous definition is here
typedef void *yyscan_t;
              ^

I can fix that with the attached patch.

The symbol YY_TYPEDEF_YY_SCANNER_T isn't documented, but we already use it elsewhere in the code.

Note that in replication/syncrep.h and replication/walsender_private.h we have to have an #ifndef wrapper because there are files that end up including both headers. Maybe we should put that #ifndef wrapper everywhere for consistency?

Any thoughts?

(Also, we should probably figure out a way to get these warnings before things hit the buildfarm.)
diff --git a/contrib/cube/cubedata.h b/contrib/cube/cubedata.h
index 8bfcc6e99a2..006a6d2c8c4 100644
--- a/contrib/cube/cubedata.h
+++ b/contrib/cube/cubedata.h
@@ -62,6 +62,7 @@ typedef struct NDBOX
 /* for cubescan.l and cubeparse.y */
 /* All grammar constructs return strings */
 #define YYSTYPE char *
+#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
 
 /* in cubescan.l */
diff --git a/contrib/seg/segdata.h b/contrib/seg/segdata.h
index 7bc7c83dca3..b55ff78880b 100644
--- a/contrib/seg/segdata.h
+++ b/contrib/seg/segdata.h
@@ -16,6 +16,7 @@ extern int    significant_digits(const char *s);
 
 /* for segscan.l and segparse.y */
 union YYSTYPE;
+#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
 
 /* in segscan.l */
diff --git a/src/backend/utils/adt/jsonpath_internal.h 
b/src/backend/utils/adt/jsonpath_internal.h
index 71f885475dd..0d8b89abea2 100644
--- a/src/backend/utils/adt/jsonpath_internal.h
+++ b/src/backend/utils/adt/jsonpath_internal.h
@@ -22,6 +22,7 @@ typedef struct JsonPathString
        int                     total;
 } JsonPathString;
 
+#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
 
 #include "utils/jsonpath.h"
diff --git a/src/include/bootstrap/bootstrap.h 
b/src/include/bootstrap/bootstrap.h
index ccec9415acb..782a2829c71 100644
--- a/src/include/bootstrap/bootstrap.h
+++ b/src/include/bootstrap/bootstrap.h
@@ -56,6 +56,7 @@ extern void boot_get_type_io_data(Oid typid,
                                                                  Oid 
*typoutput);
 
 union YYSTYPE;
+#define YY_TYPEDEF_YY_SCANNER_T
 typedef void *yyscan_t;
 
 extern int     boot_yyparse(yyscan_t yyscanner);
diff --git a/src/include/replication/syncrep.h 
b/src/include/replication/syncrep.h
index b4134dbc91d..3fe44a880cf 100644
--- a/src/include/replication/syncrep.h
+++ b/src/include/replication/syncrep.h
@@ -101,7 +101,10 @@ 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(yyscan_t yyscanner);
 extern int     syncrep_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner);
 extern void syncrep_yyerror(yyscan_t yyscanner, const char *str);
diff --git a/src/include/replication/walsender_private.h 
b/src/include/replication/walsender_private.h
index a82ce33c083..f487d3ad9e9 100644
--- a/src/include/replication/walsender_private.h
+++ b/src/include/replication/walsender_private.h
@@ -126,7 +126,10 @@ 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(yyscan_t yyscanner);
 extern int     replication_yylex(union YYSTYPE *yylval_param, yyscan_t 
yyscanner);
 extern void replication_yyerror(yyscan_t yyscanner, const char *message) 
pg_attribute_noreturn();

Reply via email to