NetBurner 3.1
StandardCLibrary.h
1 
2 /* Must include this first to ensure the StandardC include in CppUTestConfig still happens at the right moment */
3 #include "CppUTestConfig.h"
4 
5 #ifndef STANDARDCLIBRARY_H_
6 #define STANDARDCLIBRARY_H_
7 
8 
9 #if CPPUTEST_USE_STD_C_LIB
10 
11 /* Needed for size_t */
12 #include <stddef.h>
13 
14 /* Sometimes the C++ library does an #undef in stdlib of malloc and free. We want to prevent that */
15 #ifdef __cplusplus
16  #if CPPUTEST_USE_STD_CPP_LIB
17  #include <cstdlib>
18  #endif
19 #endif
20 
21 /* Needed for malloc */
22 #include <stdlib.h>
23 
24 /* Needed for ... */
25 #include <stdarg.h>
26 
27 /* Needed for some detection of long long and 64 bit */
28 #include <limits.h>
29 
30 #else
31 
32 #ifdef __KERNEL__
33 
34 /* Unfinished and not working! Hacking hacking hacking. Why bother make the header files C++ safe! */
35 #define false kernel_false
36 #define true kernel_true
37 #define bool kernel_bool
38 #define new kernel_new
39 #define _Bool int
40 #include <linux/acpi.h>
41 #include <linux/types.h>
42 #undef false
43 #undef true
44 #undef bool
45 #undef new
46 
47 #else
48 
49 /*
50  * #warning "These definitions in StandardCLibrary.h are pure (educated, from linux kernel) guesses at the moment. Replace with your platform includes."
51  * Not on as warning are as errors :P
52  */
53 
54 #ifdef __SIZE_TYPE__
55 typedef __SIZE_TYPE__ size_t;
56 #else
57 typedef long unsigned int size_t;
58 #endif
59 
60 typedef char* va_list;
61 #define NULL (0)
62 extern void* malloc(size_t);
63 extern void free(void *);
64 
65 #define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
66 #define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,sizeof(int)-1))))
67 #define va_end(ap) (void) 0
68 
69 #endif
70 
71 #endif
72 
73 #endif