package: various fixes for syntax-check

* cfg.mk: Disable checks where needed (e.g., we do want to check the
behavior with tabs).
(sc_at_parser_check): Remove.  Unfortunately since
a11c144609 we no longer use the './'
prefix to run programs in the current directory.  That was so that we
could run Java programs like the other, although they are no run with
the `./` prefix (see 967a59d2c0).
As a consequence this sc check no longer makes sense.
However, since now AT_PARSER_CHECK passes the `./` prefix itself, this
sc-check was superfluous.
* examples/c/reccalc/scan.l: Use memcpy, not strncpy.
* src/ielr.c, src/reader.c: Obfuscate "lr(0)" so that the sc-check for
"space before paren" does not fire.
* tests/diagnostics.at: Avoid space-tab, use tab-tab.
This commit is contained in:
Akim Demaille
2019-04-27 19:11:59 +02:00
parent 33b246a624
commit 57290d63fd
7 changed files with 14 additions and 21 deletions

2
TODO
View File

@@ -105,7 +105,7 @@ Rename states1 as path, length as pathlen.
Introduce inline functions for things such as nullable[*rp - ntokens]
where we need to map from symbol number to nterm number.
There are probably a significant part of the the relations management that
There are probably a significant part of the relations management that
should be migrated on top of a bitsetv.
*** closure

21
cfg.mk
View File

@@ -60,18 +60,6 @@ update-copyright-env = \
## More syntax-checks. ##
## -------------------- ##
# At least for Mac OS X's grep, the order between . and [ in "[^.[]"
# matters:
# $ LC_ALL=fr_FR grep -nE '[^[.]' /dev/null
# $ LC_ALL=C grep -nE '[^[.]' /dev/null
# grep: invalid collating element or class
# $ LC_ALL=fr_FR grep -nE '[^.[]' /dev/null
# $ LC_ALL=C grep -nE '[^.[]' /dev/null
sc_at_parser_check:
@prohibit='AT_PARSER_CHECK\(\[+[^.[]|AT_CHECK\(\[+\./' \
halt='use AT_PARSER_CHECK for and only for generated parsers' \
$(_sc_search_regexp)
# Indent only with spaces.
# Taken from Coreutils.
sc_prohibit_tab_based_indentation:
@@ -156,11 +144,16 @@ sc_space_before_open_paren:
## syntax-checks exceptions. ##
## -------------------------- ##
# po-check: we use gnulib-po, so we don't need/want them in our POTFILE.
generated_files =
exclude = \
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
$(call exclude, \
bindtextdomain=^lib/main.c$$ \
cast_of_argument_to_free=^src/muscle-tab.c$$ \
po_check=^po/POTFILES.in$$ \
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
program_name=^lib/main.c$$ \
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
@@ -169,8 +162,8 @@ $(call exclude,
prohibit_doubled_word=^tests/named-refs.at$$ \
prohibit_magic_number_exit=^doc/bison.texi$$ \
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
prohibit_strcmp=^doc/bison\.texi|tests/local\.at$$ \
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|Makefile$$ \
prohibit_strcmp=^doc/bison\.texi|examples|tests/local\.at$$ \
prohibit_tab_based_indentation=install-icc.sh|\.(am|mk)$$|^\.git|tests/input.at|Makefile$$ \
require_config_h=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
require_config_h_first=^(lib/yyerror|data/skeletons/(glr|yacc))\.c$$ \
space_before_open_paren=^data/skeletons/ \

View File

@@ -87,7 +87,7 @@ main (int argc, char const* argv[])
{
/* Enable parse traces on option -p. */
for (int i = 1; i < argc; ++i)
if (!strcmp(argv[i], "-p"))
if (!strcmp (argv[i], "-p"))
yydebug = 1;
return yyparse ();
}

View File

@@ -30,7 +30,7 @@
while (capacity < size + yyleng + 1); \
str = realloc (str, capacity); \
} \
strncpy (str + size, yytext, yyleng); \
memcpy (str + size, yytext, yyleng); \
size += yyleng; \
assert (size < capacity); \
} while (0)

View File

@@ -50,7 +50,7 @@ lr_type_get (void)
{
char *type = muscle_percent_define_get ("lr.type");
LrType res;
if (STREQ (type, "lr(0)"))
if (STREQ (type, "lr""(0)"))
res = LR_TYPE__LR0;
else if (STREQ (type, "lalr"))
res = LR_TYPE__LALR;

View File

@@ -763,7 +763,7 @@ prepare_percent_define_front_end_variables (void)
{
static char const * const values[] =
{
"lr.type", "lr(0)", "lalr", "ielr", "canonical-lr", NULL,
"lr.type", "lr""(0)", "lalr", "ielr", "canonical-lr", NULL,
"lr.default-reduction", "most", "consistent", "accepting", NULL,
NULL
};

View File

@@ -223,13 +223,13 @@ input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option
AT_TEST([[Locations from M4]],
[[%define api.prefix {sun}
%define api.prefix {🌞}
%define api.prefix {🌞}
%%
exp:;
]],
[1],
[[input.y:10.1-35: <error>error:</error> %define variable 'api.prefix' redefined
10 | <error>%define api.prefix {🌞}</error>
10 | <error>%define api.prefix {🌞}</error>
| <error>^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</error>
input.y:9.1-37: previous definition
9 | <note>%define api.prefix {sun}</note>