[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
package: various fixes for syntax-check
From: |
Akim Demaille |
Subject: |
package: various fixes for syntax-check |
Date: |
Sun, 28 Apr 2019 08:32:01 +0200 |
commit 57290d63fdde7c79d88570a02daa9abce4830f55
Author: Akim Demaille <address@hidden>
Date: Sat Apr 27 19:11:59 2019 +0200
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
a11c144609255bc6e42c2aff83548e91cbd05425 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 967a59d2c08a33f24708450561e2f8010b604523).
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.
diff --git a/TODO b/TODO
index 1d2fa03e..9fb8c922 100644
--- a/TODO
+++ b/TODO
@@ -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
diff --git a/cfg.mk b/cfg.mk
index effda66f..a4383fc8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -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/
\
diff --git a/examples/c/calc/calc.y b/examples/c/calc/calc.y
index f3a6cb1d..a9896e43 100644
--- a/examples/c/calc/calc.y
+++ b/examples/c/calc/calc.y
@@ -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 ();
}
diff --git a/examples/c/reccalc/scan.l b/examples/c/reccalc/scan.l
index 7cf0ceef..fbb781aa 100644
--- a/examples/c/reccalc/scan.l
+++ b/examples/c/reccalc/scan.l
@@ -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)
diff --git a/src/ielr.c b/src/ielr.c
index 11aa4d58..62df108e 100644
--- a/src/ielr.c
+++ b/src/ielr.c
@@ -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;
diff --git a/src/reader.c b/src/reader.c
index 32feb0dc..9d4d049d 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -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
};
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index 57f645a3..cc09ef8e 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- package: various fixes for syntax-check,
Akim Demaille <=