Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/shrink-wrap-pretend.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do compile } */ | |
2 /* { dg-options "-O2 -g" } */ | |
3 | |
4 #include <stdlib.h> | |
5 #include <stdio.h> | |
6 #include <stdarg.h> | |
7 | |
8 #define DEBUG_BUFFER_SIZE 80 | |
9 int unifi_debug = 5; | |
10 | |
11 void | |
12 unifi_trace (void* ospriv, int level, const char *fmt, ...) | |
13 { | |
14 static char s[DEBUG_BUFFER_SIZE]; | |
15 va_list args; | |
16 unsigned int len; | |
17 | |
18 if (!ospriv) | |
19 return; | |
20 | |
21 if (unifi_debug >= level) | |
22 { | |
23 va_start (args, fmt); | |
24 len = vsnprintf (&(s)[0], (DEBUG_BUFFER_SIZE), fmt, args); | |
25 va_end (args); | |
26 | |
27 if (len >= DEBUG_BUFFER_SIZE) | |
28 { | |
29 (s)[DEBUG_BUFFER_SIZE - 2] = '\n'; | |
30 (s)[DEBUG_BUFFER_SIZE - 1] = 0; | |
31 } | |
32 | |
33 printf ("%s", s); | |
34 } | |
35 } | |
36 |