aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-06-09 16:27:06 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-06-09 16:36:11 +0300
commitdc2056233ab4b16a84dcea43f683eaa0df0a720a (patch)
tree1c846583e9a458e31f4d4b37c60b5e2dfba5eb97
parent9d3d6bc09cab4e631a4babeefd81a1d194867658 (diff)
downloadydb-dc2056233ab4b16a84dcea43f683eaa0df0a720a.tar.gz
contrib/tools/bison: Revert some harmless patches
7ba13f28ff2841bd4468387feaa6536b3e372bde
-rw-r--r--contrib/tools/bison/lib/c-strcasecmp.c4
-rw-r--r--contrib/tools/bison/lib/c-strncasecmp.c4
-rw-r--r--contrib/tools/bison/lib/concat-filename.c2
-rw-r--r--contrib/tools/bison/lib/getopt.c4
-rw-r--r--contrib/tools/bison/lib/mbswidth.c2
-rw-r--r--contrib/tools/bison/lib/obstack.c26
-rw-r--r--contrib/tools/bison/lib/stpcpy.c5
-rw-r--r--contrib/tools/bison/lib/wchar--.h7
-rw-r--r--contrib/tools/bison/src/AnnotationList.c5
-rw-r--r--contrib/tools/bison/src/muscle-tab.c18
-rw-r--r--contrib/tools/bison/src/print-xml.c1
-rw-r--r--contrib/tools/bison/src/scan-gram.c3
-rw-r--r--contrib/tools/bison/src/symlist.c3
-rw-r--r--contrib/tools/bison/src/symtab.c3
14 files changed, 35 insertions, 52 deletions
diff --git a/contrib/tools/bison/lib/c-strcasecmp.c b/contrib/tools/bison/lib/c-strcasecmp.c
index cd4e4d49cb..ef85f0e67d 100644
--- a/contrib/tools/bison/lib/c-strcasecmp.c
+++ b/contrib/tools/bison/lib/c-strcasecmp.c
@@ -26,8 +26,8 @@
int
c_strcasecmp (const char *s1, const char *s2)
{
- const unsigned char *p1 = (const unsigned char *) s1;
- const unsigned char *p2 = (const unsigned char *) s2;
+ register const unsigned char *p1 = (const unsigned char *) s1;
+ register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2)
diff --git a/contrib/tools/bison/lib/c-strncasecmp.c b/contrib/tools/bison/lib/c-strncasecmp.c
index 053c70a73a..04404b00cd 100644
--- a/contrib/tools/bison/lib/c-strncasecmp.c
+++ b/contrib/tools/bison/lib/c-strncasecmp.c
@@ -26,8 +26,8 @@
int
c_strncasecmp (const char *s1, const char *s2, size_t n)
{
- const unsigned char *p1 = (const unsigned char *) s1;
- const unsigned char *p2 = (const unsigned char *) s2;
+ register const unsigned char *p1 = (const unsigned char *) s1;
+ register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2 || n == 0)
diff --git a/contrib/tools/bison/lib/concat-filename.c b/contrib/tools/bison/lib/concat-filename.c
index b749d6838b..68168dcd53 100644
--- a/contrib/tools/bison/lib/concat-filename.c
+++ b/contrib/tools/bison/lib/concat-filename.c
@@ -23,7 +23,7 @@
#include <errno.h>
#include <stdlib.h>
-#include "string--.h"
+#include <string.h>
#include "filename.h"
diff --git a/contrib/tools/bison/lib/getopt.c b/contrib/tools/bison/lib/getopt.c
index 4b3d267067..ef0f4ceec7 100644
--- a/contrib/tools/bison/lib/getopt.c
+++ b/contrib/tools/bison/lib/getopt.c
@@ -181,7 +181,7 @@ exchange (char **argv, struct _getopt_data *d)
{
/* Bottom segment is the short one. */
int len = middle - bottom;
- int i;
+ register int i;
/* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++)
@@ -198,7 +198,7 @@ exchange (char **argv, struct _getopt_data *d)
{
/* Top segment is the short one. */
int len = top - middle;
- int i;
+ register int i;
/* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++)
diff --git a/contrib/tools/bison/lib/mbswidth.c b/contrib/tools/bison/lib/mbswidth.c
index 6571037592..7c2dfce886 100644
--- a/contrib/tools/bison/lib/mbswidth.c
+++ b/contrib/tools/bison/lib/mbswidth.c
@@ -30,7 +30,7 @@
#include <ctype.h>
/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
-#include "wchar--.h"
+#include <wchar.h>
/* Get iswcntrl(). */
#include <wctype.h>
diff --git a/contrib/tools/bison/lib/obstack.c b/contrib/tools/bison/lib/obstack.c
index 9b2883e4ac..d915449def 100644
--- a/contrib/tools/bison/lib/obstack.c
+++ b/contrib/tools/bison/lib/obstack.c
@@ -143,7 +143,7 @@ _obstack_begin (struct obstack *h,
void *(*chunkfun) (long),
void (*freefun) (void *))
{
- struct _obstack_chunk *chunk; /* points to new chunk */
+ register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
@@ -190,7 +190,7 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
void (*freefun) (void *, void *),
void *arg)
{
- struct _obstack_chunk *chunk; /* points to new chunk */
+ register struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
@@ -241,11 +241,11 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
void
_obstack_newchunk (struct obstack *h, int length)
{
- struct _obstack_chunk *old_chunk = h->chunk;
- struct _obstack_chunk *new_chunk;
- long new_size;
- long obj_size = h->next_free - h->object_base;
- long i;
+ register struct _obstack_chunk *old_chunk = h->chunk;
+ register struct _obstack_chunk *new_chunk;
+ register long new_size;
+ register long obj_size = h->next_free - h->object_base;
+ register long i;
long already;
char *object_base;
@@ -318,8 +318,8 @@ int _obstack_allocated_p (struct obstack *h, void *obj);
int
_obstack_allocated_p (struct obstack *h, void *obj)
{
- struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- struct _obstack_chunk *plp; /* point to previous chunk if any */
+ register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
+ register struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = (h)->chunk;
/* We use >= rather than > since the object cannot be exactly at
@@ -341,8 +341,8 @@ _obstack_allocated_p (struct obstack *h, void *obj)
void
__obstack_free (struct obstack *h, void *obj)
{
- struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- struct _obstack_chunk *plp; /* point to previous chunk if any */
+ register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
+ register struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = h->chunk;
/* We use >= because there cannot be an object at the beginning of a chunk.
@@ -377,8 +377,8 @@ strong_alias (obstack_free, _obstack_free)
int
_obstack_memory_used (struct obstack *h)
{
- struct _obstack_chunk* lp;
- int nbytes = 0;
+ register struct _obstack_chunk* lp;
+ register int nbytes = 0;
for (lp = h->chunk; lp != 0; lp = lp->prev)
{
diff --git a/contrib/tools/bison/lib/stpcpy.c b/contrib/tools/bison/lib/stpcpy.c
index f5aa8d67e9..01b70c3b79 100644
--- a/contrib/tools/bison/lib/stpcpy.c
+++ b/contrib/tools/bison/lib/stpcpy.c
@@ -21,7 +21,6 @@
#include <config.h>
#include <string.h>
-#include <stdlib.h>
#undef __stpcpy
#if defined(_LIBC) || (defined(__MACH__) && defined(stpcpy))
@@ -36,8 +35,8 @@
char *
__stpcpy (char *dest, const char *src)
{
- char *d = dest;
- const char *s = src;
+ register char *d = dest;
+ register const char *s = src;
do
*d++ = *s;
diff --git a/contrib/tools/bison/lib/wchar--.h b/contrib/tools/bison/lib/wchar--.h
deleted file mode 100644
index 41751e00ac..0000000000
--- a/contrib/tools/bison/lib/wchar--.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-#include <wchar.h>
-
-#if defined(_WIN32)
-int wcwidth(wchar_t c);
-#endif
diff --git a/contrib/tools/bison/src/AnnotationList.c b/contrib/tools/bison/src/AnnotationList.c
index b5781766a4..b14c675b8f 100644
--- a/contrib/tools/bison/src/AnnotationList.c
+++ b/contrib/tools/bison/src/AnnotationList.c
@@ -228,15 +228,14 @@ AnnotationList__computePredecessorAnnotations (AnnotationList *self, state *s,
*annotations_obstackp)
{
state **predecessor;
- bitset *lookaheads;
for (predecessor = predecessors[s->number]; *predecessor; ++predecessor)
{
AnnotationList *annotation_node =
AnnotationList__alloc_on_obstack (
self->inadequacyNode->contributionCount, annotations_obstackp);
- bool potential_contribution = false;
annotation_node->inadequacyNode = self->inadequacyNode;
- lookaheads = NULL;
+ bool potential_contribution = false;
+ bitset *lookaheads = NULL;
{
ContributionIndex ci;
for (ci = 0; ci < self->inadequacyNode->contributionCount; ++ci)
diff --git a/contrib/tools/bison/src/muscle-tab.c b/contrib/tools/bison/src/muscle-tab.c
index ca63ed21ad..cc5d01dffa 100644
--- a/contrib/tools/bison/src/muscle-tab.c
+++ b/contrib/tools/bison/src/muscle-tab.c
@@ -70,9 +70,9 @@ static uniqstr
muscle_name (char const *var, char const *field)
{
if (field)
- return uniqstr_vsprintf("percent_define_%s(%s)", field, var);
+ return UNIQSTR_CONCAT ("percent_define_", field, "(", var, ")");
else
- return uniqstr_vsprintf("percent_define(%s)", var);
+ return UNIQSTR_CONCAT ("percent_define(", var, ")");
}
/* An obstack used to create some entries. */
@@ -459,8 +459,6 @@ muscle_percent_variable_update (char const *variable, location variable_loc,
{ NULL, NULL, }
};
conversion_type const *c;
- char* res;
- char* eq2;
for (c = conversion; c->obsolete; ++c)
{
char const *eq = strchr (c->obsolete, '=');
@@ -474,9 +472,9 @@ muscle_percent_variable_update (char const *variable, location variable_loc,
deprecated_directive (&variable_loc, old, upd);
free (old);
free (upd);
- res = xstrdup (c->updated);
+ char *res = xstrdup (c->updated);
{
- eq2 = strchr (res, '=');
+ char *eq2 = strchr (res, '=');
if (eq2)
{
*eq2 = '\0';
@@ -502,7 +500,6 @@ muscle_percent_define_insert (char const *var, location variable_loc,
uniqstr syncline_name = muscle_name (variable, "syncline");
uniqstr how_name = muscle_name (variable, "how");
uniqstr kind_name = muscle_name (variable, "kind");
- location loc;
/* Command-line options are processed before the grammar file. */
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
@@ -516,7 +513,7 @@ muscle_percent_define_insert (char const *var, location variable_loc,
_("%%define variable %s redefined"),
quote (variable));
i += SUB_INDENT;
- loc = muscle_percent_define_get_loc (variable);
+ location loc = muscle_percent_define_get_loc (variable);
complain_indent (&loc, complaint, &i, _("previous definition"));
}
@@ -648,7 +645,6 @@ muscle_percent_define_flag_if (char const *variable)
{
uniqstr invalid_boolean_name = muscle_name (variable, "invalid_boolean");
bool result = false;
- location loc;
if (muscle_percent_define_ifdef (variable))
{
@@ -661,7 +657,7 @@ muscle_percent_define_flag_if (char const *variable)
else if (!muscle_find_const (invalid_boolean_name))
{
muscle_insert (invalid_boolean_name, "");
- loc = muscle_percent_define_get_loc (variable);
+ location loc = muscle_percent_define_get_loc (variable);
complain (&loc, complaint,
_("invalid value for %%define Boolean variable %s"),
quote (variable));
@@ -741,7 +737,7 @@ void
muscle_percent_code_grow (char const *qualifier, location qualifier_loc,
char const *code, location code_loc)
{
- char const *name = uniqstr_vsprintf("percent_code(%s)", qualifier);
+ char const *name = UNIQSTR_CONCAT ("percent_code(", qualifier, ")");
muscle_code_grow (name, code, code_loc);
muscle_user_name_list_grow ("percent_code_user_qualifiers", qualifier,
qualifier_loc);
diff --git a/contrib/tools/bison/src/print-xml.c b/contrib/tools/bison/src/print-xml.c
index c30da729db..e5c25c544f 100644
--- a/contrib/tools/bison/src/print-xml.c
+++ b/contrib/tools/bison/src/print-xml.c
@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-#include "string--.h"
#include "system.h"
#include <stdarg.h>
diff --git a/contrib/tools/bison/src/scan-gram.c b/contrib/tools/bison/src/scan-gram.c
index 3c74a56bea..6c215ea7a7 100644
--- a/contrib/tools/bison/src/scan-gram.c
+++ b/contrib/tools/bison/src/scan-gram.c
@@ -3949,10 +3949,9 @@ static void
unexpected_end (boundary start, char const *msgid, char const *token_end)
{
location loc;
- size_t i;
loc.start = start;
loc.end = scanner_cursor;
- i = strlen (token_end);
+ size_t i = strlen (token_end);
/* Adjust scanner cursor so that any later message does not count
the characters about to be inserted. */
diff --git a/contrib/tools/bison/src/symlist.c b/contrib/tools/bison/src/symlist.c
index 531ec52fb8..50915c18bd 100644
--- a/contrib/tools/bison/src/symlist.c
+++ b/contrib/tools/bison/src/symlist.c
@@ -121,10 +121,9 @@ symbol_list_prepend (symbol_list *list, symbol_list *node)
symbol_list *
symbol_list_append (symbol_list *list, symbol_list *node)
{
- symbol_list* next;
if (!list)
return node;
- next = list;
+ symbol_list *next = list;
while (next->next)
next = next->next;
next->next = node;
diff --git a/contrib/tools/bison/src/symtab.c b/contrib/tools/bison/src/symtab.c
index c06fcd2621..c50a98a7c3 100644
--- a/contrib/tools/bison/src/symtab.c
+++ b/contrib/tools/bison/src/symtab.c
@@ -1000,12 +1000,11 @@ static void
init_prec_nodes (void)
{
int i;
- symgraph* s;
prec_nodes = xcalloc (nsyms, sizeof *prec_nodes);
for (i = 0; i < nsyms; ++i)
{
prec_nodes[i] = xmalloc (sizeof *prec_nodes[i]);
- s = prec_nodes[i];
+ symgraph *s = prec_nodes[i];
s->id = i;
s->succ = 0;
s->pred = 0;