* doc/bison.texinfo: Space change.
* src/system.h (STREQ, STRNEQ): New.
* src/files.c, src/ielr.c, src/lalr.c, src/muscle-tab.c,
* src/output.c, src/print.c, src/print_graph.c,
* src/reader.c, src/scan-skel.l, src/tables.c,
* src/uniqstr.c:
Use them.
* src/scan-gram.l: Do not use streq.h, use system.h's STREQ.
* cfg.mk: The documentation is an exception.
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
sc_immutable_NEWS \
- sc_prohibit_always_true_header_tests \
- sc_prohibit_atoi_atof \
- sc_prohibit_strcmp
+ sc_prohibit_atoi_atof
# The local directory containing the checked-out copy of gnulib used in
# this release. Used solely to get a date for the "announcement" target.
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \
+ prohibit_strcmp=^doc/bison\.texinfo$$ \
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
space_tab=^tests/(input|c\+\+)\.at$$ \
unmarked_diagnostics=^djgpp/ \
symrec *ptr;
for (ptr = sym_table; ptr != (symrec *) 0;
ptr = (symrec *)ptr->next)
- if (strcmp (ptr->name,sym_name) == 0)
+ if (strcmp (ptr->name, sym_name) == 0)
return ptr;
return 0;
@}
static void
compute_exts_from_gf (const char *ext)
{
- if (strcmp (ext, ".y") == 0)
+ if (STREQ (ext, ".y"))
{
src_extension = xstrdup (language->src_extension);
header_extension = xstrdup (language->header_extension);
output_file_name_check (char **file_name)
{
bool conflict = false;
- if (0 == strcmp (*file_name, grammar_file))
+ if (STREQ (*file_name, grammar_file))
{
complain (_("refusing to overwrite the input file %s"),
quote (*file_name));
{
int i;
for (i = 0; i < file_names_count; i++)
- if (0 == strcmp (file_names[i], *file_name))
+ if (STREQ (file_names[i], *file_name))
{
warn (_("conflicting outputs to file %s"),
quote (*file_name));
/* Examine user options. */
{
char *type = muscle_percent_define_get ("lr.type");
- if (0 == strcmp (type, "lalr"))
+ if (STREQ (type, "lalr"))
lr_type = LR_TYPE__LALR;
- else if (0 == strcmp (type, "ielr"))
+ else if (STREQ (type, "ielr"))
lr_type = LR_TYPE__IELR;
- else if (0 == strcmp (type, "canonical-lr"))
+ else if (STREQ (type, "canonical-lr"))
lr_type = LR_TYPE__CANONICAL_LR;
else
aver (false);
{
char *default_reductions =
muscle_percent_define_get ("lr.default-reductions");
- default_reduction_only_for_accept =
- 0 == strcmp (default_reductions, "accepting");
+ default_reduction_only_for_accept = STREQ (default_reductions, "accepting");
free (default_reductions);
}
{
muscle_entry const *m1 = x;
muscle_entry const *m2 = y;
- return strcmp (m1->key, m2->key) == 0;
+ return STREQ (m1->key, m2->key);
}
static size_t
};
int i;
for (i = 0; i < sizeof conversion / sizeof *conversion; ++i)
- if (!strcmp (conversion[i].obsolete, variable))
+ if (STREQ (conversion[i].obsolete, variable))
return conversion[i].updated;
return variable;
}
if (muscle_percent_define_ifdef (variable))
{
char *value = muscle_percent_define_get (variable);
- if (value[0] == '\0' || 0 == strcmp (value, "true"))
+ if (value[0] == '\0' || STREQ (value, "true"))
result = true;
- else if (0 == strcmp (value, "false"))
+ else if (STREQ (value, "false"))
result = false;
else if (!muscle_find_const (invalid_boolean_name))
{
{
for (++values; *values; ++values)
{
- if (0 == strcmp (value, *values))
+ if (STREQ (value, *values))
break;
}
if (!*values)
bool use_push_for_pull_flag = false;
if (use_push_for_pull_env != NULL
&& use_push_for_pull_env[0] != '\0'
- && 0 != strcmp (use_push_for_pull_env, "0"))
+ && STRNEQ (use_push_for_pull_env, "0"))
use_push_for_pull_flag = true;
/* Flags. */
char *default_reductions =
muscle_percent_define_get ("lr.default-reductions");
print_reduction (out, width, _("$default"), default_reduction, true);
- aver (0 == strcmp (default_reductions, "most")
- || (0 == strcmp (default_reductions, "consistent")
+ aver (STREQ (default_reductions, "most")
+ || (STREQ (default_reductions, "consistent")
&& default_reduction_only)
|| (reds->num == 1 && reds->rules[0]->number == 0));
free (default_reductions);
: "dashed");
if (TRANSITION_IS_ERROR (trans, i)
- && strcmp (symbols[sym]->tag, "error") != 0)
+ && STRNEQ (symbols[sym]->tag, "error"))
abort ();
output_edge (s->number, s1->number,
TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag,
default. */
muscle_percent_define_default ("lr.type", "lalr");
lr_type = muscle_percent_define_get ("lr.type");
- if (0 != strcmp (lr_type, "canonical-lr"))
+ if (STRNEQ (lr_type, "canonical-lr"))
muscle_percent_define_default ("lr.default-reductions", "most");
else
muscle_percent_define_default ("lr.default-reductions", "accepting");
#include <ctype.h>
#include <mbswidth.h>
#include <quote.h>
-#include <streq.h>
#include <src/scan-gram.h>
loc.end = scanner_cursor;
token_end = quote (token_end);
// Instead of '\'', display "'".
- if (STREQ (token_end, "'\\''", '\'', '\\', '\'', '\'', 0,0,0,0,0))
+ if (STREQ (token_end, "'\\''"))
token_end = "\"'\"";
complain_at (loc, _(msgid), token_end);
}
char *at_directive_argv[],
char **outnamep, int *out_linenop)
{
- if (0 == strcmp (at_directive_argv[0], "@basename"))
+ if (STREQ (at_directive_argv[0], "@basename"))
{
if (at_directive_argc > 2)
fail_for_at_directive_too_many_args (at_directive_argv[0]);
fputs (last_component (at_directive_argv[1]), yyout);
}
- else if (0 == strcmp (at_directive_argv[0], "@warn")
- || 0 == strcmp (at_directive_argv[0], "@complain")
- || 0 == strcmp (at_directive_argv[0], "@fatal"))
+ else if (STREQ (at_directive_argv[0], "@warn")
+ || STREQ (at_directive_argv[0], "@complain")
+ || STREQ (at_directive_argv[0], "@fatal"))
{
void (*func)(char const *, ...);
switch (at_directive_argv[0][1])
break;
}
}
- else if (0 == strcmp (at_directive_argv[0], "@warn_at")
- || 0 == strcmp (at_directive_argv[0], "@complain_at")
- || 0 == strcmp (at_directive_argv[0], "@fatal_at"))
+ else if (STREQ (at_directive_argv[0], "@warn_at")
+ || STREQ (at_directive_argv[0], "@complain_at")
+ || STREQ (at_directive_argv[0], "@fatal_at"))
{
void (*func)(location, char const *, ...);
location loc;
break;
}
}
- else if (0 == strcmp (at_directive_argv[0], "@output"))
+ else if (STREQ (at_directive_argv[0], "@output"))
{
if (at_directive_argc > 2)
fail_for_at_directive_too_many_args (at_directive_argv[0]);
#include <stdlib.h>
#include <string.h>
+#define STREQ(L, R) (strcmp(L, R) == 0)
+#define STRNEQ(L, R) (!STREQ(L, R))
+
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
{
char *default_reductions =
muscle_percent_define_get ("lr.default-reductions");
- if (0 != strcmp (default_reductions, "most") && !s->consistent)
+ if (STRNEQ (default_reductions, "most") && !s->consistent)
nodefault = true;
free (default_reductions);
}
static bool
hash_compare_uniqstr (void const *m1, void const *m2)
{
- return strcmp (m1, m2) == 0;
+ return STREQ (m1, m2);
}
static size_t