PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / shrink-wrap-pretend.c
blob6e20ca12e98d1b81861b7396cb1e4683efe0cc3e
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -g" } */
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <stdarg.h>
8 #define DEBUG_BUFFER_SIZE 80
9 int unifi_debug = 5;
11 void
12 unifi_trace (void* ospriv, int level, const char *fmt, ...)
14 static char s[DEBUG_BUFFER_SIZE];
15 va_list args;
16 unsigned int len;
18 if (!ospriv)
19 return;
21 if (unifi_debug >= level)
23 va_start (args, fmt);
24 len = vsnprintf (&(s)[0], (DEBUG_BUFFER_SIZE), fmt, args);
25 va_end (args);
27 if (len >= DEBUG_BUFFER_SIZE)
29 (s)[DEBUG_BUFFER_SIZE - 2] = '\n';
30 (s)[DEBUG_BUFFER_SIZE - 1] = 0;
33 printf ("%s", s);