mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
meson: fix unit tests and "Invalid byte sequence in conversion input"
Check if strerror_r returns a char * and define STRERROR_R_CHAR_P
if so, which is needed by g_strerror() since c8e268b
https://bugzilla.gnome.org/show_bug.cgi?id=784000
This commit is contained in:
parent
f8a88a768d
commit
2ac8079b94
@ -398,6 +398,9 @@
|
|||||||
/* Define to 1 if you have the `strerror_r' function. */
|
/* Define to 1 if you have the `strerror_r' function. */
|
||||||
#mesondefine HAVE_STRERROR_R
|
#mesondefine HAVE_STRERROR_R
|
||||||
|
|
||||||
|
/* Define if strerror_r returns char * */
|
||||||
|
#mesondefine STRERROR_R_CHAR_P
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
#mesondefine HAVE_STRINGS_H
|
#mesondefine HAVE_STRINGS_H
|
||||||
|
|
||||||
|
17
meson.build
17
meson.build
@ -339,6 +339,23 @@ foreach f : functions
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
# Check whether strerror_r returns char *
|
||||||
|
if have_func_strerror_r
|
||||||
|
if cc.compiles('''#define _GNU_SOURCE
|
||||||
|
#include <string.h>
|
||||||
|
int func (void) {
|
||||||
|
char error_string[256];
|
||||||
|
char *ptr = strerror_r (-2, error_string, 256);
|
||||||
|
char c = *strerror_r (-2, error_string, 256);
|
||||||
|
return c != 0 && ptr != (void*) 0L;
|
||||||
|
}
|
||||||
|
''',
|
||||||
|
name : 'strerror_r() returns char *')
|
||||||
|
glib_conf.set('STRERROR_R_CHAR_P', 1,
|
||||||
|
description: 'Defined if strerror_r returns char *')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Special-case these functions that have alternative names on Windows/MSVC
|
# Special-case these functions that have alternative names on Windows/MSVC
|
||||||
if cc.has_function('snprintf') or cc.has_header_symbol('stdio.h', 'snprintf')
|
if cc.has_function('snprintf') or cc.has_header_symbol('stdio.h', 'snprintf')
|
||||||
glib_conf.set('HAVE_SNPRINTF', 1)
|
glib_conf.set('HAVE_SNPRINTF', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user