aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-06-16 22:59:38 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-06-16 23:08:56 +0300
commit62932af99f536bce25a3bc88127082d9402bb955 (patch)
treeef9ab723d8b16a010d16a3c56f5c01eda2ce8ceb
parentd49315affaf435f1e9852a3ce84101e28fe765bf (diff)
downloadydb-62932af99f536bce25a3bc88127082d9402bb955.tar.gz
Revert more of custom bison patches
176d0d7e21f1789b8281d81a41b6ef7796753193
-rw-r--r--contrib/tools/bison/lib/config-win.h58
-rw-r--r--contrib/tools/bison/lib/fseterr.c4
-rw-r--r--contrib/tools/bison/lib/penviron.h5
-rw-r--r--contrib/tools/bison/lib/spawn-pipe.c4
-rw-r--r--contrib/tools/bison/lib/vasnprintf.c5
-rw-r--r--contrib/tools/bison/lib/win_sdk10.h55
-rw-r--r--contrib/tools/bison/src/files.c12
7 files changed, 57 insertions, 86 deletions
diff --git a/contrib/tools/bison/lib/config-win.h b/contrib/tools/bison/lib/config-win.h
index 17a8033596..d94d1b5ef7 100644
--- a/contrib/tools/bison/lib/config-win.h
+++ b/contrib/tools/bison/lib/config-win.h
@@ -1,8 +1,6 @@
/* lib/config.h. Generated from config.hin by configure. */
/* lib/config.hin. Generated from configure.ac by autoheader. */
-#include <contrib/tools/bison/lib/win_sdk10.h>
-
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
@@ -1228,7 +1226,7 @@ char *strsignal (int signum);
/* #undef PACKAGE_PACKAGER_VERSION */
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GNU M4 3.0.0"
+#define PACKAGE_STRING "GNU Bison 3.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "m4"
@@ -1237,14 +1235,7 @@ char *strsignal (int signum);
#define PACKAGE_URL "http://www.gnu.org/software/m4/"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "3.0.0"
-
-/* the number of pending output bytes on stream 'fp' */
-#if WIN_SDK10
-#define PENDING_OUTPUT_N_BYTES ((TWinSdk10File*)fp)->_ptr - ((TWinSdk10File*)fp)->_base
-#else
-#define PENDING_OUTPUT_N_BYTES fp->_ptr - fp->_base
-#endif
+#define PACKAGE_VERSION "3.0"
/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
/* #undef PRI_MACROS_BROKEN */
@@ -1407,7 +1398,7 @@ char *strsignal (int signum);
/* #undef USE_WINDOWS_THREADS */
/* Version number of package */
-#define VERSION "3.0.0"
+#define VERSION "3.0"
/* Define to 1 if unsetenv returns void instead of int. */
/* #undef VOID_UNSETENV */
@@ -1712,3 +1703,46 @@ char *strsignal (int signum);
#define PACKAGE_COPYRIGHT_YEAR 2013
#define LC_MESSAGES LC_ALL
+
+// Since Windows SDK 10 FILE is an internal opaque structure with no backward compatibility.
+// This code has been transplanted from Windows SDK
+// corecrt_internal_stdio.h
+
+// __crt_stdio_stream_data
+//
+// These will be used in fseterr.c to set FILE into an error state.
+typedef struct {
+ union {
+ void* _public_file;
+ char* _ptr;
+ };
+
+ char* _base;
+ int _cnt;
+ long _flags;
+ long _file;
+ int _charbuf;
+ int _bufsiz;
+ char* _tmpfname;
+ //CRITICAL_SECTION _lock;
+} TWinSdk10File;
+
+enum EWinSdk10ModeBits {
+ WIN_SDK10_IOREAD = 0x0001,
+ WIN_SDK10_IOWRITE = 0x0002,
+ WIN_SDK10_IOUPDATE = 0x0004,
+ WIN_SDK10_IOEOF = 0x0008,
+ WIN_SDK10_IOERROR = 0x0010,
+ WIN_SDK10_IOCTRLZ = 0x0020,
+ WIN_SDK10_IOBUFFER_CRT = 0x0040,
+ WIN_SDK10_IOBUFFER_USER = 0x0080,
+ WIN_SDK10_IOBUFFER_SETVBUF = 0x0100,
+ WIN_SDK10_IOBUFFER_STBUF = 0x0200,
+ WIN_SDK10_IOBUFFER_NONE = 0x0400,
+ WIN_SDK10_IOCOMMIT = 0x0800,
+ WIN_SDK10_IOSTRING = 0x1000,
+ WIN_SDK10_IOALLOCATED = 0x2000,
+};
+
+#define PENDING_OUTPUT_N_BYTES (((TWinSdk10File*)fp)->_ptr - ((TWinSdk10File*)fp)->_base)
+
diff --git a/contrib/tools/bison/lib/fseterr.c b/contrib/tools/bison/lib/fseterr.c
index f2191b6923..7eeaf9ff70 100644
--- a/contrib/tools/bison/lib/fseterr.c
+++ b/contrib/tools/bison/lib/fseterr.c
@@ -29,7 +29,7 @@ fseterr (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags |= _IO_ERR_SEEN;
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
fp_->_flags |= __SERR;
@@ -39,7 +39,7 @@ fseterr (FILE *fp)
fp->_flags |= _IOERR;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp_->_flag |= _IOERR;
-#elif WIN_SDK10
+#elif _MSC_VER
((TWinSdk10File*)fp)->_flags |= WIN_SDK10_IOERROR;
#elif defined __UCLIBC__ /* uClibc */
fp->__modeflags |= __FLAG_ERROR;
diff --git a/contrib/tools/bison/lib/penviron.h b/contrib/tools/bison/lib/penviron.h
deleted file mode 100644
index fd83197378..0000000000
--- a/contrib/tools/bison/lib/penviron.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#if defined(__FreeBSD__) || defined(__MACH__)
- extern char** environ;
-#endif
diff --git a/contrib/tools/bison/lib/spawn-pipe.c b/contrib/tools/bison/lib/spawn-pipe.c
index 86b929a7f4..57a891aac0 100644
--- a/contrib/tools/bison/lib/spawn-pipe.c
+++ b/contrib/tools/bison/lib/spawn-pipe.c
@@ -27,7 +27,6 @@
#include <signal.h>
#include <unistd.h>
-#include "penviron.h"
#include "error.h"
#include "fatal-signal.h"
#include "unistd-safer.h"
@@ -54,6 +53,9 @@
#undef open
#undef close
+#if defined(__FreeBSD__) || defined(__MACH__)
+ extern char** environ;
+#endif
#ifdef EINTR
diff --git a/contrib/tools/bison/lib/vasnprintf.c b/contrib/tools/bison/lib/vasnprintf.c
index 34cd753379..5267b1bb5e 100644
--- a/contrib/tools/bison/lib/vasnprintf.c
+++ b/contrib/tools/bison/lib/vasnprintf.c
@@ -4870,7 +4870,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
#endif
*fbp = dp->conversion;
#if USE_SNPRINTF
-# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
@@ -5575,10 +5575,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (buf_malloced != NULL)
free (buf_malloced);
CLEANUP ();
-#if (defined _MSC_VER) && (_MSC_VER < 1800)
-#else
errno = EOVERFLOW;
-#endif
return NULL;
#endif
diff --git a/contrib/tools/bison/lib/win_sdk10.h b/contrib/tools/bison/lib/win_sdk10.h
deleted file mode 100644
index 76e5c86ccd..0000000000
--- a/contrib/tools/bison/lib/win_sdk10.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#pragma once
-
-#if defined(_MSC_VER)
-
-#include <ntverp.h>
-
-// Check for Windows SDK 10+
-#if defined(VER_PRODUCTBUILD) && VER_PRODUCTBUILD >= 9600
-#define WIN_SDK10 1
-#else
-#define WIN_SDK10 0
-#endif
-
-// Since Windows SDK 10 FILE is an internal opaque structure with no backward compatibility.
-// This code has been transplanted from Windows SDK
-// corecrt_internal_stdio.h
-
-// __crt_stdio_stream_data
-#if WIN_SDK10
-typedef struct {
- union {
- void* _public_file;
- char* _ptr;
- };
-
- char* _base;
- int _cnt;
- long _flags;
- long _file;
- int _charbuf;
- int _bufsiz;
- char* _tmpfname;
- //CRITICAL_SECTION _lock;
-} TWinSdk10File;
-
-enum EWinSdk10ModeBits {
- WIN_SDK10_IOREAD = 0x0001,
- WIN_SDK10_IOWRITE = 0x0002,
- WIN_SDK10_IOUPDATE = 0x0004,
- WIN_SDK10_IOEOF = 0x0008,
- WIN_SDK10_IOERROR = 0x0010,
- WIN_SDK10_IOCTRLZ = 0x0020,
- WIN_SDK10_IOBUFFER_CRT = 0x0040,
- WIN_SDK10_IOBUFFER_USER = 0x0080,
- WIN_SDK10_IOBUFFER_SETVBUF = 0x0100,
- WIN_SDK10_IOBUFFER_STBUF = 0x0200,
- WIN_SDK10_IOBUFFER_NONE = 0x0400,
- WIN_SDK10_IOCOMMIT = 0x0800,
- WIN_SDK10_IOSTRING = 0x1000,
- WIN_SDK10_IOALLOCATED = 0x2000,
-};
-#endif
-
-#endif
-
diff --git a/contrib/tools/bison/src/files.c b/contrib/tools/bison/src/files.c
index 3b219229bc..6d4af3dd53 100644
--- a/contrib/tools/bison/src/files.c
+++ b/contrib/tools/bison/src/files.c
@@ -28,8 +28,6 @@
#include <quotearg.h>
#include <stdio-safer.h>
#include <xstrndup.h>
-#include <stdlib.h>
-#include <string.h>
#include "complain.h"
#include "files.h"
@@ -163,20 +161,20 @@ compute_exts_from_gf (const char *ext)
if (STREQ (ext, ".y"))
{
src_extension = xstrdup (language->src_extension);
- /* header_extension = xstrdup (language->header_extension); */
- header_extension = xstrdup(".h");
+ /* header_extension = xstrdup (language->header_extension); */
+ header_extension = xstrdup(".h");
}
else
{
src_extension = xstrdup (ext);
- /*
+ /*
header_extension = xstrdup (ext);
tr (src_extension, 'y', 'c');
tr (src_extension, 'Y', 'C');
tr (header_extension, 'y', 'h');
tr (header_extension, 'Y', 'H');
- */
- header_extension = xstrdup(".h");
+ */
+ header_extension = xstrdup(".h");
}
}