c++-gtk-utils
cgu_config.h
Go to the documentation of this file.
1 /* Copyright (C) 2010 to 2014 Chris Vine
2 
3 The library comprised in this file or of which this file is part is
4 distributed by Chris Vine under the GNU Lesser General Public
5 License as follows:
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public License
9  as published by the Free Software Foundation; either version 2.1 of
10  the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful, but
13  WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License, version 2.1, for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License, version 2.1, along with this library (see the file LGPL.TXT
19  which came with this source code package in the c++-gtk-utils
20  sub-directory); if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 
23 However, it is not intended that the object code of a program whose
24 source code instantiates a template from this file or uses macros or
25 inline functions (of any length) should by reason only of that
26 instantiation or use be subject to the restrictions of use in the GNU
27 Lesser General Public License. With that in mind, the words "and
28 macros, inline functions and instantiations of templates (of any
29 length)" shall be treated as substituted for the words "and small
30 macros and small inline functions (ten lines or less in length)" in
31 the fourth paragraph of section 5 of that licence. This does not
32 affect any other reason why object code may be subject to the
33 restrictions in that licence (nor for the avoidance of doubt does it
34 affect the application of section 2 of that licence to modifications
35 of the source code in this file).
36 
37 */
38 
39 #ifndef CGU_CONFIG_H
40 #define CGU_CONFIG_H
41 
42 /*
43  * This file is produced from cgu_config.h.in by the ./configure
44  * script.
45  */
46 
47 #undef CGU_USE_GLIB_MEMORY_SLICES_COMPAT
48 #undef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
49 
50 /*
51  * None of these new operators throw std::bad_alloc as glib terminates
52  * the whole application if it cannot allocate memory.
53  *
54  * These functions are only suitable as class member functions,
55  * because they do not check whether the passed size request value is
56  * 0, and g_slice_alloc() will not allocate any memory if passed a
57  * size of 0. (A class allocator will not be passed a size value less
58  * than 1 as an empty class/struct object has sizeof 1 in C++, so
59  * these will always be safe as member functions.)
60  *
61  * For anyone porting this library to windows, operator new[]() and
62  * operator delete[]() for arrays should not be included, because
63  * Visual Studio does not correctly comply with the C++ standard with
64  * respect to the two argument version of operator delete[]().
65  */
66 #if defined(CGU_USE_GLIB_MEMORY_SLICES_COMPAT) || defined(CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT)
67 #include <new>
68 #include <cstdlib>
69 #include <glib.h>
70 #define CGU_GLIB_MEMORY_SLICES_FUNCS \
71 static void* operator new(std::size_t s) {return g_slice_alloc(s);} \
72 static void* operator new(std::size_t s, const std::nothrow_t&) {return g_slice_alloc(s);} \
73 static void* operator new(std::size_t s, void* p) {return ::operator new(s, p);} \
74 static void operator delete(void* p, std::size_t s) {if (p) g_slice_free1(s, p);} \
75 static void operator delete(void* p, std::size_t s, const std::nothrow_t&) {if (p) g_slice_free1(s, p);} \
76 static void operator delete(void* p, void* q) {::operator delete(p, q);} \
77 static void* operator new[](std::size_t s) {return g_slice_alloc(s);} \
78 static void* operator new[](std::size_t s, const std::nothrow_t&) {return g_slice_alloc(s);} \
79 static void* operator new[](std::size_t s, void* p) {return ::operator new[](s, p);} \
80 static void operator delete[](void* p, std::size_t s) {if (p) g_slice_free1(s, p);} \
81 static void operator delete[](void* p, std::size_t s, const std::nothrow_t&) {if (p) g_slice_free1(s, p);} \
82 static void operator delete[](void* p, void* q) {return ::operator delete[](p, q);}
83 #else
84 #define CGU_GLIB_MEMORY_SLICES_FUNCS // Using global operator new, new[], delete and delete[]
85 #endif
86 
87 /* This determines whether each of the library headers will contain a
88  'using namespace Cgu' directive. It will include such a using
89  directive if configure is passed the --with-cgu-using-directive
90  option. (It can also be edited by hand.)
91 */
92 namespace Cgu {}
93 // do not include using directive
94 
95 /* whether the system provides sched_yield */
96 #define CGU_USE_SCHED_YIELD 1
97 
98 /* whether the system was found to provide working recursive mutexes
99  when the library was compiled
100 */
101 #define CGU_HAVE_RECURSIVE_MUTEX 1
102 
103 /* whether ==, != and < operators to be available for smart pointers */
104 #define CGU_USE_SMART_PTR_COMPARISON 1
105 
106 /* whether the std::queue implementation is standard conforming and
107  inheritable */
108 #define CGU_USE_INHERITABLE_QUEUE 1
109 
110 /* whether the library is to be compiled with GTK+ support */
111 #define CGU_USE_GTK 3
112 
113 /* whether the library is to be compiled with support for guile
114  extensions */
115 #define CGU_USE_GUILE 1
116 
117 /* whether guile correctly links scm_dynwind_block_asyncs() */
118 #undef CGU_GUILE_HAS_BROKEN_LINKING
119 
120 /* whether to use std::tuple implementation of callback classes */
121 #define CGU_USE_TUPLE 1
122 
123 /* whether gcc diagnostic pragmas are available */
124 #define CGU_USE_DIAGNOSTIC_PRAGMAS 1
125 
126 /* indicates that the series of the library being compiled against
127  is series 2.2
128 */
129 #define CGU_API_VERSION 22
130 
131 #endif // CGU_CONFIG_H
Cgu
Definition: application.h:44