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/generic/enum.hpp | 1 + src/io/lock.cpp | 3 +++ src/io/write.cpp | 2 ++ src/io/write.hpp | 1 - src/mmo/extract.hpp | 4 ++++ src/mmo/utils.hpp | 3 +++ src/monitor/main.cpp | 1 + src/sexpr/lexer.hpp | 2 ++ src/sexpr/parser.cpp | 2 ++ src/sexpr/parser.hpp | 2 ++ 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 + 16 files changed, 40 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/generic/enum.hpp b/src/generic/enum.hpp index 8b3509f..a8a1088 100644 --- a/src/generic/enum.hpp +++ b/src/generic/enum.hpp @@ -23,6 +23,7 @@ # include +# include # include # include "../compat/iter.hpp" diff --git a/src/io/lock.cpp b/src/io/lock.cpp index 1342915..3f83611 100644 --- a/src/io/lock.cpp +++ b/src/io/lock.cpp @@ -21,6 +21,9 @@ #include #include +#include +#include + #include "../strings/zstring.hpp" #include "cxxstdio.hpp" diff --git a/src/io/write.cpp b/src/io/write.cpp index 5993a69..817e6c0 100644 --- a/src/io/write.cpp +++ b/src/io/write.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include "../strings/xstring.hpp" #include "../poison.hpp" diff --git a/src/io/write.hpp b/src/io/write.hpp index 870ebb5..39d3dee 100644 --- a/src/io/write.hpp +++ b/src/io/write.hpp @@ -34,7 +34,6 @@ namespace io private: FD fd; bool lb; - struct {} _unused; unsigned short buflen; char buf[4096]; public: diff --git a/src/mmo/extract.hpp b/src/mmo/extract.hpp index 622281b..f3df0f3 100644 --- a/src/mmo/extract.hpp +++ b/src/mmo/extract.hpp @@ -21,7 +21,11 @@ # include "../sanity.hpp" +# include +# include + # include +# include # include "../strings/xstring.hpp" diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp index d59f7ac..3002866 100644 --- a/src/mmo/utils.hpp +++ b/src/mmo/utils.hpp @@ -23,7 +23,10 @@ # include "../sanity.hpp" +# include + # include +# include # include diff --git a/src/monitor/main.cpp b/src/monitor/main.cpp index 21d6065..7bc7287 100644 --- a/src/monitor/main.cpp +++ b/src/monitor/main.cpp @@ -24,6 +24,7 @@ #include #include +#include #include "../strings/mstring.hpp" #include "../strings/astring.hpp" diff --git a/src/sexpr/lexer.hpp b/src/sexpr/lexer.hpp index 84c9e1d..f190f9f 100644 --- a/src/sexpr/lexer.hpp +++ b/src/sexpr/lexer.hpp @@ -21,6 +21,8 @@ # include "../sanity.hpp" +# include + # include "../strings/astring.hpp" # include "../strings/vstring.hpp" # include "../strings/xstring.hpp" diff --git a/src/sexpr/parser.cpp b/src/sexpr/parser.cpp index 2068565..c096649 100644 --- a/src/sexpr/parser.cpp +++ b/src/sexpr/parser.cpp @@ -18,6 +18,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include + #include "../poison.hpp" namespace sexpr diff --git a/src/sexpr/parser.hpp b/src/sexpr/parser.hpp index 6097f78..5352afc 100644 --- a/src/sexpr/parser.hpp +++ b/src/sexpr/parser.hpp @@ -21,6 +21,8 @@ # include "../sanity.hpp" +# include + # include "../strings/zstring.hpp" # include "../io/line.hpp" 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-60-g2f50