File: e_19_3.c

package info (click to toggle)
mcpp 2.7.2-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,148 kB
  • sloc: ansic: 35,244; sh: 9,241; makefile: 176; cpp: 84; exp: 18
file content (40 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (8)
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
/* e_19_3.c:    Redefinitions of macros.    */

/* { dg-do preprocess } */

/* Excerpts from ISO C 3.8.3 "Examples".    */

#define OBJ_LIKE        (1-1)
#define FTN_LIKE(a)     ( a )

/* The following redefinitions should be diagnosed. */

/* 19.3:    */
/* different token sequence     */
#define OBJ_LIKE        (0)     /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */

/*  (1-1);  */
    OBJ_LIKE;

/* 19.4:    */
#undef  OBJ_LIKE
#define OBJ_LIKE        (1-1)
/* different white space        */
#define OBJ_LIKE        (1 - 1) /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */

/* 19.5:    */
/* different parameter usage    */
#define FTN_LIKE(b)     ( a )   /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */

/*  ( x );  */
    FTN_LIKE(x);

/* 19.6:    */
#undef  FTN_LIKE
#define FTN_LIKE(a)     ( a )
/* different parameter spelling */
#define FTN_LIKE(b)     ( b )   /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */

/* 19.7:    Not in ISO C "Examples" */
#define FTN_LIKE        OBJ_LIKE    /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */