hughsie / colord

Making color management just work

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build failure with stricter C compilers (e.g. GCC 14)

thesamesam opened this issue · comments

Modern C compilers are becoming stricter with a variety of changes over the last year or so.

GCC 14 in particular (to be released in ~April 2024) fails to build colord-1.4.6 like:

../colord-1.4.6/lib/colord/cd-icc.c: In function ‘cd_icc_save_data’:
../colord-1.4.6/lib/colord/cd-icc.c:1723:32: error: passing argument 1 of ‘gmtime_r’ from incompatible pointer type [-Wincompatible-pointer-types]
 1723 |                 if (!gmtime_r (&priv->creation_time, &creation_time)) {
      |                                ^~~~~~~~~~~~~~~~~~~~
      |                                |
      |                                gint64 * {aka long long int *}
In file included from /usr/include/glib-2.0/glib/gtypes.h:41,
                 from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32,
                 from ../colord-1.4.6/lib/colord/cd-icc.c:30:
/usr/include/time.h:155:54: note: expected ‘const time_t * restrict’ {aka ‘const long int * restrict’} but argument is of type ‘gint64 *’ {aka ‘long long int *’}
  155 | extern struct tm *gmtime_r (const time_t *__restrict __timer,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

Originally reported downstream in Gentoo at https://bugs.gentoo.org/918990.

This can be emulated with -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion on an older GCC or Clang.

What's the fix?

PR in a min