2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / bconstp-1.c
blob36831a5d6d5bd9775b63e97c39801163b937b335
1 /* { dg-do compile } */
3 /* This test checks that builtin_constant_p can be used safely in
4 initializers for static data. The macro X() defined below should
5 be an acceptable initializer expression no matter how complex its
6 argument is. */
8 extern int a;
9 extern int b;
11 extern int foo(void);
12 extern int bar(void);
14 #define X(exp) (__builtin_constant_p(exp) ? (exp) : -1)
16 const short tests[] = {
17 X(0),
18 X(a),
19 X(0 && a),
20 X(a && b),
21 X(foo()),
22 X(0 && foo()),
23 X(a && foo()),
24 X(foo() && bar())