Fix broken MinGW build of gcc.c
[official-gcc.git] / gcc / testsuite / g++.dg / diagnostic / pr70105.C
blob9c9b02c77f4101558729d8b3223cfb18e5ea2010
1 // { dg-options "-Wsequence-point -fdiagnostics-show-caret" }
3 void *libiberty_concat_ptr;
4 extern unsigned long concat_length (const char *, ...);
5 extern char *concat_copy2 (const char *, ...);
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)
11 /* Arbitrary content here.
12    In PR c++/70105, this was >500 lines of source.
13    This should not be printed.  */
15 # define ALLOCA(x) __builtin_alloca(x)
17 int strlen (const char *);
18 void *get_identifier (const char *);
19 void *get_identifier_with_length (const char *, int);
21 #define GET_IDENTIFIER(STR) \
22   (__builtin_constant_p (STR)                           \
23     ? get_identifier_with_length ((STR), strlen (STR))  \
24     : get_identifier (STR))
26 void *test(void)
28   int *i;
29   return GET_IDENTIFIER (ACONCAT (("foo")));
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 "" } */