libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / plugin / diagnostic-path-format-separate-events.c
blobdcb72c0aacd6138963e9acd6abe0f3210f0d5674
1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-path-format=separate-events" } */
4 #include <stdlib.h>
6 void *wrapped_malloc (size_t size)
8 return malloc (size);
11 void wrapped_free (void *ptr)
13 free (ptr); /* { dg-warning "double-free of 'ptr' \\\[CWE-415\\]" } */
16 typedef struct boxed_int
18 int i;
19 } boxed_int;
21 boxed_int *
22 make_boxed_int (int i)
24 boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
25 result->i = i;
26 return result;
29 void
30 free_boxed_int (boxed_int *bi)
32 wrapped_free (bi);
35 void test (int i)
36 { /* { dg-message "\\(1\\) entering 'test'" } */
37 boxed_int *obj = make_boxed_int (i); /* { dg-message "\\(2\\) calling 'make_boxed_int'" } */
38 /* etc */
40 free_boxed_int (obj);
42 free_boxed_int (obj);