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 (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.
(cherry picked from commit d143e9c33f)

Conflicts:

	src/output.c
	src/parse-gram.c
	src/parse-gram.h
This commit is contained in:
Joel E. Denny
2011-05-01 12:25:31 -04:00
parent 7262f54fea
commit ba60c39547
12 changed files with 63 additions and 17 deletions

View File

@@ -1,3 +1,21 @@
2011-05-01 Joel E. Denny <joeldenny@joeldenny.org>
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 (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 <joeldenny@joeldenny.org> 2011-05-01 Joel E. Denny <joeldenny@joeldenny.org>
* NEWS (2.5): Fix minor typos. * NEWS (2.5): Fix minor typos.

View File

@@ -17,13 +17,14 @@
# gnulib modules used by this package. # gnulib modules used by this package.
gnulib_modules=' gnulib_modules='
announce-gen argmatch assert config-h c-strcase configmake dirname announce-gen argmatch assert calloc-posix close config-h c-strcase
error extensions fopen-safer gendocs getopt-gnu gettext configmake dirname error extensions fopen-safer gendocs getopt-gnu
git-version-gen hash inttypes javacomp-script javaexec-script gettext git-version-gen hash inttypes isnan javacomp-script
maintainer-makefile malloc-gnu mbswidth obstack quote quotearg javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr
realloc-posix spawn-pipe stdbool stpcpy strerror strtoul strverscmp unistd mbswidth obstack perror pipe-posix quote quotearg realloc-posix
unistd-safer unlocked-io update-copyright unsetenv verify warnings spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
xalloc xalloc-die xstrndup unistd unistd-safer unlocked-io update-copyright unsetenv verify
warnings xalloc xalloc-die xstrndup
fprintf-posix printf-posix snprintf-posix sprintf-posix fprintf-posix printf-posix snprintf-posix sprintf-posix
vsnprintf-posix vsprintf-posix vsnprintf-posix vsprintf-posix

17
lib/.gitignore vendored
View File

@@ -24,9 +24,13 @@
/c-strcase.h /c-strcase.h
/c-strcasecmp.c /c-strcasecmp.c
/c-strncasecmp.c /c-strncasecmp.c
/calloc.c
/charset.alias /charset.alias
/cloexec.c /cloexec.c
/cloexec.h /cloexec.h
/close-hook.c
/close-hook.h
/close.c
/config.charset /config.charset
/config.h /config.h
/config.hin /config.hin
@@ -46,6 +50,7 @@
/exitfail.h /exitfail.h
/fatal-signal.c /fatal-signal.c
/fatal-signal.h /fatal-signal.h
/fclose.c
/fcntl.c /fcntl.c
/fcntl.h /fcntl.h
/fcntl.in.h /fcntl.in.h
@@ -83,15 +88,22 @@
/isnanf.c /isnanf.c
/isnanl-nolibm.h /isnanl-nolibm.h
/isnanl.c /isnanl.c
/iswblank.c
/ldexpl.c
/localcharset.c /localcharset.c
/localcharset.h /localcharset.h
/malloc.c /malloc.c
/math.h /math.h
/math.in.h /math.in.h
/mbchar.c
/mbchar.h
/mbrtowc.c /mbrtowc.c
/mbschr.c
/mbsinit.c /mbsinit.c
/mbsrchr.c
/mbswidth.c /mbswidth.c
/mbswidth.h /mbswidth.h
/mbuiter.h
/memchr.c /memchr.c
/memchr.valgrind /memchr.valgrind
/nonblocking.c /nonblocking.c
@@ -99,7 +111,9 @@
/obstack.c /obstack.c
/obstack.h /obstack.h
/open.c /open.c
/perror.c
/pipe-safer.c /pipe-safer.c
/pipe.c
/pipe2-safer.c /pipe2-safer.c
/pipe2.c /pipe2.c
/printf-args.c /printf-args.c
@@ -170,6 +184,7 @@
/stpcpy.c /stpcpy.c
/strchrnul.c /strchrnul.c
/strchrnul.valgrind /strchrnul.valgrind
/strdup.c
/streq.h /streq.h
/strerror.c /strerror.c
/string.h /string.h
@@ -177,6 +192,8 @@
/stripslash.c /stripslash.c
/strndup.c /strndup.c
/strnlen.c /strnlen.c
/strnlen1.c
/strnlen1.h
/strtol.c /strtol.c
/strtoul.c /strtoul.c
/strverscmp.c /strverscmp.c

10
m4/.gitignore vendored
View File

@@ -4,7 +4,9 @@
/argmatch.m4 /argmatch.m4
/asm-underscore.m4 /asm-underscore.m4
/assert.m4 /assert.m4
/calloc.m4
/cloexec.m4 /cloexec.m4
/close.m4
/codeset.m4 /codeset.m4
/config-h.m4 /config-h.m4
/configmake.m4 /configmake.m4
@@ -20,6 +22,7 @@
/exponentl.m4 /exponentl.m4
/extensions.m4 /extensions.m4
/fatal-signal.m4 /fatal-signal.m4
/fclose.m4
/fcntl-o.m4 /fcntl-o.m4
/fcntl.m4 /fcntl.m4
/fcntl_h.m4 /fcntl_h.m4
@@ -47,9 +50,11 @@
/inttypes.m4 /inttypes.m4
/inttypes_h.m4 /inttypes_h.m4
/ioctl.m4 /ioctl.m4
/isnan.m4
/isnand.m4 /isnand.m4
/isnanf.m4 /isnanf.m4
/isnanl.m4 /isnanl.m4
/iswblank.m4
/javacomp.m4 /javacomp.m4
/javaexec.m4 /javaexec.m4
/ldexpl.m4 /ldexpl.m4
@@ -64,6 +69,8 @@
/longlong.m4 /longlong.m4
/malloc.m4 /malloc.m4
/math_h.m4 /math_h.m4
/mbchar.m4
/mbiter.m4
/mbrtowc.m4 /mbrtowc.m4
/mbsinit.m4 /mbsinit.m4
/mbstate_t.m4 /mbstate_t.m4
@@ -75,6 +82,8 @@
/nls.m4 /nls.m4
/nocrash.m4 /nocrash.m4
/open.m4 /open.m4
/perror.m4
/pipe.m4
/pipe2.m4 /pipe2.m4
/po.m4 /po.m4
/posix_spawn.m4 /posix_spawn.m4
@@ -113,6 +122,7 @@
/stdlib_h.m4 /stdlib_h.m4
/stpcpy.m4 /stpcpy.m4
/strchrnul.m4 /strchrnul.m4
/strdup.m4
/strerror.m4 /strerror.m4
/string_h.m4 /string_h.m4
/strndup.m4 /strndup.m4

View File

@@ -205,7 +205,7 @@ file_name_split (const char *file_name,
*base = last_component (file_name); *base = last_component (file_name);
/* Look for the extension, i.e., look for the last dot. */ /* Look for the extension, i.e., look for the last dot. */
*ext = strrchr (*base, '.'); *ext = mbsrchr (*base, '.');
*tab = NULL; *tab = NULL;
/* If there is an extension, check if there is a `.tab' part right /* If there is an extension, check if there is a `.tab' part right

View File

@@ -559,7 +559,7 @@ getargs (int argc, char *argv[])
case 'F': /* -FNAME[=VALUE]. */ case 'F': /* -FNAME[=VALUE]. */
{ {
char* name = optarg; char* name = optarg;
char* value = strchr (optarg, '='); char* value = mbschr (optarg, '=');
if (value) if (value)
*value++ = 0; *value++ = 0;
muscle_percent_define_insert (name, command_line_location (), muscle_percent_define_insert (name, command_line_location (),

View File

@@ -143,11 +143,11 @@ boundary_set_from_string (boundary *bound, char *loc_str)
{ {
/* Must search in reverse since the file name field may /* Must search in reverse since the file name field may
* contain `.' or `:'. */ * contain `.' or `:'. */
char *delim = strrchr (loc_str, '.'); char *delim = mbsrchr (loc_str, '.');
aver (delim); aver (delim);
*delim = '\0'; *delim = '\0';
bound->column = atoi (delim+1); bound->column = atoi (delim+1);
delim = strrchr (loc_str, ':'); delim = mbsrchr (loc_str, ':');
aver (delim); aver (delim);
*delim = '\0'; *delim = '\0';
bound->line = atoi (delim+1); bound->line = atoi (delim+1);

View File

@@ -595,7 +595,7 @@ output_skeleton (void)
full_m4sugar = xstrdup (full_skeleton); full_m4sugar = xstrdup (full_skeleton);
strcpy (full_skeleton + pkgdatadirlen + 1, m4bison); strcpy (full_skeleton + pkgdatadirlen + 1, m4bison);
full_m4bison = xstrdup (full_skeleton); full_m4bison = xstrdup (full_skeleton);
if (strchr (skeleton, '/')) if (mbschr (skeleton, '/'))
strcpy (full_skeleton, skeleton); strcpy (full_skeleton, skeleton);
else else
strcpy (full_skeleton + pkgdatadirlen + 1, skeleton); strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);

View File

@@ -2422,7 +2422,7 @@ yyreduce:
#line 342 "src/parse-gram.y" #line 342 "src/parse-gram.y"
{ {
char const *skeleton_user = (yyvsp[0].chars); char const *skeleton_user = (yyvsp[0].chars);
if (strchr (skeleton_user, '/')) if (mbschr (skeleton_user, '/'))
{ {
size_t dir_length = strlen (current_file); size_t dir_length = strlen (current_file);
char *skeleton_build; char *skeleton_build;

View File

@@ -341,7 +341,7 @@ prologue_declaration:
| "%skeleton" STRING | "%skeleton" STRING
{ {
char const *skeleton_user = $2; char const *skeleton_user = $2;
if (strchr (skeleton_user, '/')) if (mbschr (skeleton_user, '/'))
{ {
size_t dir_length = strlen (current_file); size_t dir_length = strlen (current_file);
char *skeleton_build; char *skeleton_build;

View File

@@ -941,8 +941,8 @@ handle_syncline (char *args, location loc)
{ {
char *after_num; char *after_num;
unsigned long int lineno = strtoul (args, &after_num, 10); unsigned long int lineno = strtoul (args, &after_num, 10);
char *file = strchr (after_num, '"') + 1; char *file = mbschr (after_num, '"') + 1;
*strchr (file, '"') = '\0'; *mbschr (file, '"') = '\0';
if (INT_MAX <= lineno) if (INT_MAX <= lineno)
{ {
warn_at (loc, _("line number overflow")); warn_at (loc, _("line number overflow"));

View File

@@ -68,7 +68,7 @@ symbol_new (uniqstr tag, location loc)
/* If the tag is not a string (starts with a double quote), check /* If the tag is not a string (starts with a double quote), check
that it is valid for Yacc. */ 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"), yacc_at (loc, _("POSIX Yacc forbids dashes in symbol names: %s"),
tag); tag);