bug-gnulib
[Top][All Lists]
Advanced

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

Re: Problem compiling glob.c with MinGW


From: Eli Zaretskii
Subject: Re: Problem compiling glob.c with MinGW
Date: Sat, 12 May 2018 16:02:41 +0300

> From: Bruno Haible <address@hidden>
> Cc: Tim Rühsen <address@hidden>
> Date: Sat, 12 May 2018 14:18:36 +0200
> 
> >        CC       glob.lo
> >      glob.c: In function 'glob_in_dir':
> >      glob.c:1331:32: warning: case label value exceeds maximum value for 
> > type
> >                     case DT_DIR: case DT_LNK: case DT_UNKNOWN: break;
> >                                  ^~~~
> > 
> > This is because glob.c unconditionally defines dirent_type data
> > type as follows:
> > 
> >   typedef uint_fast8_t dirent_type;
> > 
> > But if system header dirent.h is found to define the d_type member of
> > struct dirent, the type should be the same as for d_type, or at least
> > as wide as that of d_type, otherwise the DT_* constants, which come
> > from dirent.h, might be outside the valid range of values for unsigned
> > char.
> 
> The comments in 
> https://sourceforge.net/p/mingw/mingw-org-wsl/ci/5.1-trunk/tree/mingwrt/include/dirent.h#l137
> say that these d_type values >= 0x100 "will never" be assigned by
> the opendir()/readdir() implementation. So, since these values actually
> never occur, the warning is harmless.

"Never" is a very long time.  Windows does support links, and someone
might actually make readdir return that value.

So I think it would be better to avoid the warning.



reply via email to

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