summaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings')
-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
6 files changed, 20 insertions, 9 deletions
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"