From 147c3e9c891c12dbfd39b65ee0f5baddf5f81b14 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 14 Apr 2014 14:27:59 -0700 Subject: Make clang and libc++ happy --- src/strings/astring.cpp | 2 ++ src/strings/astring.hpp | 6 ++++++ src/strings/base_test.cpp | 16 ++++++++-------- src/strings/literal.cpp | 2 ++ src/strings/literal.hpp | 2 +- src/strings/vstring.tcc | 1 + 6 files changed, 20 insertions(+), 9 deletions(-) (limited to 'src/strings') diff --git a/src/strings/astring.cpp b/src/strings/astring.cpp index 0906584..61c65b2 100644 --- a/src/strings/astring.cpp +++ b/src/strings/astring.cpp @@ -18,6 +18,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include "mstring.hpp" #include "tstring.hpp" #include "sstring.hpp" diff --git a/src/strings/astring.hpp b/src/strings/astring.hpp index b0fb196..7a569f9 100644 --- a/src/strings/astring.hpp +++ b/src/strings/astring.hpp @@ -33,6 +33,9 @@ namespace strings /// The storage is NUL-terminated class AString : public _crtp_string { +# ifdef __clang__ + __attribute__((unused)) +# endif RString *align[0]; char data[255]; unsigned char special; @@ -83,6 +86,9 @@ namespace strings char *mid; public: AStringConverter(AString& s); + // this usually gets elided, but multi dtor calls are fine anyway + AStringConverter(const AStringConverter&) = default; + AStringConverter& operator = (const AStringConverter&) = delete; ~AStringConverter(); char **operator &(); }; diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp index 524450d..6b3ba83 100644 --- a/src/strings/base_test.cpp +++ b/src/strings/base_test.cpp @@ -31,14 +31,14 @@ using namespace strings; struct _test : VString<1> {}; struct _test2 : VString<1> {}; -static_assert(string_comparison_allowed<_test, _test>::value, "tt"_s); -static_assert(string_comparison_allowed, VString<1>>::value, "vv"_s); -static_assert(!string_comparison_allowed<_test, XString>::value, "tx"_s); -static_assert(!string_comparison_allowed<_test, VString<1>>::value, "tv"_s); -static_assert(!string_comparison_allowed<_test, _test2>::value, "t2"_s); -static_assert(string_comparison_allowed, XString>::value, "vx"_s); -static_assert(string_comparison_allowed::value, "xx"_s); -static_assert(string_comparison_allowed::value, "xf"_s); +static_assert(string_comparison_allowed<_test, _test>::value, "tt"); +static_assert(string_comparison_allowed, VString<1>>::value, "vv"); +static_assert(!string_comparison_allowed<_test, XString>::value, "tx"); +static_assert(!string_comparison_allowed<_test, VString<1>>::value, "tv"); +static_assert(!string_comparison_allowed<_test, _test2>::value, "t2"); +static_assert(string_comparison_allowed, XString>::value, "vx"); +static_assert(string_comparison_allowed::value, "xx"); +static_assert(string_comparison_allowed::value, "xf"); TEST(strings, contains) { diff --git a/src/strings/literal.cpp b/src/strings/literal.cpp index 974a8bd..65c00f6 100644 --- a/src/strings/literal.cpp +++ b/src/strings/literal.cpp @@ -18,6 +18,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include "../poison.hpp" namespace strings diff --git a/src/strings/literal.hpp b/src/strings/literal.hpp index c5b9938..54192da 100644 --- a/src/strings/literal.hpp +++ b/src/strings/literal.hpp @@ -54,7 +54,7 @@ namespace strings FormatString(const char *f) : _format(f) {} public: constexpr - const char *format_string() { return _format; } + const char *format_string() const { return _format; } }; diff --git a/src/strings/vstring.tcc b/src/strings/vstring.tcc index ac3dc19..bb134b3 100644 --- a/src/strings/vstring.tcc +++ b/src/strings/vstring.tcc @@ -18,6 +18,7 @@ // along with this program. If not, see . #include +#include #include "../compat/cast.hpp" -- cgit v1.2.3-70-g09d2