106 lines
2.3 KiB
Diff
106 lines
2.3 KiB
Diff
--- a/src/dbinc/db_cxx.in
|
|
+++ b/src/dbinc/db_cxx.in
|
|
@@ -50,6 +50,23 @@
|
|
|
|
#include <stdarg.h>
|
|
|
|
+/*
|
|
+ * Berkeley DB's C API exposes atomic_init and store as macros, which
|
|
+ * collides with libc++ declarations when db.h is already included.
|
|
+ * Hide the macros while pulling in the C++ standard headers, then
|
|
+ * restore them for the Berkeley DB interfaces below.
|
|
+ */
|
|
+#ifdef atomic_init
|
|
+#pragma push_macro("atomic_init")
|
|
+#undef atomic_init
|
|
+#define DB_CXX_RESTORE_ATOMIC_INIT
|
|
+#endif
|
|
+#ifdef store
|
|
+#pragma push_macro("store")
|
|
+#undef store
|
|
+#define DB_CXX_RESTORE_STORE
|
|
+#endif
|
|
+
|
|
@cxx_have_stdheaders@
|
|
#ifdef HAVE_CXX_STDHEADERS
|
|
#include <iostream>
|
|
@@ -61,6 +78,15 @@
|
|
#define __DB_STD(x) x
|
|
#endif
|
|
|
|
+#ifdef DB_CXX_RESTORE_STORE
|
|
+#pragma pop_macro("store")
|
|
+#undef DB_CXX_RESTORE_STORE
|
|
+#endif
|
|
+#ifdef DB_CXX_RESTORE_ATOMIC_INIT
|
|
+#pragma pop_macro("atomic_init")
|
|
+#undef DB_CXX_RESTORE_ATOMIC_INIT
|
|
+#endif
|
|
+
|
|
#include "db.h"
|
|
|
|
class Db; // forward
|
|
--- a/lang/cxx/stl/dbstl_exception.h
|
|
+++ b/lang/cxx/stl/dbstl_exception.h
|
|
@@ -13,9 +13,29 @@
|
|
#include <cstdlib>
|
|
#include <cstdio>
|
|
|
|
+#ifdef atomic_init
|
|
+#pragma push_macro("atomic_init")
|
|
+#undef atomic_init
|
|
+#define DB_STL_RESTORE_ATOMIC_INIT
|
|
+#endif
|
|
+#ifdef store
|
|
+#pragma push_macro("store")
|
|
+#undef store
|
|
+#define DB_STL_RESTORE_STORE
|
|
+#endif
|
|
+
|
|
#include <iostream>
|
|
#include <exception>
|
|
|
|
+#ifdef DB_STL_RESTORE_STORE
|
|
+#pragma pop_macro("store")
|
|
+#undef DB_STL_RESTORE_STORE
|
|
+#endif
|
|
+#ifdef DB_STL_RESTORE_ATOMIC_INIT
|
|
+#pragma pop_macro("atomic_init")
|
|
+#undef DB_STL_RESTORE_ATOMIC_INIT
|
|
+#endif
|
|
+
|
|
#include "dbstl_common.h"
|
|
|
|
START_NS(dbstl)
|
|
--- a/lang/cxx/stl/dbstl_element_ref.h
|
|
+++ b/lang/cxx/stl/dbstl_element_ref.h
|
|
@@ -9,8 +9,28 @@
|
|
#ifndef _DB_STL_KDPAIR_H
|
|
#define _DB_STL_KDPAIR_H
|
|
|
|
+#ifdef atomic_init
|
|
+#pragma push_macro("atomic_init")
|
|
+#undef atomic_init
|
|
+#define DB_STL_RESTORE_ATOMIC_INIT
|
|
+#endif
|
|
+#ifdef store
|
|
+#pragma push_macro("store")
|
|
+#undef store
|
|
+#define DB_STL_RESTORE_STORE
|
|
+#endif
|
|
+
|
|
#include <iostream>
|
|
|
|
+#ifdef DB_STL_RESTORE_STORE
|
|
+#pragma pop_macro("store")
|
|
+#undef DB_STL_RESTORE_STORE
|
|
+#endif
|
|
+#ifdef DB_STL_RESTORE_ATOMIC_INIT
|
|
+#pragma pop_macro("atomic_init")
|
|
+#undef DB_STL_RESTORE_ATOMIC_INIT
|
|
+#endif
|
|
+
|
|
#include "dbstl_common.h"
|
|
#include "dbstl_dbt.h"
|
|
#include "dbstl_exception.h"
|