[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem compiling glob.c with MinGW
From: |
Bruno Haible |
Subject: |
Re: Problem compiling glob.c with MinGW |
Date: |
Sat, 12 May 2018 14:18:36 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; ) |
Eli Zaretskii wrote:
> Building the latest pretest of wget2 on MinGW produces the following
> warning:
>
> 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.
Bruno