mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
Merge branch 'th/meson-werror-fixes' into 'main'
[th/meson-werror-fixes] some fixes for meson detection failure with -Werror See merge request GNOME/glib!3895
This commit is contained in:
commit
8dee910d77
@ -86,6 +86,7 @@ int main()
|
|||||||
long double y = frexpl (x, &exp);
|
long double y = frexpl (x, &exp);
|
||||||
/* On machines with IEEE854 arithmetic: x = 1.68105e-4932,
|
/* On machines with IEEE854 arithmetic: x = 1.68105e-4932,
|
||||||
exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */
|
exp = -16382, y = 0.5. On Mac OS X 10.5: exp = -16384, y = 0.5. */
|
||||||
|
(void) y;
|
||||||
if (exp != LDBL_MIN_EXP - 1)
|
if (exp != LDBL_MIN_EXP - 1)
|
||||||
result |= 8;
|
result |= 8;
|
||||||
}
|
}
|
||||||
|
@ -16,27 +16,27 @@ static double zero = 0.0;
|
|||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
|
if (sprintf (buf, "%a %d", 3.1416015625, 33) < 0
|
||||||
|| (strcmp (buf, "0x1.922p+1 33") != 0
|
|| (strcmp (buf, "0x1.922p+1 33") != 0
|
||||||
&& strcmp (buf, "0x3.244p+0 33") != 0
|
&& strcmp (buf, "0x3.244p+0 33") != 0
|
||||||
&& strcmp (buf, "0x6.488p-1 33") != 0
|
&& strcmp (buf, "0x6.488p-1 33") != 0
|
||||||
&& strcmp (buf, "0xc.91p-2 33") != 0))
|
&& strcmp (buf, "0xc.91p-2 33") != 0))
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0
|
if (sprintf (buf, "%A %d", -3.1416015625, 33) < 0
|
||||||
|| (strcmp (buf, "-0X1.922P+1 33") != 0
|
|| (strcmp (buf, "-0X1.922P+1 33") != 0
|
||||||
&& strcmp (buf, "-0X3.244P+0 33") != 0
|
&& strcmp (buf, "-0X3.244P+0 33") != 0
|
||||||
&& strcmp (buf, "-0X6.488P-1 33") != 0
|
&& strcmp (buf, "-0X6.488P-1 33") != 0
|
||||||
&& strcmp (buf, "-0XC.91P-2 33") != 0))
|
&& strcmp (buf, "-0XC.91P-2 33") != 0))
|
||||||
result |= 2;
|
result |= 2;
|
||||||
/* This catches a FreeBSD 6.1 bug: it doesn't round. */
|
/* This catches a FreeBSD 6.1 bug: it doesn't round. */
|
||||||
if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
|
if (sprintf (buf, "%.2a %d", 1.51, 33) < 0
|
||||||
|| (strcmp (buf, "0x1.83p+0 33") != 0
|
|| (strcmp (buf, "0x1.83p+0 33") != 0
|
||||||
&& strcmp (buf, "0x3.05p-1 33") != 0
|
&& strcmp (buf, "0x3.05p-1 33") != 0
|
||||||
&& strcmp (buf, "0x6.0ap-2 33") != 0
|
&& strcmp (buf, "0x6.0ap-2 33") != 0
|
||||||
&& strcmp (buf, "0xc.14p-3 33") != 0))
|
&& strcmp (buf, "0xc.14p-3 33") != 0))
|
||||||
result |= 4;
|
result |= 4;
|
||||||
/* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */
|
/* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */
|
||||||
if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
|
if (sprintf (buf, "%.0a %d", 1.51, 33) < 0
|
||||||
|| (strcmp (buf, "0x2p+0 33") != 0
|
|| (strcmp (buf, "0x2p+0 33") != 0
|
||||||
&& strcmp (buf, "0x3p-1 33") != 0
|
&& strcmp (buf, "0x3p-1 33") != 0
|
||||||
&& strcmp (buf, "0x6p-2 33") != 0
|
&& strcmp (buf, "0x6p-2 33") != 0
|
||||||
@ -44,7 +44,7 @@ int main ()
|
|||||||
result |= 4;
|
result |= 4;
|
||||||
/* This catches a FreeBSD 6.1 bug. See
|
/* This catches a FreeBSD 6.1 bug. See
|
||||||
<https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
|
<https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
|
||||||
if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
|
if (sprintf (buf, "%010a %d", 1.0 / zero, 33) < 0
|
||||||
|| buf[0] == '0')
|
|| buf[0] == '0')
|
||||||
result |= 8;
|
result |= 8;
|
||||||
/* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */
|
/* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */
|
||||||
|
@ -23,14 +23,14 @@ int main ()
|
|||||||
/* On BeOS, this would crash and show a dialog box. Avoid the crash. */
|
/* On BeOS, this would crash and show a dialog box. Avoid the crash. */
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
|
if (sprintf (buf, "%.4000d %d", 1, 33) < 4000 + 3)
|
||||||
result |= 1;
|
result |= 1;
|
||||||
if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5)
|
if (sprintf (buf, "%.4000f %d", 1.0, 33) < 4000 + 5)
|
||||||
result |= 2;
|
result |= 2;
|
||||||
if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5
|
if (sprintf (buf, "%.511f %d", 1.0, 33) < 511 + 5
|
||||||
|| buf[0] != '1')
|
|| buf[0] != '1')
|
||||||
result |= 4;
|
result |= 4;
|
||||||
if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5
|
if (sprintf (buf, "%.999f %d", 1.0, 33) < 999 + 5
|
||||||
|| buf[0] != '1')
|
|| buf[0] != '1')
|
||||||
result |= 4;
|
result |= 4;
|
||||||
return result;
|
return result;
|
||||||
|
15
meson.build
15
meson.build
@ -519,7 +519,16 @@ foreach m : struct_members
|
|||||||
else
|
else
|
||||||
header_check_prefix = header_check_prefix + '#include <sys/stat.h>'
|
header_check_prefix = header_check_prefix + '#include <sys/stat.h>'
|
||||||
endif
|
endif
|
||||||
if cc.has_member('struct ' + m[0], m[1], prefix : header_check_prefix)
|
# Reimplement cc.has_member() to workaround compiler warning
|
||||||
|
# FIXME: https://github.com/mesonbuild/meson/pull/12818
|
||||||
|
code = header_check_prefix + '''
|
||||||
|
void bar(void) {
|
||||||
|
struct ''' + m[0] + ''' foo;
|
||||||
|
(void) ( foo.''' + m[1] + ''' );
|
||||||
|
(void) foo;
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
if cc.compiles(code, name : 'type "struct ' + m[0] + '" has member "' + m[1] + '"')
|
||||||
define = 'HAVE_STRUCT_@0@_@1@'.format(m[0].to_upper(), m[1].underscorify().to_upper())
|
define = 'HAVE_STRUCT_@0@_@1@'.format(m[0].to_upper(), m[1].underscorify().to_upper())
|
||||||
glib_conf.set(define, 1)
|
glib_conf.set(define, 1)
|
||||||
glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(define)
|
glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(define)
|
||||||
@ -1554,6 +1563,7 @@ if long_long_size == long_size
|
|||||||
int main () {
|
int main () {
|
||||||
int64_t i1 = 1;
|
int64_t i1 = 1;
|
||||||
long *i2 = &i1;
|
long *i2 = &i1;
|
||||||
|
(void) i2;
|
||||||
return 1;
|
return 1;
|
||||||
}''', name : 'int64_t is long')
|
}''', name : 'int64_t is long')
|
||||||
int64_t_typedef = 'long'
|
int64_t_typedef = 'long'
|
||||||
@ -1566,9 +1576,12 @@ if long_long_size == long_size
|
|||||||
int main () {
|
int main () {
|
||||||
int64_t i1 = 1;
|
int64_t i1 = 1;
|
||||||
long long *i2 = &i1;
|
long long *i2 = &i1;
|
||||||
|
(void) i2;
|
||||||
return 1;
|
return 1;
|
||||||
}''', name : 'int64_t is long long')
|
}''', name : 'int64_t is long long')
|
||||||
int64_t_typedef = 'long long'
|
int64_t_typedef = 'long long'
|
||||||
|
else
|
||||||
|
error('Cannot detect int64_t typedef')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user