Branch data Line data Source code
1 : : #ifndef __attribute__
2 : : /* This feature is available in gcc versions 2.5 and later. */
3 : : # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
4 : : # define __attribute__(Spec) /* empty */
5 : : # endif
6 : : #endif
7 : :
8 : : static void fail (const char *format, ...)
9 : : __attribute__ ((format (printf, 1, 2)));
10 : : static void success (const char *format, ...)
11 : : __attribute__ ((format (printf, 1, 2)));
12 : :
13 : : static int debug = 0;
14 : : static int error_count = 0;
15 : : static int break_on_error = 0;
16 : :
17 : : static void
18 : 0 : fail (const char *format, ...)
19 : : {
20 : : va_list arg_ptr;
21 : :
22 : 0 : va_start (arg_ptr, format);
23 : 0 : vfprintf (stderr, format, arg_ptr);
24 : 0 : va_end (arg_ptr);
25 : 0 : error_count++;
26 [ # # ]: 0 : if (break_on_error)
27 : 0 : exit (EXIT_FAILURE);
28 : 0 : }
29 : :
30 : : static void
31 : 60 : success (const char *format, ...)
32 : : {
33 : : va_list arg_ptr;
34 : :
35 : 60 : va_start (arg_ptr, format);
36 [ - + ]: 60 : if (debug)
37 : 0 : vfprintf (stdout, format, arg_ptr);
38 : 60 : va_end (arg_ptr);
39 : 60 : }
|