summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/config/test/abi
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/config/test/abi')
-rw-r--r--src/boost/libs/config/test/abi/abi_test.cpp27
-rw-r--r--src/boost/libs/config/test/abi/abi_test.hpp54
-rw-r--r--src/boost/libs/config/test/abi/main.cpp31
3 files changed, 112 insertions, 0 deletions
diff --git a/src/boost/libs/config/test/abi/abi_test.cpp b/src/boost/libs/config/test/abi/abi_test.cpp
new file mode 100644
index 00000000..98be1b19
--- /dev/null
+++ b/src/boost/libs/config/test/abi/abi_test.cpp
@@ -0,0 +1,27 @@
+// (C) Copyright John Maddock 2003.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/config for the most recent version.
+
+
+#include "abi_test.hpp"
+
+
+char abi_test::virtual_one()const
+{
+ return c;
+}
+
+boost::int32_t abi_test::virtual_two()const
+{
+ return i;
+}
+
+abi_test::abi_test()
+{
+ c = 0x12;
+ i = 0x5678;
+}
+
diff --git a/src/boost/libs/config/test/abi/abi_test.hpp b/src/boost/libs/config/test/abi/abi_test.hpp
new file mode 100644
index 00000000..a2bec783
--- /dev/null
+++ b/src/boost/libs/config/test/abi/abi_test.hpp
@@ -0,0 +1,54 @@
+// (C) Copyright John Maddock 2003.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/config for the most recent version.
+
+
+#ifndef BOOST_ABI_TEST_HPP
+#define BOOST_ABI_TEST_HPP
+
+#include <boost/config.hpp>
+#include <boost/cstdint.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#include BOOST_ABI_PREFIX
+#endif
+
+//
+// the following class is designed to break if the ABI
+// it's compiled with does not match that of the client
+// calling it....
+//
+
+struct empty{};
+
+class abi_test : protected empty
+{
+private:
+ empty e;
+ char c;
+ boost::int32_t i;
+public:
+ inline char inline_one()const
+ { return c; }
+ inline boost::int32_t inline_two()const
+ { return i; }
+
+ virtual char virtual_one()const;
+ virtual boost::int32_t virtual_two()const;
+
+ abi_test();
+};
+
+
+
+#ifdef BOOST_HAS_ABI_HEADERS
+#include BOOST_ABI_SUFFIX
+#endif
+
+#endif // BOOST_ABI_TEST_HPP
+
+
+
diff --git a/src/boost/libs/config/test/abi/main.cpp b/src/boost/libs/config/test/abi/main.cpp
new file mode 100644
index 00000000..e8f9d139
--- /dev/null
+++ b/src/boost/libs/config/test/abi/main.cpp
@@ -0,0 +1,31 @@
+// (C) Copyright John Maddock 2003.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/config for the most recent version.
+
+//
+// before we do anything else, we need to mess with the compilers ABI:
+//
+#include <boost/config.hpp>
+#ifdef BOOST_MSVC
+#pragma pack(1)
+#elif defined(__BORLANDC__)
+#pragma option -Ve- -Vx- -a1 -b-
+#endif
+#include <stdio.h>
+#include "abi_test.hpp"
+
+
+int main()
+{
+ abi_test t;
+ if((t.inline_one() != t.virtual_one()) || (t.inline_two() != t.virtual_two()))
+ {
+ fwrite("Failed ABI test", 1, 15, stdout);
+ return -1;
+ }
+ return 0;
+}
+