OpenMPI  0.1.1
debug.h
1 /*
2  * Copyright © 2009 CNRS
3  * Copyright © 2009-2010 inria. All rights reserved.
4  * Copyright © 2009, 2011 Université Bordeaux 1
5  * Copyright © 2011 Cisco Systems, Inc. All rights reserved.
6  * See COPYING in top-level directory.
7  */
8 
9 /* The configuration file */
10 
11 #ifndef HWLOC_DEBUG_H
12 #define HWLOC_DEBUG_H
13 
14 #include <private/autogen/config.h>
15 
16 #ifdef HWLOC_DEBUG
17 #include <stdarg.h>
18 #include <stdio.h>
19 #endif
20 
21 static __hwloc_inline void hwloc_debug(const char *s __hwloc_attribute_unused, ...)
22 {
23 #ifdef HWLOC_DEBUG
24  va_list ap;
25 
26  va_start(ap, s);
27  vfprintf(stderr, s, ap);
28  va_end(ap);
29 #endif
30 }
31 
32 #ifdef HWLOC_DEBUG
33 #define hwloc_debug_bitmap(fmt, bitmap) do { \
34  char *s= hwloc_bitmap_printf_value(bitmap); \
35  fprintf(stderr, fmt, s); \
36  free(s); \
37 } while (0)
38 #define hwloc_debug_1arg_bitmap(fmt, arg1, bitmap) do { \
39  char *s= hwloc_bitmap_printf_value(bitmap); \
40  fprintf(stderr, fmt, arg1, s); \
41  free(s); \
42 } while (0)
43 #define hwloc_debug_2args_bitmap(fmt, arg1, arg2, bitmap) do { \
44  char *s= hwloc_bitmap_printf_value(bitmap); \
45  fprintf(stderr, fmt, arg1, arg2, s); \
46  free(s); \
47 } while (0)
48 #else
49 #define hwloc_debug_bitmap(s, bitmap) do { } while(0)
50 #define hwloc_debug_1arg_bitmap(s, arg1, bitmap) do { } while(0)
51 #define hwloc_debug_2args_bitmap(s, arg1, arg2, bitmap) do { } while(0)
52 #endif
53 
54 #endif /* HWLOC_DEBUG_H */