libpqxx
3.1.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-2013, 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
#include <cstddef>
29
30
#ifdef _WIN32
31
32
#ifdef PQXX_SHARED
33
#undef PQXX_LIBEXPORT
34
#define PQXX_LIBEXPORT __declspec(dllexport)
35
// TODO: Does Windows have a way to "unexport" a symbol in an exported class?
36
#define PQXX_PRIVATE __declspec()
37
#endif // PQXX_SHARED
38
39
#ifdef _MSC_VER
40
#pragma warning (disable: 4251 4275 4273)
41
#pragma warning (disable: 4258) // Complains that for-scope usage is correct
42
#pragma warning (disable: 4290)
43
#pragma warning (disable: 4355)
44
#pragma warning (disable: 4786)
45
#pragma warning (disable: 4800) // Performance warning for boolean conversions
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
#ifdef PQXX_HAVE_LIMITS
59
#include <limits>
60
#else // PQXX_HAVE_LIMITS
61
#include <climits>
62
namespace
PGSTD
63
{
65
template
<
typename
T>
struct
numeric_limits
66
{
67
static
T max()
throw
();
68
static
T min()
throw
();
69
};
70
template
<>
inline
long
numeric_limits<long>::max
() throw () {
return
LONG_MAX;}
71
template
<>
inline
long
numeric_limits<long>::min
() throw () {
return
LONG_MIN;}
72
}
73
#endif // PQXX_HAVE_LIMITS
74
75
76
namespace
pqxx
77
{
78
namespace
internal
79
{
81
template
<
typename
T>
inline
ptrdiff_t
distance
(T first, T last)
82
{
83
#ifdef PQXX_HAVE_DISTANCE
84
return
PGSTD::distance
(first, last);
85
#else
86
// Naive implementation. All we really need for now.
87
ptrdiff_t d;
88
for
(d=0; first != last; ++d) ++first;
89
return
d;
90
#endif
91
}
92
}
93
}
94
95
#endif
96
include
pqxx
compiler-internal.hxx
Generated on Sun Jan 20 2013 12:57:20 for libpqxx by
1.8.1.2