summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/generic/enum.hpp1
-rw-r--r--src/io/lock.cpp3
-rw-r--r--src/io/write.cpp2
-rw-r--r--src/io/write.hpp1
-rw-r--r--src/mmo/extract.hpp4
-rw-r--r--src/mmo/utils.hpp3
-rw-r--r--src/monitor/main.cpp1
-rw-r--r--src/sexpr/lexer.hpp2
-rw-r--r--src/sexpr/parser.cpp2
-rw-r--r--src/sexpr/parser.hpp2
-rw-r--r--src/strings/astring.cpp2
-rw-r--r--src/strings/astring.hpp6
-rw-r--r--src/strings/base_test.cpp16
-rw-r--r--src/strings/literal.cpp2
-rw-r--r--src/strings/literal.hpp2
-rw-r--r--src/strings/vstring.tcc1
16 files changed, 40 insertions, 10 deletions
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 <cassert>
+# include <algorithm>
# include <type_traits>
# 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 <fcntl.h>
#include <unistd.h>
+#include <cerrno>
+#include <cstdlib>
+
#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 <fcntl.h>
#include <unistd.h>
+#include <cstdlib>
+
#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 <cerrno>
+# include <cstdlib>
+
# include <algorithm>
+# include <vector>
# 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 <sys/types.h>
+
# include <cstdio>
+# include <ctime>
# include <type_traits>
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 <unistd.h>
#include <csignal>
+#include <cstdlib>
#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 <vector>
+
# 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 <http://www.gnu.org/licenses/>.
+#include <cerrno>
+
#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 <cstdlib>
+
# 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 <http://www.gnu.org/licenses/>.
+#include <cstdlib>
+
#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<AString, AString, ZPair>
{
+# 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>, 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<VString<1>, XString>::value, "vx"_s);
-static_assert(string_comparison_allowed<XString, XString>::value, "xx"_s);
-static_assert(string_comparison_allowed<XString, RString>::value, "xf"_s);
+static_assert(string_comparison_allowed<_test, _test>::value, "tt");
+static_assert(string_comparison_allowed<VString<1>, 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<VString<1>, XString>::value, "vx");
+static_assert(string_comparison_allowed<XString, XString>::value, "xx");
+static_assert(string_comparison_allowed<XString, RString>::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 <http://www.gnu.org/licenses/>.
+#include <cstdio>
+
#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 <http://www.gnu.org/licenses/>.
#include <cassert>
+#include <cstdio>
#include "../compat/cast.hpp"