source: git/omalloc/omDerivedConfig.h

spielwiese
Last change on this file was d101b1, checked in by Oleksandr Motsak <http://goo.gl/mcpzY>, 11 years ago
Silence some warnings about statements without effect Insired by [039a51b3aa3c77c2b7bae73d24de8521df45aed2]
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*******************************************************************
2 *  File:    omDerivedConfig.h.in
3 *  Purpose: configuration which are derived from omConfig.h
4 *  Author:  obachman (Olaf Bachmann)
5 *  Created: 11/99
6 *******************************************************************/
7#ifndef OM_DERIVED_CONFIG_H
8#define OM_DERIVED_CONFIG_H
9
10#ifndef SIZEOF_VOIDP
11/* configure makes sure that SIZEOF_VOIDP == SIZEOF_LONG */
12#define SIZEOF_VOIDP SIZEOF_LONG
13#endif
14
15/* SIZEOF_VOIDP == 8 || SIZEOF_VOIDP == 4 checked by configure */
16#if SIZEOF_VOIDP == 8
17#define LOG_SIZEOF_LONG  3
18#define LOG_SIZEOF_VOIDP 3
19#define LOG_BIT_SIZEOF_LONG 6
20#else
21#define LOG_SIZEOF_LONG  2
22#define LOG_SIZEOF_VOIDP 2
23#define LOG_BIT_SIZEOF_LONG 5
24#endif
25
26/* SIZEOF_SYSTEM_PAGE == 4096 || SIZEOF_SYSTEM_PAGE == 8192 checked by configure */
27#if SIZEOF_SYSTEM_PAGE == 8192
28#define LOG_BIT_SIZEOF_SYSTEM_PAGE 13
29#else
30#define LOG_BIT_SIZEOF_SYSTEM_PAGE 12
31#endif
32
33#ifndef CHAR_BIT
34#define CHAR_BIT 8
35#endif
36
37#ifndef BIT_SIZEOF_LONG
38#define BIT_SIZEOF_LONG (CHAR_BIT << LOG_SIZEOF_LONG)
39#endif
40
41#ifdef OM_ALIGN_8
42#define SIZEOF_OM_ALIGNMENT 8
43#define SIZEOF_OM_ALIGNMENT_1 7
44#define LOG_SIZEOF_OM_ALIGNMENT 3
45#define SIZEOF_STRICT_ALIGNMENT 8
46#else
47#define SIZEOF_OM_ALIGNMENT 4
48#define SIZEOF_OM_ALIGNMENT_1 3
49#define LOG_SIZEOF_OM_ALIGNMENT 2
50#ifdef OM_ALIGNMENT_NEEDS_WORK
51#define SIZEOF_STRICT_ALIGNMENT 8
52#else
53#define SIZEOF_STRICT_ALIGNMENT 4
54#endif
55#endif
56
57#define OM_ALIGN_SIZE(size) \
58   ((((unsigned long) size) + SIZEOF_OM_ALIGNMENT_1) & (~SIZEOF_OM_ALIGNMENT_1))
59
60#define OM_IS_ALIGNED(what) \
61   ((((unsigned long) what) & SIZEOF_OM_ALIGNMENT_1) == 0)
62
63#define OM_STRICT_ALIGN_SIZE(size)                                          \
64   ((((size_t) (size)) + SIZEOF_STRICT_ALIGNMENT - 1) & (~ (SIZEOF_STRICT_ALIGNMENT - 1)))
65
66#define OM_IS_STRICT_ALIGNED(what) \
67   ((((unsigned long) what) & (SIZEOF_STRICT_ALIGNMENT -1)) == 0)
68
69#if defined(OM_NDEBUG) && defined(OM_HAVE_TRACK)
70#undef OM_HAVE_TRACK
71#endif
72
73/* define to enable assume */
74#ifndef HAVE_OM_ASSUME
75#if defined(OM_INTERNAL_DEBUG)
76#define HAVE_OM_ASSUME
77#endif
78#endif
79
80/* set to 0 to disable aso memory mamagent */
81#ifndef HAVE_ASO
82#define HAVE_ASO 1
83#endif
84#if defined(HAVE_ASO) && HAVE_ASO == 1
85/* define to enable ASO debugging */
86#undef ASO_DEBUG
87#endif
88
89#ifndef NULL
90#define NULL ((void*)0)
91#endif
92
93#if !defined(OM_TRACK_FILE_LINE) && ! defined(OM_TRACK_RETURN)
94#define OM_TRACK_FILE_LINE
95#endif
96
97/* The following macros save a lot of typing */
98#ifdef OM_TRACK_FILE_LINE
99#define OM_FL_DECL      const char* f, const int l
100#define OM_FL_VAL       f, l
101#define OM_FL           __FILE__,__LINE__
102#define OM_FL_KOMMA     ,
103#else
104#define OM_FL_DECL
105#define OM_FL_VAL
106#define OM_FL
107#define OM_FL_KOMMA
108#endif
109
110#define OM_CFL_DECL     char check OM_FL_KOMMA OM_FL_DECL
111#define OM_CFL_VAL      check OM_FL_KOMMA OM_FL_VAL
112#define OM_CFL          OM_CHECK OM_FL_KOMMA OM_FL
113
114#define OM_TFL_DECL     char track OM_FL_KOMMA OM_FL_DECL
115#define OM_TFL_VAL      track OM_FL_KOMMA OM_FL_VAL
116#define OM_TFL          OM_TRACK OM_FL_KOMMA OM_FL
117
118#define OM_CTFL_DECL    char check, char track OM_FL_KOMMA OM_FL_DECL
119#define OM_CTFL_VAL     check,track OM_FL_KOMMA OM_FL_VAL
120#define OM_CTFL         OM_CHECK,OM_TRACK OM_FL_KOMMA OM_FL
121
122#ifdef OM_TRACK_RETURN
123#define OM_FLR_DECL         OM_FL_DECL OM_FL_KOMMA const void* r
124#define OM_FLR_VAL          OM_FL_VAL OM_FL_KOMMA r
125#define OM_FLR              OM_FL OM_FL_KOMMA 0
126#define OM_R_DEF            void* r; GET_RET_ADDR(r)
127#ifdef OM_TRACK_FILE_LINE
128#define OM_FLR_ARG(f,l,r)   f,l,r
129#else
130#define OM_FLR_ARG(f,l,r)   r
131#endif
132
133#else
134
135#define OM_FLR_DECL OM_FL_DECL
136#define OM_FLR_VAL  OM_FL_VAL
137#define OM_FLR      OM_FL
138#define OM_R_DEF    do {} while (0)
139#define OM_FLR_ARG(f,l,r)   f,l
140#endif
141
142#endif /* OM_DERIVED_CONFIG_H  */
Note: See TracBrowser for help on using the repository browser.