1
/* -*- buffer-read-only: t -*- vi: set ro: */
2
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3
/* Test of <stdbool.h> substitute.
4
Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc.
6
This program is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 3 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
26
"error: bool is not defined"
29
"error: false is not defined"
32
"error: false is not 0"
35
"error: true is not defined"
38
"error: true is not 1"
40
#ifndef __bool_true_false_are_defined
41
"error: __bool_true_false_are_defined is not defined"
44
#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */
45
struct s { _Bool s: 1; _Bool t; } s;
48
char a[true == 1 ? 1 : -1];
49
char b[false == 0 ? 1 : -1];
50
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
51
#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>, at least,
52
not for all compilers. */
53
char d[(bool) 0.5 == true ? 1 : -1];
55
char f[(_Bool) 0.0 == false ? 1 : -1];
58
char h[sizeof (_Bool)];
59
#if 0 /* See above. */
62
enum { j = false, k = true, l = false * true, m = true * 256 };
64
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
65
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
66
#if 0 /* Cannot be guaranteed with gnulib's <stdbool.h>. */
67
#if defined __xlc__ || defined __GNUC__
68
/* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
69
reported by James Lemley on 2005-10-05; see
70
http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
71
This test is not quite right, since xlc is allowed to
72
reject this program, as the initializer for xlcbug is
73
not one of the forms that C requires support for.
74
However, doing the test right would require a run-time
75
test, and that would make cross-compilation harder.
76
Let us hope that IBM fixes the xlc bug, and also adds
77
support for this kind of constant expression. In the
78
meantime, this test will reject xlc, which is OK, since
79
our stdbool.h substitute should suffice. We also test
80
this with GCC, where it should work, to detect more
81
quickly whether someone messes up the test in the
83
char digs[] = "0123456789";
84
int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
87
/* Catch a bug in an HP-UX C compiler. See
88
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
89
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html