mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
Pacify -DGNULIB_POSIXCHECK.
* bootstrap.conf (gnulib_modules): Add all modules suggested by -DGNULIB_POSIXCHECK. * src/files.c (file_name_split) * src/getargs.c (getargs) * src/location.c (boundary_set_from_string) * src/output.c (token_definitions_output, output_skeleton) * src/parse-gram.y (prologue_declaration) * src/scan-gram.l (handle_syncline) * src/symtab.c (symbol_new): Use mbschr and mbsrchr instead of strchr and strrchr. In the cases of command-line options, file names, and thus locations, functionality may be improved. In the case of symbol names, there should be no functional difference as all characters are ASCII, so the intended benefit is just warning suppression.
This commit is contained in:
@@ -205,7 +205,7 @@ file_name_split (const char *file_name,
|
||||
*base = last_component (file_name);
|
||||
|
||||
/* Look for the extension, i.e., look for the last dot. */
|
||||
*ext = strrchr (*base, '.');
|
||||
*ext = mbsrchr (*base, '.');
|
||||
*tab = NULL;
|
||||
|
||||
/* If there is an extension, check if there is a `.tab' part right
|
||||
|
||||
@@ -562,7 +562,7 @@ getargs (int argc, char *argv[])
|
||||
case 'F': /* -FNAME[=VALUE]. */
|
||||
{
|
||||
char* name = optarg;
|
||||
char* value = strchr (optarg, '=');
|
||||
char* value = mbschr (optarg, '=');
|
||||
if (value)
|
||||
*value++ = 0;
|
||||
muscle_percent_define_insert (name, command_line_location (),
|
||||
|
||||
@@ -143,11 +143,11 @@ boundary_set_from_string (boundary *bound, char *loc_str)
|
||||
{
|
||||
/* Must search in reverse since the file name field may
|
||||
* contain `.' or `:'. */
|
||||
char *delim = strrchr (loc_str, '.');
|
||||
char *delim = mbsrchr (loc_str, '.');
|
||||
aver (delim);
|
||||
*delim = '\0';
|
||||
bound->column = atoi (delim+1);
|
||||
delim = strrchr (loc_str, ':');
|
||||
delim = mbsrchr (loc_str, ':');
|
||||
aver (delim);
|
||||
*delim = '\0';
|
||||
bound->line = atoi (delim+1);
|
||||
|
||||
@@ -367,9 +367,9 @@ token_definitions_output (FILE *out)
|
||||
|
||||
/* Don't #define nonliteral tokens whose names contain periods,
|
||||
dashes or '$' (as does the default value of the EOF token). */
|
||||
if (strchr (sym->tag, '.')
|
||||
|| strchr (sym->tag, '-')
|
||||
|| strchr (sym->tag, '$'))
|
||||
if (mbschr (sym->tag, '.')
|
||||
|| mbschr (sym->tag, '-')
|
||||
|| mbschr (sym->tag, '$'))
|
||||
continue;
|
||||
|
||||
fprintf (out, "%s[[[%s]], %d]",
|
||||
@@ -518,7 +518,7 @@ output_skeleton (void)
|
||||
full_m4sugar = xstrdup (full_skeleton);
|
||||
strcpy (full_skeleton + pkgdatadirlen + 1, m4bison);
|
||||
full_m4bison = xstrdup (full_skeleton);
|
||||
if (strchr (skeleton, '/'))
|
||||
if (mbschr (skeleton, '/'))
|
||||
strcpy (full_skeleton, skeleton);
|
||||
else
|
||||
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 2.4.1.287-8f46. */
|
||||
/* A Bison parser, made by GNU Bison 2.4.1.302-e8fa. */
|
||||
|
||||
/* Bison implementation for Yacc-like parsers in C
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#define YYBISON 1
|
||||
|
||||
/* Bison version. */
|
||||
#define YYBISON_VERSION "2.4.1.287-8f46"
|
||||
#define YYBISON_VERSION "2.4.1.302-e8fa"
|
||||
|
||||
/* Skeleton name. */
|
||||
#define YYSKELETON_NAME "yacc.c"
|
||||
@@ -2410,7 +2410,7 @@ yyreduce:
|
||||
#line 311 "parse-gram.y"
|
||||
{
|
||||
char const *skeleton_user = (yyvsp[(2) - (2)].chars);
|
||||
if (strchr (skeleton_user, '/'))
|
||||
if (mbschr (skeleton_user, '/'))
|
||||
{
|
||||
size_t dir_length = strlen (current_file);
|
||||
char *skeleton_build;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 2.4.1.287-8f46. */
|
||||
/* A Bison parser, made by GNU Bison 2.4.1.302-e8fa. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
|
||||
@@ -310,7 +310,7 @@ prologue_declaration:
|
||||
| "%skeleton" STRING
|
||||
{
|
||||
char const *skeleton_user = $2;
|
||||
if (strchr (skeleton_user, '/'))
|
||||
if (mbschr (skeleton_user, '/'))
|
||||
{
|
||||
size_t dir_length = strlen (current_file);
|
||||
char *skeleton_build;
|
||||
|
||||
@@ -848,8 +848,8 @@ handle_syncline (char *args, location loc)
|
||||
{
|
||||
char *after_num;
|
||||
unsigned long int lineno = strtoul (args, &after_num, 10);
|
||||
char *file = strchr (after_num, '"') + 1;
|
||||
*strchr (file, '"') = '\0';
|
||||
char *file = mbschr (after_num, '"') + 1;
|
||||
*mbschr (file, '"') = '\0';
|
||||
if (INT_MAX <= lineno)
|
||||
{
|
||||
warn_at (loc, _("line number overflow"));
|
||||
|
||||
@@ -68,7 +68,7 @@ symbol_new (uniqstr tag, location loc)
|
||||
|
||||
/* If the tag is not a string (starts with a double quote), check
|
||||
that it is valid for Yacc. */
|
||||
if (tag[0] != '\"' && tag[0] != '\'' && strchr (tag, '-'))
|
||||
if (tag[0] != '\"' && tag[0] != '\'' && mbschr (tag, '-'))
|
||||
yacc_at (loc, _("POSIX Yacc forbids dashes in symbol names: %s"),
|
||||
tag);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user