aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/trad/builtins.c
blob: df2718983a1acb4d29d2abd2f0bd39277b5c50da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Test that builtin-macros are OK.  */

/* { dg-do run } */

#include "builtins.h"

void abort (void);
char *strstr (const char *, const char *); 
int strcmp (const char *, const char *);

#define LINE __LINE__

#if __LINE__ != 13
# error __LINE__ part 1  /* { dg-bogus "__LINE__" } */
#endif

#if \
  __LINE__ != 18
# error __LINE__ part 2  /* { dg-bogus "__LINE__" } */
#endif

#if LINE != 22
# error __LINE__ part 3  /* { dg-bogus "__LINE__" } */
#endif

#if __INCLUDE_LEVEL != 0
# error __INCLUDE_LEVEL__  /* { dg-bogus "__INCLUDE_LEVEL__" } */
#endif

#if !defined (__TIME__)
# error __TIME__  /* { dg-bogus "__TIME__" } */
#endif

#if !defined (__DATE__)
# error __DATE__  /* { dg-bogus "__DATE__" } */
#endif


int main ()
{
  /* level is defined in builtins.h.  */
  if (level != 1)
    abort ();

  if (!strstr (__FILE__, "builtins.c"))
    abort ();

  if (!strcmp (__BASE_FILE__, "builtins.c"))
    abort ();

  return 0;
}