| 1 |
// { dg-options "-Wsequence-point -fdiagnostics-show-caret" } |
| 2 |
|
| 3 |
void *libiberty_concat_ptr; |
| 4 |
extern unsigned long concat_length (const char *, ...); |
| 5 |
extern char *concat_copy2 (const char *, ...); |
| 6 |
|
| 7 |
#define ACONCAT(ACONCAT_PARAMS) \ |
| 8 |
(libiberty_concat_ptr = (char *) ALLOCA (concat_length ACONCAT_PARAMS + 1), /* { dg-warning "may be undefined" } */ \ |
| 9 |
concat_copy2 ACONCAT_PARAMS) |
| 10 |
|
| 11 |
/* Arbitrary content here. |
| 12 |
In PR c++/70105, this was >500 lines of source. |
| 13 |
This should not be printed. */ |
| 14 |
|
| 15 |
# define ALLOCA(x) __builtin_alloca(x) |
| 16 |
|
| 17 |
int strlen (const char *); |
| 18 |
void *get_identifier (const char *); |
| 19 |
void *get_identifier_with_length (const char *, int); |
| 20 |
|
| 21 |
#define GET_IDENTIFIER(STR) \ |
| 22 |
(__builtin_constant_p (STR) \ |
| 23 |
? get_identifier_with_length ((STR), strlen (STR)) \ |
| 24 |
: get_identifier (STR)) |
| 25 |
|
| 26 |
void *test(void) |
| 27 |
{ |
| 28 |
int *i; |
| 29 |
return GET_IDENTIFIER (ACONCAT (("foo"))); |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-begin-multiline-output "" } |
| 33 |
(libiberty_concat_ptr = (char *) ALLOCA (concat_length ACONCAT_PARAMS + 1), |
| 34 |
^ |
| 35 |
{ dg-end-multiline-output "" } */ |
| 36 |
/* { dg-begin-multiline-output "" } |
| 37 |
? get_identifier_with_length ((STR), strlen (STR)) \ |
| 38 |
^~~ |
| 39 |
{ dg-end-multiline-output "" } */ |
| 40 |
/* { dg-begin-multiline-output "" } |
| 41 |
return GET_IDENTIFIER (ACONCAT (("foo"))); |
| 42 |
^~~~~~~ |
| 43 |
{ dg-end-multiline-output "" } */ |