I pushed this to branch-2.5 and master. >From d143e9c33f07e1a9966c10077f43e2f81232bf6c Mon Sep 17 00:00:00 2001 From: Joel E. Denny <[email protected]> Date: Sun, 1 May 2011 12:25:31 -0400 Subject: [PATCH] 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. --- ChangeLog | 18 ++++++++++++++++++ bootstrap.conf | 15 ++++++++------- lib/.gitignore | 17 +++++++++++++++++ m4/.gitignore | 10 ++++++++++ src/files.c | 2 +- src/getargs.c | 2 +- src/location.c | 4 ++-- src/output.c | 8 ++++---- src/parse-gram.c | 6 +++--- src/parse-gram.h | 2 +- src/parse-gram.y | 2 +- src/scan-gram.l | 4 ++-- src/symtab.c | 2 +- 13 files changed, 69 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index d85b7fd..3c846f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2011-05-01 Joel E. Denny <[email protected]> + 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. + +2011-05-01 Joel E. Denny <[email protected]> + * NEWS (2.5): Fix minor typos. 2011-05-01 Joel E. Denny <[email protected]> diff --git a/bootstrap.conf b/bootstrap.conf index d5a3399..bd274e1 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -17,13 +17,14 @@ # gnulib modules used by this package. gnulib_modules=' - announce-gen argmatch assert config-h c-strcase configmake dirname - error extensions fopen-safer gendocs getopt-gnu gettext - git-version-gen hash inttypes javacomp-script javaexec-script - maintainer-makefile malloc-gnu mbswidth obstack quote quotearg - realloc-posix spawn-pipe stdbool stpcpy strerror strtoul strverscmp unistd - unistd-safer unlocked-io update-copyright unsetenv verify warnings - xalloc xalloc-die xstrndup + announce-gen argmatch assert calloc-posix close config-h c-strcase + configmake dirname error extensions fopen-safer gendocs getopt-gnu + gettext git-version-gen hash inttypes isnan javacomp-script + javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr + mbswidth obstack perror pipe-posix quote quotearg realloc-posix + spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp + unistd unistd-safer unlocked-io update-copyright unsetenv verify + warnings xalloc xalloc-die xstrndup fprintf-posix printf-posix snprintf-posix sprintf-posix vsnprintf-posix vsprintf-posix diff --git a/lib/.gitignore b/lib/.gitignore index f3d5da6..45e0eb7 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -24,9 +24,13 @@ /c-strcase.h /c-strcasecmp.c /c-strncasecmp.c +/calloc.c /charset.alias /cloexec.c /cloexec.h +/close-hook.c +/close-hook.h +/close.c /config.charset /config.h /config.hin @@ -46,6 +50,7 @@ /exitfail.h /fatal-signal.c /fatal-signal.h +/fclose.c /fcntl.c /fcntl.h /fcntl.in.h @@ -83,15 +88,22 @@ /isnanf.c /isnanl-nolibm.h /isnanl.c +/iswblank.c +/ldexpl.c /localcharset.c /localcharset.h /malloc.c /math.h /math.in.h +/mbchar.c +/mbchar.h /mbrtowc.c +/mbschr.c /mbsinit.c +/mbsrchr.c /mbswidth.c /mbswidth.h +/mbuiter.h /memchr.c /memchr.valgrind /nonblocking.c @@ -99,7 +111,9 @@ /obstack.c /obstack.h /open.c +/perror.c /pipe-safer.c +/pipe.c /pipe2-safer.c /pipe2.c /printf-args.c @@ -170,6 +184,7 @@ /stpcpy.c /strchrnul.c /strchrnul.valgrind +/strdup.c /streq.h /strerror.c /string.h @@ -177,6 +192,8 @@ /stripslash.c /strndup.c /strnlen.c +/strnlen1.c +/strnlen1.h /strtol.c /strtoul.c /strverscmp.c diff --git a/m4/.gitignore b/m4/.gitignore index d7a4a8f..7d812eb 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -4,7 +4,9 @@ /argmatch.m4 /asm-underscore.m4 /assert.m4 +/calloc.m4 /cloexec.m4 +/close.m4 /codeset.m4 /config-h.m4 /configmake.m4 @@ -20,6 +22,7 @@ /exponentl.m4 /extensions.m4 /fatal-signal.m4 +/fclose.m4 /fcntl-o.m4 /fcntl.m4 /fcntl_h.m4 @@ -47,9 +50,11 @@ /inttypes.m4 /inttypes_h.m4 /ioctl.m4 +/isnan.m4 /isnand.m4 /isnanf.m4 /isnanl.m4 +/iswblank.m4 /javacomp.m4 /javaexec.m4 /ldexpl.m4 @@ -64,6 +69,8 @@ /longlong.m4 /malloc.m4 /math_h.m4 +/mbchar.m4 +/mbiter.m4 /mbrtowc.m4 /mbsinit.m4 /mbstate_t.m4 @@ -75,6 +82,8 @@ /nls.m4 /nocrash.m4 /open.m4 +/perror.m4 +/pipe.m4 /pipe2.m4 /po.m4 /posix_spawn.m4 @@ -113,6 +122,7 @@ /stdlib_h.m4 /stpcpy.m4 /strchrnul.m4 +/strdup.m4 /strerror.m4 /string_h.m4 /strndup.m4 diff --git a/src/files.c b/src/files.c index ba77053..c94d2c6 100644 --- a/src/files.c +++ b/src/files.c @@ -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 diff --git a/src/getargs.c b/src/getargs.c index e1298f3..1309b38 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -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 (), diff --git a/src/location.c b/src/location.c index 361418a..8f1b280 100644 --- a/src/location.c +++ b/src/location.c @@ -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); diff --git a/src/output.c b/src/output.c index 7f4ca64..420d137 100644 --- a/src/output.c +++ b/src/output.c @@ -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); diff --git a/src/parse-gram.c b/src/parse-gram.c index ee14f8c..6d01e0c 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -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; diff --git a/src/parse-gram.h b/src/parse-gram.h index c00f34f..0ddca48 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -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 diff --git a/src/parse-gram.y b/src/parse-gram.y index 8c2e18d..7c5ccd8 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -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; diff --git a/src/scan-gram.l b/src/scan-gram.l index 2f264f5..1995b94 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -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")); diff --git a/src/symtab.c b/src/symtab.c index 307af89..f9f78b3 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -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); -- 1.7.0.4
