Merge branch 'th/meson-werror-fixes-2' into 'main'

[th/meson-werror-fixes-2] more workarounds for compiler warnings in meson compiler checks

See merge request GNOME/glib!3904
This commit is contained in:
Philip Withnall 2024-02-08 10:28:01 +00:00
commit a7a6b93cf6
4 changed files with 16 additions and 7 deletions

View File

@ -15,7 +15,7 @@ static double zero = 0.0;
int main ()
{
int result = 0;
if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0
if (sprintf (buf, "%F %d", 1234567.0, 33) < 0
|| strcmp (buf, "1234567.000000 33") != 0)
result |= 1;
if (sprintf (buf, "%F", 1.0 / zero) < 0

View File

@ -15,7 +15,7 @@ static char buf[100];
static double zero = 0.0;
int main ()
{
if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0
if (sprintf (buf, "%010f", 1.0 / zero) < 0
|| (strcmp (buf, " inf") != 0
&& strcmp (buf, " infinity") != 0))
return 1;

View File

@ -15,15 +15,15 @@ int main ()
{
int result = 0;
buf[0] = '\0';
if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0
if (sprintf (buf, "%Lf %d", 1.75L, 33) < 0
|| strcmp (buf, "1.750000 33") != 0)
result |= 1;
buf[0] = '\0';
if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0
if (sprintf (buf, "%Le %d", 1.75L, 33) < 0
|| strcmp (buf, "1.750000e+00 33") != 0)
result |= 2;
buf[0] = '\0';
if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0
if (sprintf (buf, "%Lg %d", 1.75L, 33) < 0
|| strcmp (buf, "1.75 33") != 0)
result |= 4;
return result;

View File

@ -1027,6 +1027,7 @@ static __uint128_t v1 = 100;
static __uint128_t v2 = 10;
static __uint128_t u;
u = v1 / v2;
(void) u;
}'''
if cc.compiles(uint128_t_src, name : '__uint128_t available')
glib_conf.set('HAVE_UINT128_T', 1)
@ -1122,7 +1123,7 @@ if cc.compiles('''#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
void some_func (void) {
open(0, O_DIRECTORY, 0);
open(".", O_DIRECTORY, 0);
}''', name : 'open() option O_DIRECTORY')
glib_conf.set('HAVE_OPEN_O_DIRECTORY', 1)
endif
@ -1227,7 +1228,6 @@ int
doit()
{
char buffer[32];
va_list args;
int r;
r = snprintf(buffer, 5, "1234567");
@ -1314,6 +1314,7 @@ endif
if cc.links('''#include <langinfo.h>
int main (int argc, char ** argv) {
char *codeset = nl_langinfo (CODESET);
(void) codeset;
return 0;
}''', name : 'nl_langinfo and CODESET')
glib_conf.set('HAVE_LANGINFO_CODESET', 1)
@ -1334,6 +1335,7 @@ if cc.links('''#include <langinfo.h>
str = nl_langinfo (ABMON_12);
str = nl_langinfo (DAY_1);
str = nl_langinfo (ABDAY_7);
(void) str;
return 0;
}''', name : 'nl_langinfo (PM_STR)')
have_langinfo_time = true
@ -1349,6 +1351,7 @@ if cc.links('''#include <langinfo.h>
str = nl_langinfo (ERA_D_FMT);
str = nl_langinfo (ERA_T_FMT);
str = nl_langinfo (_NL_TIME_ERA_NUM_ENTRIES);
(void) str;
return 0;
}''', name : 'nl_langinfo (ERA)')
glib_conf.set('HAVE_LANGINFO_ERA', 1)
@ -1370,6 +1373,7 @@ if cc.links('''#include <langinfo.h>
str = nl_langinfo (_NL_CTYPE_OUTDIGIT7_MB);
str = nl_langinfo (_NL_CTYPE_OUTDIGIT8_MB);
str = nl_langinfo (_NL_CTYPE_OUTDIGIT9_MB);
(void) str;
return 0;
}''', name : 'nl_langinfo (_NL_CTYPE_OUTDIGITn_MB)')
glib_conf.set('HAVE_LANGINFO_OUTDIGIT', 1)
@ -1397,6 +1401,7 @@ if cc.links('''#ifndef _GNU_SOURCE
str = nl_langinfo (ALTMON_10);
str = nl_langinfo (ALTMON_11);
str = nl_langinfo (ALTMON_12);
(void) str;
return 0;
}''', name : 'nl_langinfo (ALTMON_n)')
glib_conf.set('HAVE_LANGINFO_ALTMON', 1)
@ -1424,6 +1429,7 @@ if cc.links('''#ifndef _GNU_SOURCE
str = nl_langinfo (_NL_ABALTMON_10);
str = nl_langinfo (_NL_ABALTMON_11);
str = nl_langinfo (_NL_ABALTMON_12);
(void) str;
return 0;
}''', name : 'nl_langinfo (_NL_ABALTMON_n)')
glib_conf.set('HAVE_LANGINFO_ABALTMON', 1)
@ -1436,6 +1442,7 @@ endif
if cc.links('''#include <langinfo.h>
int main (int argc, char ** argv) {
char *codeset = nl_langinfo (_NL_TIME_CODESET);
(void) codeset;
return 0;
}''', name : 'nl_langinfo and _NL_TIME_CODESET')
glib_conf.set('HAVE_LANGINFO_TIME_CODESET', 1)
@ -1506,6 +1513,7 @@ if cc.compiles('''#include <sys/types.h>
#include <inttypes.h>
void some_func (void) {
uintmax_t i = (uintmax_t) -1;
(void) i;
}''', name : 'uintmax_t in inttypes.h')
glib_conf.set('HAVE_INTTYPES_H_WITH_UINTMAX', 1)
found_uintmax_t = true
@ -1518,6 +1526,7 @@ if cc.compiles('''#include <sys/types.h>
#include <stdint.h>
void some_func (void) {
uintmax_t i = (uintmax_t) -1;
(void) i;
}''', name : 'uintmax_t in stdint.h')
glib_conf.set('HAVE_STDINT_H_WITH_UINTMAX', 1)
found_uintmax_t = true