Skip to content

Commit

Permalink
Windows test build
Browse files Browse the repository at this point in the history
  • Loading branch information
lfittl committed Jan 1, 2024
1 parent 1896d12 commit df91592
Show file tree
Hide file tree
Showing 440 changed files with 1,474 additions and 11,361 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ['1.20', '1.21']
os: ['ubuntu-latest', 'windows-latest']
include:
- go: 1.16 # Oldest Go version still tested (Windows requires 1.20+ due to https://github.com/golang/go/issues/57455)
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.16
id: go
go-version: ${{ matrix.go }}
- name: Check out code
uses: actions/checkout@v3
- name: Runs tests
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ benchmark:

# --- Below only needed for releasing new versions

LIB_PG_QUERY_TAG = 16-5.0.0
LIB_PG_QUERY_TAG = win

root_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
LIB_TMPDIR = $(root_dir)/tmp
Expand All @@ -36,12 +36,11 @@ update_source: $(LIBDIR)
rm -fr parser/include
# Reduce everything down to one directory
cp -a $(LIBDIR)/src/* parser/
mv parser/postgres/include parser/include/postgres
rm parser/pg_query_outfuncs_protobuf_cpp.cc
mv parser/postgres/* parser/
rmdir parser/postgres
cp -a $(LIBDIR)/pg_query.h parser/include
# Make sure every .c in the top-level directory is its own translation unit
mv parser/*{_conds,_defs,_helper,.funcs}.c parser/include
# Protobuf definitions
mkdir -p $(PWD)/bin
GOBIN=$(PWD)/bin go install google.golang.org/protobuf/cmd/protoc-gen-go
Expand Down
Empty file removed parser/guc-file.c
Empty file.
33 changes: 0 additions & 33 deletions parser/include/common/ip.h

This file was deleted.

8 changes: 0 additions & 8 deletions parser/include/pg_config_os.h

This file was deleted.

2 changes: 1 addition & 1 deletion parser/include/pg_query_fingerprint_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -5894,7 +5894,7 @@ _fingerprintRTEPermissionInfo(FingerprintContext *ctx, const RTEPermissionInfo *

if (node->requiredPerms != 0) {
char buffer[50];
sprintf(buffer, "%ld", node->requiredPerms);
sprintf(buffer, UINT64_FORMAT, node->requiredPerms);
_fingerprintString(ctx, "requiredPerms");
_fingerprintString(ctx, buffer);
}
Expand Down
2 changes: 1 addition & 1 deletion parser/include/pg_query_outfuncs_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ _outRTEPermissionInfo(OUT_TYPE(RTEPermissionInfo, RTEPermissionInfo) out, const
{
WRITE_UINT_FIELD(relid, relid, relid);
WRITE_BOOL_FIELD(inh, inh, inh);
WRITE_LONG_FIELD(required_perms, requiredPerms, requiredPerms);
WRITE_UINT64_FIELD(required_perms, requiredPerms, requiredPerms);
WRITE_UINT_FIELD(check_as_user, checkAsUser, checkAsUser);
WRITE_BITMAPSET_FIELD(selected_cols, selectedCols, selectedCols);
WRITE_BITMAPSET_FIELD(inserted_cols, insertedCols, insertedCols);
Expand Down
2 changes: 1 addition & 1 deletion parser/include/pg_query_readfuncs_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ _readRTEPermissionInfo(OUT_TYPE(RTEPermissionInfo, RTEPermissionInfo) msg)
RTEPermissionInfo *node = makeNode(RTEPermissionInfo);
READ_UINT_FIELD(relid, relid, relid);
READ_BOOL_FIELD(inh, inh, inh);
READ_LONG_FIELD(required_perms, requiredPerms, requiredPerms);
READ_UINT64_FIELD(required_perms, requiredPerms, requiredPerms);
READ_UINT_FIELD(check_as_user, checkAsUser, checkAsUser);
READ_BITMAPSET_FIELD(selected_cols, selectedCols, selectedCols);
READ_BITMAPSET_FIELD(inserted_cols, insertedCols, insertedCols);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ extern PGDLLIMPORT bool IsUnderPostmaster;
extern PGDLLIMPORT bool IsBackgroundWorker;
extern PGDLLIMPORT bool IsBinaryUpgrade;

extern PGDLLIMPORT __thread bool ExitOnAnyError;
extern PGDLLIMPORT __thread bool ExitOnAnyError;

extern PGDLLIMPORT char *DataDir;
extern PGDLLIMPORT int data_directory_mode;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ typedef struct Node
* Fortunately, this macro isn't recursive so we just define
* a global variable for this purpose.
*/
extern PGDLLIMPORT Node *newNodeMacroHolder;
extern PGDLLIMPORT __thread Node *newNodeMacroHolder;

#define newNode(size, tag) \
( \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ typedef enum
} BackslashQuoteType;

/* GUC variables in scan.l (every one of these is a bad idea :-() */
extern PGDLLIMPORT __thread int backslash_quote;
extern PGDLLIMPORT __thread bool escape_string_warning;
extern PGDLLIMPORT __thread bool standard_conforming_strings;
extern PGDLLIMPORT __thread int backslash_quote;
extern PGDLLIMPORT __thread bool escape_string_warning;
extern PGDLLIMPORT __thread bool standard_conforming_strings;


/* Primary entry point for the raw parsing functions */
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
138 changes: 136 additions & 2 deletions parser/include/pg_config.h → parser/include/postgres/pg_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@
#define PG_VERSION_NUM 160001

/* A string containing the version number, platform, and C compiler */
#define PG_VERSION_STR "PostgreSQL 16.1 on aarch64-apple-darwin21.6.0, compiled by Apple clang version 14.0.0 (clang-1400.0.29.102), 64-bit"
#define PG_VERSION_STR "PostgreSQL 16.1 (libpg_query)"

/* Define to 1 to allow profiling output to be saved separately for each
process. */
Expand Down Expand Up @@ -826,18 +826,152 @@

/* Define to how the compiler spells `typeof'. */
/* #undef typeof */
/* This causes compatibility problems on some Linux distros, with "xlocale.h" not being available */
#undef HAVE_LOCALE_T
#undef LOCALE_T_IN_XLOCALE
#undef WCSTOMBS_L_IN_XLOCALE
#undef PG_INT128_TYPE

/* Support gcc earlier than 4.6.0 and MSVC */
#undef HAVE__STATIC_ASSERT

/* Avoid dependency on execinfo (requires extra library on musl-libc based systems, not supported on Windows) */
#undef HAVE_EXECINFO_H
#undef HAVE_BACKTRACE_SYMBOLS

/* Avoid dependency on hardware popcount instructions (POPQNTQ) on x86 */
#undef HAVE_X86_64_POPCNTQ

/* Avoid dependency on cpuid.h (only supported on x86 systems) */
#undef HAVE__GET_CPUID

/* Avoid CRC extension usage to ensure we are not architecture-dependent */
#undef USE_ARMV8_CRC32C
#undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK

/* Ensure we do not fail on systems that have strchrnul support (FreeBSD, NetBSD and newer glibc) */
#include <stdlib.h>
#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))
#define HAVE_STRCHRNUL
#endif

/* 32-bit */
#if defined(_WIN32) || __SIZEOF_POINTER__ == 4
#undef ALIGNOF_DOUBLE
#define ALIGNOF_DOUBLE 4
#undef ALIGNOF_LONG
#define ALIGNOF_LONG 4
#define ALIGNOF_LONG_LONG_INT 4
#undef ALIGNOF_PG_INT128_TYPE
#undef HAVE_LONG_INT_64
#define HAVE_LONG_LONG_INT_64 1
#undef INT64_MODIFIER
#define INT64_MODIFIER "ll"
#undef PG_INT128_TYPE
#undef PG_INT64_TYPE
#define PG_INT64_TYPE long long int
#undef SIZEOF_LONG
#define SIZEOF_LONG 4
#undef SIZEOF_OFF_T
#define SIZEOF_OFF_T 4
#undef SIZEOF_SIZE_T
#define SIZEOF_SIZE_T 4
#undef SIZEOF_VOID_P
#define SIZEOF_VOID_P 4
#endif

/* Windows */
#if defined(_WIN32) || defined(_WIN64)
#undef HAVE_COPYFILE
#undef HAVE_COPYFILE_H
#undef HAVE_DECL_F_FULLFSYNC
#define HAVE_DECL_F_FULLFSYNC 0
#undef HAVE_DECL_PREADV
#define HAVE_DECL_PREADV 0
#undef HAVE_DECL_PWRITEV
#define HAVE_DECL_PWRITEV 0
#undef HAVE_DECL_STRLCAT
#define HAVE_DECL_STRLCAT 0
#undef HAVE_DECL_STRLCPY
#define HAVE_DECL_STRLCPY 0
#undef HAVE_GETIFADDRS
#undef HAVE_GETPEEREID
#undef HAVE_IFADDRS_H
#undef HAVE_INET_ATON
#undef HAVE_INT_OPTRESET
#undef HAVE_KQUEUE
#undef HAVE_LANGINFO_H
#undef HAVE_MEMSET_S
#undef HAVE_MKDTEMP
#undef HAVE_PTHREAD
#undef HAVE_PTHREAD_BARRIER_WAIT
#undef HAVE_PTHREAD_IS_THREADED_NP
#undef HAVE_PTHREAD_PRIO_INHERIT
#undef HAVE_STRERROR_R
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
#undef HAVE_STRSIGNAL
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
#undef HAVE_STRUCT_TM_TM_ZONE
#undef HAVE_SYSLOG
#undef HAVE_SYS_EVENT_H
#undef HAVE_SYS_UCRED_H
#undef HAVE_TERMIOS_H
#undef HAVE_UNION_SEMUN
#undef HAVE_USELOCALE
#define HAVE__CONFIGTHREADLOCALE 1
#undef STRERROR_R_INT
#undef USE_SYSV_SEMAPHORES
#undef USE_SYSV_SHARED_MEMORY
#define USE_WIN32_SEMAPHORES 1
#define USE_WIN32_SHARED_MEMORY 1
#undef PG_PRINTF_ATTRIBUTE
#if defined(__clang__)
#define PG_PRINTF_ATTRIBUTE printf
#elif defined(__MINGW32__) || defined(__MINGW64__) || defined(__MSYS__) || defined(__CYGWIN__)
#define PG_PRINTF_ATTRIBUTE gnu_printf
#endif
#if defined(__MINGW32__) || defined(__MINGW64__) || defined(__MSYS__) || defined(__CYGWIN__)
#undef HAVE_MBSTOWCS_L
#undef HAVE_WCSTOMBS_L
#define HAVE_CRTDEFS_H 1
#define HAVE_PTHREAD_BARRIER_WAIT 1
#endif
#endif

/* Microsoft Visual Studio Compiler */
#ifdef _MSC_VER
#undef HAVE_COMPUTED_GOTO
#undef HAVE_GCC__ATOMIC_INT32_CAS
#undef HAVE_GCC__ATOMIC_INT64_CAS
#undef HAVE_GCC__SYNC_CHAR_TAS
#undef HAVE_GCC__SYNC_INT32_CAS
#undef HAVE_GCC__SYNC_INT32_TAS
#undef HAVE_GCC__SYNC_INT64_CAS
#undef HAVE_GETOPT
#undef HAVE_GETOPT_H
#undef HAVE_GETOPT_LONG
#undef HAVE_INTTYPES_H
#undef HAVE_INT_OPTERR
#undef HAVE_LIBM
#undef HAVE_STRINGS_H
#undef HAVE_STRUCT_OPTION
#undef HAVE_TYPEOF
#undef HAVE_VISIBILITY_ATTRIBUTE
#undef HAVE__BOOL
#undef HAVE__BUILTIN_BSWAP16
#undef HAVE__BUILTIN_BSWAP32
#undef HAVE__BUILTIN_BSWAP64
#undef HAVE__BUILTIN_CLZ
#undef HAVE__BUILTIN_CONSTANT_P
#undef HAVE__BUILTIN_CTZ
#undef HAVE__BUILTIN_FRAME_ADDRESS
#undef HAVE__BUILTIN_OP_OVERFLOW
#undef HAVE__BUILTIN_POPCOUNT
#undef HAVE__BUILTIN_TYPES_COMPATIBLE_P
#undef HAVE__BUILTIN_UNREACHABLE
#ifndef __cplusplus
#define inline __inline
#endif
#undef restrict
#define __thread __declspec( thread )
#endif
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions parser/include/postgres/pg_config_os.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#if defined(_WIN32) || defined(_WIN64)
#include "port/win32.h"
#undef PGDLLIMPORT
#undef PGDLLEXPORT
#ifdef __clang__
#undef __MINGW64__
#endif /* __clang__ */
#endif
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ extern PGDLLIMPORT PgStat_Counter pgStatActiveTime;
extern PGDLLIMPORT PgStat_Counter pgStatTransactionIdleTime;

/* updated by the traffic cop and in errfinish() */
extern PGDLLIMPORT __thread SessionEndType pgStatSessionEndCause;
extern PGDLLIMPORT __thread SessionEndType pgStatSessionEndCause;


/*
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ typedef union YYSTYPE
# define YYSTYPE_IS_TRIVIAL 1
#endif

extern __thread YYSTYPE plpgsql_yylval;
extern __thread YYSTYPE plpgsql_yylval;

#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
Expand All @@ -382,4 +382,4 @@ typedef struct YYLTYPE
# define YYLTYPE_IS_TRIVIAL 1
#endif

extern __thread YYLTYPE plpgsql_yylloc;
extern __thread YYLTYPE plpgsql_yylloc;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 11 additions & 11 deletions parser/include/plpgsql.h → parser/include/postgres/plpgsql.h
Original file line number Diff line number Diff line change
Expand Up @@ -1191,11 +1191,11 @@ typedef enum
IDENTIFIER_LOOKUP_EXPR /* In SQL expression --- special case */
} IdentifierLookup;

extern __thread IdentifierLookup plpgsql_IdentifierLookup;
extern __thread IdentifierLookup plpgsql_IdentifierLookup;

extern __thread int plpgsql_variable_conflict;
extern __thread int plpgsql_variable_conflict;

extern __thread bool plpgsql_print_strict_params;
extern __thread bool plpgsql_print_strict_params;

extern bool plpgsql_check_asserts;

Expand All @@ -1209,18 +1209,18 @@ extern bool plpgsql_check_asserts;
extern int plpgsql_extra_warnings;
extern int plpgsql_extra_errors;

extern __thread bool plpgsql_check_syntax;
extern __thread bool plpgsql_DumpExecTree;
extern __thread bool plpgsql_check_syntax;
extern __thread bool plpgsql_DumpExecTree;

extern __thread PLpgSQL_stmt_block *plpgsql_parse_result;
extern __thread PLpgSQL_stmt_block *plpgsql_parse_result;

extern __thread int plpgsql_nDatums;
extern __thread PLpgSQL_datum **plpgsql_Datums;
extern __thread int plpgsql_nDatums;
extern __thread PLpgSQL_datum **plpgsql_Datums;

extern __thread char *plpgsql_error_funcname;
extern __thread char *plpgsql_error_funcname;

extern __thread PLpgSQL_function *plpgsql_curr_compile;
extern __thread MemoryContext plpgsql_compile_tmp_cxt;
extern __thread PLpgSQL_function *plpgsql_curr_compile;
extern __thread MemoryContext plpgsql_compile_tmp_cxt;

extern PLpgSQL_plugin **plpgsql_plugin_ptr;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit df91592

Please sign in to comment.