1 /* Test path-printing in the face of macros. */
3 /* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
4 /* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */
5 /* { dg-enable-nn-line-numbers "" } */
7 #include "malloc-macro.h"
9 /* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } 2 } */
13 WRAPPED_FREE (ptr
); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
14 WRAPPED_FREE (ptr
); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
16 /* { dg-begin-multiline-output "" }
17 NN | #define WRAPPED_FREE(PTR) free(PTR)
19 NN | WRAPPED_FREE (ptr);
21 { dg-end-multiline-output "" { target c } } */
22 /* { dg-begin-multiline-output "" }
23 NN | #define WRAPPED_FREE(PTR) free(PTR)
25 NN | WRAPPED_FREE (ptr);
27 { dg-end-multiline-output "" { target c++ } } */
28 /* { dg-begin-multiline-output "" }
30 { dg-end-multiline-output "" { target c } } */
31 /* { dg-begin-multiline-output "" }
32 'void test(void*)': event 1
33 { dg-end-multiline-output "" { target c++ } } */
34 /* { dg-prune-output "\[^\n\r\]*malloc-macro.h\[^\n\r\]*" } */
35 /* { dg-begin-multiline-output "" }
36 NN | #define WRAPPED_FREE(PTR) free(PTR)
39 | (1) first 'free' here
40 NN | WRAPPED_FREE (ptr);
42 { dg-end-multiline-output "" { target c } } */
43 /* { dg-begin-multiline-output "" }
44 NN | #define WRAPPED_FREE(PTR) free(PTR)
47 | (1) first 'free' here
48 NN | WRAPPED_FREE (ptr);
50 { dg-end-multiline-output "" { target c++ } } */
51 /* { dg-prune-output "\[^\n\r\]*malloc-macro.h\[^\n\r\]*" } */
52 /* { dg-begin-multiline-output "" }
54 { dg-end-multiline-output "" { target c } } */
55 /* { dg-begin-multiline-output "" }
56 'void test(void*)': event 2
57 { dg-end-multiline-output "" { target c++ } } */
58 /* { dg-prune-output "\[^\n\r\]*malloc-macro.h\[^\n\r\]*" } */
59 /* { dg-begin-multiline-output "" }
60 NN | #define WRAPPED_FREE(PTR) free(PTR)
63 | (2) second 'free' here; first 'free' was at (1)
64 NN | WRAPPED_FREE (ptr);
66 { dg-end-multiline-output "" { target c } } */
67 /* { dg-begin-multiline-output "" }
68 NN | #define WRAPPED_FREE(PTR) free(PTR)
71 | (2) second 'free' here; first 'free' was at (1)
72 NN | WRAPPED_FREE (ptr);
74 { dg-end-multiline-output "" { target c++ } } */