1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Try to catch the compilers that don't handle immidiate structures as well as we

would like.  We use them to initialise other struct (lookup) tables, so test
that as well.

Also try not to segfault during our snprintf tests - test both with a 0 len
buffer and without any buffer at all.

Andrew Bartlett
(This used to be commit 2d80ab7122)
This commit is contained in:
Andrew Bartlett 2002-02-22 01:54:17 +00:00
parent 5dbe33e3ee
commit 5f65fc0318

View File

@ -352,9 +352,15 @@ AC_CACHE_CHECK([for immediate structures],samba_cv_immediate_structures, [
AC_TRY_COMPILE([
#include <stdio.h>],
[
#define X_FOOBAR(x) ((FOOBAR) { x })
typedef struct {unsigned x;} FOOBAR;
FOOBAR f = X_FOOBAR(1);
#define X_FOOBAR(x) ((FOOBAR) { x })
#define FOO_ONE X_FOOBAR(1)
FOOBAR f = FOO_ONE;
static struct {
FOOBAR y;
} f2[] = {
{FOO_ONE}
};
],
samba_cv_immediate_structures=yes,samba_cv_immediate_structures=no)])
if test x"$samba_cv_immediate_structures" = x"yes"; then
@ -989,6 +995,11 @@ void foo(const char *format, ...) {
int len;
char buf[5];
va_start(ap, format);
len = vsnprintf(buf, 0, format, ap);
va_end(ap);
if (len != 5) exit(1);
va_start(ap, format);
len = vsnprintf(0, 0, format, ap);
va_end(ap);