1 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
3 /* Verify absence of false positive from -Wanalyzer-mismatching-deallocation
5 Based on https://github.com/libguestfs/libguestfs/blob/f19fd566f6387ce7e4d82409528c9dde374d25e0/daemon/debug.c#L115
6 which is GPLv2 or later. */
8 typedef __SIZE_TYPE__
size_t;
9 typedef __builtin_va_list
va_list;
11 #include "../../gcc.dg/analyzer/analyzer-decls.h"
13 extern void free (void *);
14 extern void *realloc (void *__ptr
, size_t __size
)
15 __attribute__ ((__nothrow__
, __leaf__
))
16 __attribute__ ((__warn_unused_result__
))
17 __attribute__ ((__alloc_size__ (2)));
18 extern char *strdup (const char *)
19 __attribute__((malloc (free
)));
20 extern char *strcat (char *__restrict __dest
, const char *__restrict __src
)
21 __attribute__ ((__nothrow__
, __leaf__
))
22 __attribute__ ((__nonnull__ (1, 2)));
25 debug_help (const char **cmds
, size_t argc
, char *const *const argv
)
30 r
= strdup ("Commands supported:");
35 len
= __builtin_strlen (r
);
36 for (i
= 0; cmds
[i
] != NULL
; ++i
) {
37 len
+= __builtin_strlen (cmds
[i
]) + 1;
38 p
= (char *) realloc (r
, len
+ 1); /* { dg-bogus "'free'" } */