summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-02-01 12:36:09 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-02-01 12:36:50 -0800
commitb3ca4bccc4fa6b7f5d637bdecb4fac6ca9649f3c (patch)
treef0b37780a744aa4f17c464e354dcd27612e7931e
parente3cb398a2baa95206a2c67e40e3b67d42c9a912e (diff)
downloadtmwa-b3ca4bccc4fa6b7f5d637bdecb4fac6ca9649f3c.tar.gz
tmwa-b3ca4bccc4fa6b7f5d637bdecb4fac6ca9649f3c.tar.bz2
tmwa-b3ca4bccc4fa6b7f5d637bdecb4fac6ca9649f3c.tar.xz
tmwa-b3ca4bccc4fa6b7f5d637bdecb4fac6ca9649f3c.zip
Fix build with clang against libstdc++ 4.6
-rw-r--r--.travis.yml2
-rw-r--r--src/common/const_array.hpp4
-rw-r--r--src/common/sanity.hpp43
-rw-r--r--src/login/login.cpp2
-rw-r--r--src/map/atcommand.cpp6
5 files changed, 37 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml
index c1a9d42..d0140b1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,7 +14,7 @@ notifications:
irc:
# TMW irc doesn't work for some reason; freenode does ...
# I'm leaving it like this because it's what I'd like to use.
- channels: "irc.themanaworld.org#tmw-dev"
+ channels: "chat.freenode.net#tmwa"
on_success: always
on_failure: always
diff --git a/src/common/const_array.hpp b/src/common/const_array.hpp
index eb0da58..db8416d 100644
--- a/src/common/const_array.hpp
+++ b/src/common/const_array.hpp
@@ -28,7 +28,7 @@
#include <string>
#include <vector>
-#ifdef ANNOYING_GCC46_WORKAROUNDS
+#ifdef WORKAROUND_GCC46_COMPILER
// constexpr is buggy with templates in this version
# define constexpr /* nothing */
#endif
@@ -161,7 +161,7 @@ public:
: const_array<char>(a)
{}
};
-#ifdef ANNOYING_GCC46_WORKAROUNDS
+#ifdef WORKAROUND_GCC46_COMPILER
# undef constexpr
#endif
diff --git a/src/common/sanity.hpp b/src/common/sanity.hpp
index e6f2807..8271ef8 100644
--- a/src/common/sanity.hpp
+++ b/src/common/sanity.hpp
@@ -4,11 +4,16 @@
# ifndef __cplusplus
# error "Please compile in C++ mode"
-# endif
+# endif // __cplusplus
# if __GNUC__ < 4
# error "Your compiler is absolutely ancient. You have no chance ..."
-# endif
+# endif // __GNUC__ < 4
+
+/// Convert type assumptions to use the standard types here
+# include <cstdint>
+/// size_t, NULL
+# include <cstddef>
# if __GNUC__ == 4
// clang identifies as GCC 4.2, but is mostly okay.
@@ -16,28 +21,40 @@
// (patched) clang 3.1 would be the requirement
# if __GNUC_MINOR__ < 6 && !defined(__clang__)
# error "Please upgrade to at least GCC 4.6"
-# endif
+# endif // __GNUC_MINOR__ < 6 && !defined(__clang__)
+// temporary workaround for library issues
+// since __GLIBCXX__ is hard to use
# if __GNUC_MINOR__ == 6
-# define ANNOYING_GCC46_WORKAROUNDS
-# endif
-# endif
+# define WORKAROUND_GCC46_COMPILER
+# endif // __GNUC_MINOR__ == 6
+# ifdef __GLIBCXX__
+// versions of libstdc++ from gcc
+// 4.6.0, 4.6.1, 4.6.2, 4.6.3
+# if __GLIBCXX__ == 20110325 \
+ || __GLIBCXX__ == 20110627 \
+ || __GLIBCXX__ == 20111026 \
+ || __GLIBCXX__ == 20120301 \
+ || __GLIBCXX__ == 20121127 // prerelease in Debian wheezy
+# define WORKAROUND_GCC46_LIBRARY
+# endif // __GLIBCXX__ == ...
+# endif // defined __GLIBCXX__
+# if defined(WORKAROUND_GCC46_COMPILER) \
+ && !defined(WORKAROUND_GCC46_LIBRARY)
+# error "Unknown gcc 4.6.x release"
+# endif // compiler and not library
+# endif // __GNUC__ == 4
# ifndef __i386__
// Known platform dependencies:
// endianness for the [RW]FIFO.* macros
// possibly, some signal-handling
# error "Unsupported platform"
-# endif
+# endif // not __i386__
# ifdef __x86_64__
// I'm working on it - I know there are some pointer-size assumptions.
# error "Sorry, this code is believed not to be 64-bit safe"
# error "please compile with -m32"
-# endif
-
-/// Convert type assumptions to use the standard types here
-# include <cstdint>
-/// size_t, NULL
-# include <cstddef>
+# endif // __x86_64__
#endif // SANITY_HPP
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 8277d8c..29b9954 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -595,7 +595,7 @@ int mmo_auth_init(void)
continue;
if (line.back() == '\r')
{
-#ifdef ANNOYING_GCC46_WORKAROUNDS
+#ifdef WORKAROUND_GCC46_LIBRARY
line.resize(line.size() - 1);
#else
line.pop_back();
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 0f6bb1f..968e428 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -5713,7 +5713,7 @@ int atcommand_character_item_list(const int fd, struct map_session_data *sd,
if (!output.empty())
{
// replace trailing ", "
-#ifdef ANNOYING_GCC46_WORKAROUNDS
+#ifdef WORKAROUND_GCC46_LIBRARY
output.resize(output.size() - 1);
#else
output.pop_back();
@@ -5838,7 +5838,7 @@ int atcommand_character_storage_list(const int fd, struct map_session_data *sd,
if (!output.empty())
{
// replace last ", "
-#ifdef ANNOYING_GCC46_WORKAROUNDS
+#ifdef WORKAROUND_GCC46_LIBRARY
output.resize(output.size() - 1);
#else
output.pop_back();
@@ -5967,7 +5967,7 @@ int atcommand_character_cart_list(const int fd, struct map_session_data *sd,
}
if (!output.empty())
{
-#ifdef ANNOYING_GCC46_WORKAROUNDS
+#ifdef WORKAROUND_GCC46_LIBRARY
output.resize(output.size() - 1);
#else
output.pop_back();