Project

General

Profile

Feature #708 » 0039-Meson-Add-check-for-FREECIV_STATIC_STRLEN.patch

main, S3_2 - Marko Lindqvist, 06/08/2024 10:58 PM

View differences:

gen_headers/meson_freeciv_config.h.in
/* C++11 static assert supported */
#mesondefine FREECIV_CXX11_STATIC_ASSERT
/* strlen() in static assert supported */
#mesondefine FREECIV_STATIC_STRLEN
#endif /* FC__FREECIV_CONFIG_H */
meson.build
pub_conf_data.set('FREECIV_CXX11_STATIC_ASSERT', 1)
endif
if c_compiler.compiles('''
#include <assert.h>
#include <string.h>
static const char str[] = "12345";
int main(void) { _Static_assert(5 == strlen(str), "Wrong length"); }''',
name: 'strlen() in static assert')
pub_conf_data.set('FREECIV_STATIC_STRLEN', 1)
endif
# Check for c23 nullptr that can be passed as sentinel
if c_compiler.compiles('''
#include <stddef.h>
(1-1/2)