glib-compile-resources: Limit string length with -std=c89 and -std=c99

When compiling with -Woverlength-strings, limits of 509 and 4095 bytes
are applied to string literals when compiling with C89 or C99
(respectively).

In order to avoid those warnings, fall back to the
non-string-literal-based format depending on the C standard in use and
the length of the string.

This will unfortunately make compilation slower again for large
GResources — it’s essentially a reversion of the string literal
improvements for most compilation situations.

That’s an unfortunate necessity, as glib-compile-resources can’t know
which compiler is going to be used, or which warning options are going
to be passed to it, when the generated C code is compiled.

The way to improve that would be to add an explicit command line
argument which allows the string literal limits to be bypassed if you
know your compiler can handle it (which most can). This could, for
example, be -Wno-overlength-strings, since that’s how you signal to a
compiler that you don’t care about string limits.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1711
8 jobs for 1711-resource-c99-string-length in 12 minutes and 16 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Build
passed #262612
cross-android_api21_arm64

00:02:02

passed #262613
cross-android_api28_arm64

00:02:03

passed #262614
cross-mingw64

00:02:27

passed #262610
fedora-x86_64

00:05:20

passed #262611
G_DISABLE_ASSERT

00:02:52

passed #262615
win32
msys2-mingw32

00:10:22

passed #262616
win32
vs2017-x64

00:09:29

 
  Coverage
passed #262617
coverage

00:01:54

74.8%