libpqxx: compiler-internal.hxx Source File

libpqxx 4.0.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

compiler-internal.hxx
1 /*-------------------------------------------------------------------------
2 *
3 * FILE
4 * pqxx/compiler-internal.hxx
5 *
6 * DESCRIPTION
7 * Compiler deficiency workarounds for compiling libpqxx itself.
8 * DO NOT INCLUDE THIS FILE when building client programs.
9 *
10 * Copyright (c) 2002-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
11 *
12 * See COPYING for copyright license. If you did not receive a file called
13 * COPYING with this source code, please notify the distributor of this mistake,
14 * or contact the author.
15 *
16 *-------------------------------------------------------------------------
17 */
18 #ifndef PQXX_H_COMPILER_INTERNAL
19 #define PQXX_H_COMPILER_INTERNAL
20
21
22 // Workarounds & definitions needed to compile libpqxx into a library
23 #include "pqxx/config-internal-compiler.h"
24
25 // Library-private configuration related to libpq version
26 #include "pqxx/config-internal-libpq.h"
27
28 #ifdef _WIN32
29
30 #ifdef PQXX_SHARED
31 #undef PQXX_LIBEXPORT
32 #define PQXX_LIBEXPORT __declspec(dllexport)
33 // TODO: Does Windows have a way to "unexport" a symbol in an exported class?
34 #define PQXX_PRIVATE __declspec()
35 #endif // PQXX_SHARED
36
37 #ifdef _MSC_VER
38 #pragma warning (disable: 4251 4275 4273)
39 #pragma warning (disable: 4258) // Complains that for-scope usage is correct.
40 #pragma warning (disable: 4290)
41 #pragma warning (disable: 4351)
42 #pragma warning (disable: 4355)
43 #pragma warning (disable: 4786)
44 #pragma warning (disable: 4800) // Performance warning for boolean conversions.
45 #pragma warning (disable: 4996) // Complains that strncpy() "may" be unsafe.
46 #endif
47
48 #elif defined(__GNUC__) && defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32
49
50 #define PQXX_LIBEXPORT __attribute__ ((visibility("default")))
51 #define PQXX_PRIVATE __attribute__ ((visibility("hidden")))
52
53 #endif // __GNUC__ && PQXX_HAVE_GCC_VISIBILITY
54
55
56 #include "pqxx/compiler-public.hxx"
57
58 #include <cstddef>
59
60 #ifdef PQXX_HAVE_LIMITS
61 #include <limits>
62 #else // PQXX_HAVE_LIMITS
63 #include <climits>
64 namespace PGSTD
65 {
67 template<typename T> struct numeric_limits
68 {
69 static T max() throw ();
70 static T min() throw ();
71 };
72 template<> inline long numeric_limits<long>::max() throw () {return LONG_MAX;}
73 template<> inline long numeric_limits<long>::min() throw () {return LONG_MIN;}
74 }
75 #endif // PQXX_HAVE_LIMITS
76 #endif