This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/9] posix: Sync glob with gnulib [BZ #1062]



On 05/09/2017 23:01, Paul Eggert wrote:
> Adhemerval Zanella wrote:
>> +/* Any distinct values will do here.
>> +   Undef any existing macros out of the way.  */
>> +#ifndef DT_UNKNOWN
>> +# define DT_UNKNOWN 0
>> +#endif
>> +#ifndef DT_DIR
>> +# define DT_DIR 1
>> +#endif
>> +#ifndef DT_LNK
>> +# define DT_LNK 2
>> +#endif
> 
> The comment here does not match the code, as nothing is being undeffed. Instead of this change, how about the following?

Indeed, I forgot to update the comments after the fix.

> #if !defined _LIBC && !defined HAVE_STRUCT_DIRENT_D_TYPE
> /* Any distinct values will do here.
>    Undef any existing macros out of the way.  */
> # undef DT_UNKNOWN
> # undef DT_DIR
> # undef DT_LNK
> # define DT_UNKNOWN 0
> # define DT_DIR 1
> # define DT_LNK 2
> #endif
> 
> This makes it more clear to the casual reader that this code is for use only outside glibc. Also, it's more robust for hopefully only-hypothetical non-glibc platforms that define some DT_ symbols but not others, because it guarantees their uniqueness in that case. I installed the attached patch into Gnulib, along these lines.

I do not have a strong preference here, I am ok with your approach and I will
update my patch with this change. In fact I would prefer that all this 
boilerplate that is non required for glibc code to be on a specific header
(maybe glob-gnulib.h or something), but we can think about it later. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]