1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

wafsamba/replace: move __STDC_WANT_LIB_EXT1__ to CFLAGS

This fixes the build of python bindings, which use memset_s()
(via ZERO_STRUCT).

In python bindings Python.h needs to be the first header, which means
is already includes string.h. Defining __STDC_WANT_LIB_EXT1__ in
replace.h is too late in that case.

This fixes the --check-c-compiler=gcc --picky-developer on FreeBSD 12.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-01-27 20:27:42 +01:00 committed by Andreas Schneider
parent e49df24e80
commit b2050db67b
2 changed files with 17 additions and 2 deletions

View File

@ -444,6 +444,15 @@ def configure(conf):
conf.DEFINE('_GNU_SOURCE', 1, add_to_cflags=True)
conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1, add_to_cflags=True)
#
# Needs to be defined before std*.h and string*.h are included
# As Python.h already brings string.h we need it in CFLAGS.
# See memset_s() details here:
# https://en.cppreference.com/w/c/string/byte/memset
#
if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1'] + conf.env.WERROR_CFLAGS):
conf.ADD_CFLAGS('-D__STDC_WANT_LIB_EXT1__=1')
# on Tru64 certain features are only available with _OSF_SOURCE set to 1
# and _XOPEN_SOURCE set to 600
if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1':

View File

@ -36,8 +36,14 @@
#include <standards.h>
#endif
/* Needs to be defined before std*.h and string*.h are included */
#define __STDC_WANT_LIB_EXT1__ 1
/*
* Needs to be defined before std*.h and string*.h are included
* As it's also needed when Python.h is the first header we
* require a global -D__STDC_WANT_LIB_EXT1__=1
*/
#ifndef __STDC_WANT_LIB_EXT1__
#error -D__STDC_WANT_LIB_EXT1__=1 required
#endif
#include <stdio.h>
#include <stdlib.h>