diff --git a/include/pqxx/internal/header-pre.hxx b/include/pqxx/internal/header-pre.hxx index 09715a329..abc1a398d 100644 --- a/include/pqxx/internal/header-pre.hxx +++ b/include/pqxx/internal/header-pre.hxx @@ -43,75 +43,75 @@ #if defined(PQXX_HEADER_PRE) -#error "Avoid nesting #include of pqxx/internal/header-pre.hxx." +# error "Avoid nesting #include of pqxx/internal/header-pre.hxx." #endif #define PQXX_HEADER_PRE // Workarounds & definitions that need to be included even in library's headers -# include "pqxx/config-public-compiler.h" +#include "pqxx/config-public-compiler.h" // Enable ISO-646 alternative operaotr representations: "and" instead of "&&" // etc. on older compilers. C++20 removes this header. -# if __has_include() -# include -# endif +#if __has_include() +# include +#endif -# if defined(PQXX_HAVE_GCC_PURE) +#if defined(PQXX_HAVE_GCC_PURE) /// Declare function "pure": no side effects, only reads globals and its args. -# define PQXX_PURE __attribute__((pure)) -# else -# define PQXX_PURE /* pure */ -# endif +# define PQXX_PURE __attribute__((pure)) +#else +# define PQXX_PURE /* pure */ +#endif -# if defined(__GNUC__) +#if defined(__GNUC__) /// Tell the compiler to optimise a function for size, not speed. -# define PQXX_COLD __attribute__((cold)) -# else -# define PQXX_COLD /* cold */ -# endif +# define PQXX_COLD __attribute__((cold)) +#else +# define PQXX_COLD /* cold */ +#endif // Workarounds for Windows -# ifdef _WIN32 +#ifdef _WIN32 /* For now, export DLL symbols if _DLL is defined. This is done automatically * by the compiler when linking to the dynamic version of the runtime library, * according to "gzh" */ -# if defined(PQXX_SHARED) && !defined(PQXX_LIBEXPORT) -# define PQXX_LIBEXPORT __declspec(dllimport) -# endif // PQXX_SHARED && !PQXX_LIBEXPORT +# if defined(PQXX_SHARED) && !defined(PQXX_LIBEXPORT) +# define PQXX_LIBEXPORT __declspec(dllimport) +# endif // PQXX_SHARED && !PQXX_LIBEXPORT // Workarounds for Microsoft Visual C++ -# ifdef _MSC_VER +# ifdef _MSC_VER // Suppress vtables on abstract classes. -# define PQXX_NOVTABLE __declspec(novtable) +# define PQXX_NOVTABLE __declspec(novtable) // Automatically link with the appropriate libpq (static or dynamic, debug or // release). The default is to use the release DLL. Define PQXX_PQ_STATIC to // link to a static version of libpq, and _DEBUG to link to a debug version. // The two may be combined. -# if defined(PQXX_AUTOLINK) -# if defined(PQXX_PQ_STATIC) -# ifdef _DEBUG -# pragma comment(lib, "libpqd") -# else -# pragma comment(lib, "libpq") -# endif +# if defined(PQXX_AUTOLINK) +# if defined(PQXX_PQ_STATIC) +# ifdef _DEBUG +# pragma comment(lib, "libpqd") # else -# ifdef _DEBUG -# pragma comment(lib, "libpqddll") -# else -# pragma comment(lib, "libpqdll") -# endif +# pragma comment(lib, "libpq") +# endif +# else +# ifdef _DEBUG +# pragma comment(lib, "libpqddll") +# else +# pragma comment(lib, "libpqdll") # endif # endif +# endif // If we're not compiling libpqxx itself, automatically link with the // appropriate libpqxx library. To link with the libpqxx DLL, define @@ -121,49 +121,49 @@ // The preprocessor macro PQXX_INTERNAL is used to detect whether we // are compiling the libpqxx library itself. When you compile the library // yourself using your own project file, make sure to include this macro. -# if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL) -# ifdef PQXX_SHARED -# ifdef _DEBUG -# pragma comment(lib, "libpqxxD") -# else -# pragma comment(lib, "libpqxx") -# endif -# else // !PQXX_SHARED -# ifdef _DEBUG -# pragma comment(lib, "libpqxx_staticD") -# else -# pragma comment(lib, "libpqxx_static") -# endif +# if defined(PQXX_AUTOLINK) && !defined(PQXX_INTERNAL) +# ifdef PQXX_SHARED +# ifdef _DEBUG +# pragma comment(lib, "libpqxxD") +# else +# pragma comment(lib, "libpqxx") +# endif +# else // !PQXX_SHARED +# ifdef _DEBUG +# pragma comment(lib, "libpqxx_staticD") +# else +# pragma comment(lib, "libpqxx_static") # endif # endif +# endif -# endif // _MSC_VER +# endif // _MSC_VER -# elif defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32 +#elif defined(PQXX_HAVE_GCC_VISIBILITY) // !_WIN32 -# define PQXX_LIBEXPORT __attribute__((visibility("default"))) -# define PQXX_PRIVATE __attribute__((visibility("hidden"))) +# define PQXX_LIBEXPORT __attribute__((visibility("default"))) +# define PQXX_PRIVATE __attribute__((visibility("hidden"))) -# endif // PQXX_HAVE_GCC_VISIBILITY +#endif // PQXX_HAVE_GCC_VISIBILITY -# ifndef PQXX_LIBEXPORT -# define PQXX_LIBEXPORT /* libexport */ -# endif +#ifndef PQXX_LIBEXPORT +# define PQXX_LIBEXPORT /* libexport */ +#endif -# ifndef PQXX_PRIVATE -# define PQXX_PRIVATE /* private */ -# endif +#ifndef PQXX_PRIVATE +# define PQXX_PRIVATE /* private */ +#endif -# ifndef PQXX_NOVTABLE -# define PQXX_NOVTABLE /* novtable */ -# endif +#ifndef PQXX_NOVTABLE +# define PQXX_NOVTABLE /* novtable */ +#endif // C++20: Assume support. -# if defined(PQXX_HAVE_LIKELY) -# define PQXX_LIKELY [[likely]] -# define PQXX_UNLIKELY [[unlikely]] -# else -# define PQXX_LIKELY /* [[likely]] */ -# define PQXX_UNLIKELY /* [[unlikely]] */ -# endif +#if defined(PQXX_HAVE_LIKELY) +# define PQXX_LIKELY [[likely]] +# define PQXX_UNLIKELY [[unlikely]] +#else +# define PQXX_LIKELY /* [[likely]] */ +# define PQXX_UNLIKELY /* [[unlikely]] */ +#endif diff --git a/src/field.cxx b/src/field.cxx index 7dcde11ce..f5026ced2 100644 --- a/src/field.cxx +++ b/src/field.cxx @@ -14,8 +14,8 @@ #include "pqxx/internal/header-pre.hxx" -#include "pqxx/internal/libpq-forward.hxx" #include "pqxx/field.hxx" +#include "pqxx/internal/libpq-forward.hxx" #include "pqxx/result.hxx" #include "pqxx/row.hxx" diff --git a/src/params.cxx b/src/params.cxx index 1308dd0ec..66b17368b 100644 --- a/src/params.cxx +++ b/src/params.cxx @@ -8,9 +8,11 @@ */ #include "pqxx-source.hxx" +#include "pqxx/internal/header-post.hxx" + #include "pqxx/internal/header-pre.hxx" + #include "pqxx/params.hxx" -#include "pqxx/internal/header-post.hxx" void pqxx::internal::c_params::reserve(std::size_t n) & diff --git a/src/time.cxx b/src/time.cxx index bc6925f3a..6b3ffdb1c 100644 --- a/src/time.cxx +++ b/src/time.cxx @@ -5,7 +5,9 @@ #include #include "pqxx/internal/header-pre.hxx" + #include "pqxx/time.hxx" + #include "pqxx/internal/header-post.hxx" // std::chrono::year_month_day is C++20, so let's worry a bit less about C++17 diff --git a/test/test04.cxx b/test/test04.cxx index fe19b85f1..623446398 100644 --- a/test/test04.cxx +++ b/test/test04.cxx @@ -4,7 +4,9 @@ #include #include + #include + #include #include diff --git a/test/test87.cxx b/test/test87.cxx index bd83501dc..3a9a58b16 100644 --- a/test/test87.cxx +++ b/test/test87.cxx @@ -6,7 +6,9 @@ #include #include + #include + #include #include diff --git a/test/unit/test_notification.cxx b/test/unit/test_notification.cxx index ef6e79869..6487169b4 100644 --- a/test/unit/test_notification.cxx +++ b/test/unit/test_notification.cxx @@ -1,7 +1,9 @@ #include #include + #include + #include #include