aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-08-02 09:47:14 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-08-02 09:59:59 +0300
commit7d4535be64fde4963aa2ddd389134facac293e87 (patch)
treea62e08ab207b1a4b2c110abaae19bf08f4a3af7e
parent361db6f916e56c2f127232d0260fcc910f2527b9 (diff)
downloadydb-7d4535be64fde4963aa2ddd389134facac293e87.tar.gz
contrib/tools/bison: Replace patch with environment variable
59fef9fd4f33196d66de3ac1fba18aba86a7f327
-rw-r--r--build/conf/bison_lex.conf4
-rw-r--r--contrib/tools/bison/lib/config-win.h1
-rw-r--r--contrib/tools/bison/src/getargs.c8
-rw-r--r--contrib/tools/bison/src/getargs.h2
-rw-r--r--contrib/tools/bison/src/output.c3
5 files changed, 4 insertions, 14 deletions
diff --git a/build/conf/bison_lex.conf b/build/conf/bison_lex.conf
index 5e3a5418f6..f8bee6b89a 100644
--- a/build/conf/bison_lex.conf
+++ b/build/conf/bison_lex.conf
@@ -3,6 +3,8 @@
# This specilizes _SRC() macro, so should be imported after generic version definition
# Thus uses _ADD_HIDDEN_INPUTS() macro from ymake.core.conf
+M4_PATH=contrib/tools/m4
+
LEX_FLAGS=
BISON_FLAGS=-v
@@ -133,7 +135,7 @@ macro USE_OLD_FLEX() {
macro _SRC("y", SRC, SRCFLAGS...) {
.PEERDIR=build/induced/by_bison
- .CMD=${tool:"contrib/tools/bison"} $BISON_FLAGS --m4=${tool:"contrib/tools/m4"} $_BISON_HEADER ${hide:_BISON_GEN_EXT} -o ${nopath;output;suf=$_BISON_GEN_EXT:SRC} ${input:SRC} ${SRCFLAGS} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"} && $_BISON_PP
+ .CMD=${tool:"contrib/tools/bison"} $BISON_FLAGS ${env:"M4=${tool:M4_PATH}"} $_BISON_HEADER ${hide:_BISON_GEN_EXT} -o ${nopath;output;suf=$_BISON_GEN_EXT:SRC} ${input:SRC} ${SRCFLAGS} ${kv;hide:"p YC"} ${kv;hide:"pc light-green"} && $_BISON_PP
.SEM=target_bison_parser PRIVATE ${input:SRC} ${output;nopath;noext;hide;suf=${OBJ_SUF}.o:SRC} ${nopath;noext;output;hide:SRC.h} ${nopath;noext;output;addincl;hide:SRC.h} && set_global_flags BISON_FLAGS $BISON_FLAGS && conan_require_tool m4/1.4.19 && conan_import '"bin, m4* -> ./bin/m4/bin"' && conan_require_tool bison/3.8.2 && conan_import '"bin, bison* -> ./bin/bison/bin"' && conan_import '"res, * -> ./bin/bison/res"' && target_macroses-ITEM && target_macroses-macro target_bison_parser && target_macroses-args PRIVATE ${input:SRC} ${output;nopath;noext;hide;suf=${OBJ_SUF}.o:SRC} ${nopath;noext;output;hide:SRC.h} ${nopath;noext;output;addincl;hide:SRC.h} && platform_vars-BISON_FLAGS ${quo:BISON_FLAGS} && conan-tool_requires m4/1.4.19 && conan-imports 'bin, m4* -> ./bin/m4/bin' && conan-tool_requires bison/3.8.2 && conan-imports 'bin, bison* -> ./bin/bison/bin' && conan-imports 'res, * -> ./bin/bison/res'
}
diff --git a/contrib/tools/bison/lib/config-win.h b/contrib/tools/bison/lib/config-win.h
index 4e3fc4ebfa..a3a4ad1ade 100644
--- a/contrib/tools/bison/lib/config-win.h
+++ b/contrib/tools/bison/lib/config-win.h
@@ -1701,6 +1701,7 @@ char *strsignal (int signum);
/* Define as a macro for copying va_list variables. */
#define va_copy gl_va_copy
+#define M4 "/var/empty/gnum4-1.4.19/bin/m4"
#define M4_GNU_OPTION "--gnu"
#define PACKAGE_COPYRIGHT_YEAR 2013
#define _GL_ATTRIBUTE_MALLOC
diff --git a/contrib/tools/bison/src/getargs.c b/contrib/tools/bison/src/getargs.c
index 51d66be3f5..417e163c2a 100644
--- a/contrib/tools/bison/src/getargs.c
+++ b/contrib/tools/bison/src/getargs.c
@@ -65,8 +65,6 @@ const char *skeleton = NULL;
int language_prio = default_prio;
struct bison_language const *language = &valid_languages[0];
-const char* m4_path = NULL;
-
/** Decode an option's key.
*
* \param opt option being decoded.
@@ -496,7 +494,6 @@ enum
LOCATIONS_OPTION = CHAR_MAX + 1,
PRINT_LOCALEDIR_OPTION,
PRINT_DATADIR_OPTION,
- M4_PATH,
REPORT_FILE_OPTION
};
@@ -525,7 +522,6 @@ static struct option const long_options[] =
/* Hidden. */
{ "trace", optional_argument, 0, 'T' },
- { "m4", required_argument, 0, M4_PATH },
/* Output. */
{ "defines", optional_argument, 0, 'd' },
@@ -734,10 +730,6 @@ getargs (int argc, char *argv[])
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;
- case M4_PATH:
- m4_path = xstrdup (AS_FILE_NAME (optarg));
- break;
-
default:
usage (EXIT_FAILURE);
}
diff --git a/contrib/tools/bison/src/getargs.h b/contrib/tools/bison/src/getargs.h
index b488091393..c5adb8487a 100644
--- a/contrib/tools/bison/src/getargs.h
+++ b/contrib/tools/bison/src/getargs.h
@@ -42,8 +42,6 @@ extern bool token_table_flag; /* for -k */
extern location yacc_loc; /* for -y */
extern bool update_flag; /* for -u */
-extern const char* m4_path;
-
/* GLR_PARSER is true if the input file says to use the GLR
(Generalized LR) parser, and to output some additional information
used by the GLR algorithm. */
diff --git a/contrib/tools/bison/src/output.c b/contrib/tools/bison/src/output.c
index ae0dc5834f..10a6d38a7a 100644
--- a/contrib/tools/bison/src/output.c
+++ b/contrib/tools/bison/src/output.c
@@ -48,9 +48,6 @@
#include <contrib/tools/bison/arcadia_root.h>
-#undef M4
-#define M4 (m4_path)
-
#define STR(a) XSTR(a)
#define XSTR(a) #a