[Fontconfig] clang warnings when building fontconfig git head

Thomas Klausner wiz at NetBSD.org
Tue Jun 25 08:15:45 PDT 2013


Hi!

When building the latest git version of fontconfig with clang-3.4
(trunk 182734) on NetBSD-6.99.22/amd64, I see a few warnings:

An out-of-range comparison:

  CC       fcname.lo
fcname.c:89:18: warning: comparison of constant 4294967295 with expression of type 'const FcType' (aka 'const enum _FcType') is always false [-Wtautological-constant-out-of-range-compare]
            if (t->type == (unsigned int) -1 || type == t->type)
                ~~~~~~~ ^  ~~~~~~~~~~~~~~~~~
1 warning generated.

A prototype mismatch with scandir:

  CC       fcstat.lo
fcstat.c:192:4: warning: incompatible pointer types passing 'int (*)(const struct dirent **, const struct dirent **)' to parameter of type 'int (*)(const void *, const void *)' [-Wincompatible-pointer-types]
                 &FcDirChecksumScandirSorter);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/dirent.h:112:43: note: passing argument to parameter here
    int (*)(const struct dirent *), int (*)(const void *, const void *))
                                          ^
1 warning generated.

On NetBSD, scandir is:
     int scandir(const char *dirname, struct dirent ***namelist,
     int (*select)(const struct dirent *), int (*compar)(const void *, const void *));


And a few warnings because the is* macros on NetBSD only accept EOF or
unsigned char. These are usually fixed by adding casts, i.e.
"isspace((unsigned char)foo)".

  GEN      fc-case
fc-case.c:217:10: warning: array subscript is of type 'char' [-Wchar-subscripts]
    if (!isxdigit (line[0]))
         ^~~~~~~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:58:45: note: expanded from macro 'isxdigit'
#define isxdigit(c)     ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_X))
                                                ^~~~
1 warning generated.

  GEN      fc-lang
fc-lang.c:90:23: warning: array subscript is of type 'char' [-Wchar-subscripts]
    while (line[0] && isspace (line[0]))
                      ^~~~~~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:56:44: note: expanded from macro 'isspace'
#define isspace(c)      ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_S))
                                                ^~~~
fc-lang.c:93:23: warning: array subscript is of type 'char' [-Wchar-subscripts]
    while (end > 0 && isspace (line[end-1]))
                      ^~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:56:44: note: expanded from macro 'isspace'
#define isspace(c)      ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_S))
                                                ^~~~
fc-lang.c:152:13: warning: array subscript is of type 'char' [-Wchar-subscripts]
            while (isspace(*included_file))
                   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/ctype_inline.h:56:44: note: expanded from macro 'isspace'
#define isspace(c)      ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_S))
                                                ^~~~
3 warnings generated.


Can you please fix these issues?

Thanks,
 Thomas


More information about the Fontconfig mailing list