Skip to content
  • Bastien Nocera's avatar
    tests: Fix compilation errors due to Y2K format problems · 35bd6920
    Bastien Nocera authored
    Newer versions of GCC are particularly verbose in relation to
    formatting errors, use GCC pragmas to disable warnings for this
    section.
    
    gdatetime.c: In function ‘test_strftime’:
    gdatetime.c:1334:3: error: ‘%c’ yields only last 2 digits of year in some locales [-Werror=format-y2k]
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^
    gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gdatetime.c:1334:3: error: ‘%g’ yields only last 2 digits of year [-Werror=format-y2k]
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^
    gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gdatetime.c:1334:3: error: ‘%x’ yields only last 2 digits of year in some locales [-Werror=format-y2k]
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^
    gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    gdatetime.c:1334:3: error: ‘%y’ yields only last 2 digits of year [-Werror=format-y2k]
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^
    gdatetime.c:1334:3: note: in definition of macro ‘TEST_FORMAT’
       "a%a A%A b%b B%B c%c C%C d%d e%e F%F g%g G%G h%h H%H I%I j%j m%m M%M " \
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Note that the pragma is outside the function as older versions of GCC
    don't support pragma inside functions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764575
    35bd6920