bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: [PATCH] maint: use xconcatenated_filename


From: Akim Demaille
Subject: Re: RFC: [PATCH] maint: use xconcatenated_filename
Date: Fri, 25 May 2012 10:45:31 +0200

Le 25 mai 2012 à 09:49, Paul Eggert a écrit :

> On 05/25/2012 12:42 AM, Akim Demaille wrote:
>> you use mbschr to look for `/' in file names, whereas Bruno
>> uses strchr.
> 
> strchr is better for POSIX-like systems, since the
> kernel is coding-system agnostic.  So I'd go with strchr.

OK, thanks!  Actually I see also that you made efforts
to leave a single slash, even if DIR ended with many.
Is this aesthetics, or is there some semantical difference
that might result?

I checked all the other uses of mbschr, and they all seem
to be overkill.  They were introduced by:

+2011-05-01  Joel E. Denny  <address@hidden>
+
+       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.

So I tried to play with -DGNULIB_POSIXCHECK, and for instance I have:

In function 'output_skeleton',
    inlined from 'output' at ../../src/output.c:736:19:
../../src/output.c:583:13: error: call to 'strchr' declared with attribute 
warning: strchr cannot work correctly on character strings in some multibyte 
locales - use mbschr if you care about internationalization [-Werror]
../../src/output.c:642:11: error: call to 'fdopen' declared with attribute 
warning: fdopen on native Windows platforms is not POSIX compliant - use gnulib 
module fdopen for portability [-Werror]
../../src/output.c:653:11: error: call to 'fdopen' declared with attribute 
warning: fdopen on native Windows platforms is not POSIX compliant - use gnulib 
module fdopen for portability [-Werror]

where, of course, output.c:583 is:

>   char *skel =
>     IS_PATH_WITH_DIR (skeleton) ? xstrdup (skeleton)   /* <<<<<<<<<<<< */
>     :  xconcatenated_filename (datadir, skeleton, NULL);


I've had also warnings about fclose, and fflush.
Do you recommend turning -DGNULIB_POSIXCHECK on and
blindly obey to it to get a warning-free compilation?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]