Blame cpp-test/test-t/e_19_3.c
|
Packit Service |
8bf002 |
/* e_19_3.c: Redefinitions of macros. */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* { dg-do preprocess } */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* Excerpts from ISO C 3.8.3 "Examples". */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
#define OBJ_LIKE (1-1)
|
|
Packit Service |
8bf002 |
#define FTN_LIKE(a) ( a )
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* The following redefinitions should be diagnosed. */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* 19.3: */
|
|
Packit Service |
8bf002 |
/* different token sequence */
|
|
Packit Service |
8bf002 |
#define OBJ_LIKE (0) /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* (1-1); */
|
|
Packit Service |
8bf002 |
OBJ_LIKE;
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* 19.4: */
|
|
Packit Service |
8bf002 |
#undef OBJ_LIKE
|
|
Packit Service |
8bf002 |
#define OBJ_LIKE (1-1)
|
|
Packit Service |
8bf002 |
/* different white space */
|
|
Packit Service |
8bf002 |
#define OBJ_LIKE (1 - 1) /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* 19.5: */
|
|
Packit Service |
8bf002 |
/* different parameter usage */
|
|
Packit Service |
8bf002 |
#define FTN_LIKE(b) ( a ) /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* ( x ); */
|
|
Packit Service |
8bf002 |
FTN_LIKE(x);
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* 19.6: */
|
|
Packit Service |
8bf002 |
#undef FTN_LIKE
|
|
Packit Service |
8bf002 |
#define FTN_LIKE(a) ( a )
|
|
Packit Service |
8bf002 |
/* different parameter spelling */
|
|
Packit Service |
8bf002 |
#define FTN_LIKE(b) ( b ) /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */
|
|
Packit Service |
8bf002 |
|
|
Packit Service |
8bf002 |
/* 19.7: Not in ISO C "Examples" */
|
|
Packit Service |
8bf002 |
#define FTN_LIKE OBJ_LIKE /* { dg-error "redefined\n\[\^ \]*( error:|) this is the location | The macro is redefined" } */
|
|
Packit Service |
8bf002 |
|