aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-21 05:01:45 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-21 05:01:45 +0000
commit2b51ff0dfcee66b2ed67ef3ce53eb3ef769cb585 (patch)
treee8f50c53751966585cd4490c722277179a5693da /vespalib
parent9dd38b4d1f01fded878ef6b5488e48cccc5f4acd (diff)
Deinline some non-trivial methods and do not provide assert.h in string.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/component/version.cpp19
-rw-r--r--vespalib/src/vespa/vespalib/component/version.h11
-rw-r--r--vespalib/src/vespa/vespalib/component/versionspecification.cpp17
-rw-r--r--vespalib/src/vespa/vespalib/component/versionspecification.h15
-rw-r--r--vespalib/src/vespa/vespalib/component/vtag.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/eval/basic_nodes.h7
-rw-r--r--vespalib/src/vespa/vespalib/net/socket_address.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/objects/nbostream.hpp1
-rw-r--r--vespalib/src/vespa/vespalib/stllike/asciistream.cpp19
-rw-r--r--vespalib/src/vespa/vespalib/stllike/asciistream.h6
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.cpp38
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.h110
-rw-r--r--vespalib/src/vespa/vespalib/stllike/string.hpp80
-rw-r--r--vespalib/src/vespa/vespalib/tensor/dense/dense_tensor_builder.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_padder.h1
-rw-r--r--vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_reducer.h1
-rw-r--r--vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_builder.cpp1
-rw-r--r--vespalib/src/vespa/vespalib/text/lowercase.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/text/stringtokenizer.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/text/utf8.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/trace/tracenode.cpp15
-rw-r--r--vespalib/src/vespa/vespalib/trace/tracevisitor.h3
-rw-r--r--vespalib/src/vespa/vespalib/util/stringfmt.cpp1
23 files changed, 200 insertions, 155 deletions
diff --git a/vespalib/src/vespa/vespalib/component/version.cpp b/vespalib/src/vespa/vespalib/component/version.cpp
index ea8f3fdbde9..8e385b74eae 100644
--- a/vespalib/src/vespa/vespalib/component/version.cpp
+++ b/vespalib/src/vespa/vespalib/component/version.cpp
@@ -1,17 +1,26 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "version.h"
-#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <ctype.h>
#include <vespa/vespalib/stllike/asciistream.h>
-
-using vespalib::stringref;
+#include <cctype>
+#include <climits>
namespace vespalib {
+Version::Version(int major, int minor, int micro, const string & qualifier)
+ : _major(major),
+ _minor(minor),
+ _micro(micro),
+ _qualifier(qualifier),
+ _stringValue()
+{
+ initialize();
+}
+
+Version::~Version() { }
+
void
Version::initialize()
{
diff --git a/vespalib/src/vespa/vespalib/component/version.h b/vespalib/src/vespa/vespalib/component/version.h
index e637e46ff90..58c680ce8f1 100644
--- a/vespalib/src/vespa/vespalib/component/version.h
+++ b/vespalib/src/vespa/vespalib/component/version.h
@@ -59,15 +59,8 @@ public:
* the qualifier string contains non-word/digit-characters
*/
- Version(int major = 0, int minor = 0, int micro = 0, const string & qualifier = "")
- : _major(major),
- _minor(minor),
- _micro(micro),
- _qualifier(qualifier),
- _stringValue()
- {
- initialize();
- }
+ Version(int major = 0, int minor = 0, int micro = 0, const string & qualifier = "");
+ ~Version();
/**
* @brief Creates a version identifier from the specified string.
diff --git a/vespalib/src/vespa/vespalib/component/versionspecification.cpp b/vespalib/src/vespa/vespalib/component/versionspecification.cpp
index af200b21caa..e54550a7fc8 100644
--- a/vespalib/src/vespa/vespalib/component/versionspecification.cpp
+++ b/vespalib/src/vespa/vespalib/component/versionspecification.cpp
@@ -1,16 +1,27 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "version.h"
#include "versionspecification.h"
-#include <vespa/vespalib/util/exception.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/text/stringtokenizer.h>
#include <vespa/vespalib/stllike/asciistream.h>
-#include <ctype.h>
+#include <cctype>
+#include <climits>
namespace vespalib {
+VersionSpecification::VersionSpecification(int major, int minor, int micro, const string & qualifier)
+ : _major(major),
+ _minor(minor),
+ _micro(micro),
+ _qualifier(qualifier),
+ _stringValue()
+{
+ initialize();
+}
+
+VersionSpecification::~VersionSpecification() { }
+
void
VersionSpecification::initialize()
{
diff --git a/vespalib/src/vespa/vespalib/component/versionspecification.h b/vespalib/src/vespa/vespalib/component/versionspecification.h
index f19af4c429f..547b140c701 100644
--- a/vespalib/src/vespa/vespalib/component/versionspecification.h
+++ b/vespalib/src/vespa/vespalib/component/versionspecification.h
@@ -65,18 +65,9 @@ public:
* an earlier component is not specified but a later one is
*/
- VersionSpecification(int major = UNSPECIFIED,
- int minor = UNSPECIFIED,
- int micro = UNSPECIFIED,
- const string & qualifier = "")
- : _major(major),
- _minor(minor),
- _micro(micro),
- _qualifier(qualifier),
- _stringValue()
- {
- initialize();
- }
+ VersionSpecification(int major = UNSPECIFIED, int minor = UNSPECIFIED,
+ int micro = UNSPECIFIED, const string & qualifier = "");
+ ~VersionSpecification();
/**
* @brief Creates a version specification from the specified string.
diff --git a/vespalib/src/vespa/vespalib/component/vtag.cpp b/vespalib/src/vespa/vespalib/component/vtag.cpp
index c6619c29f1c..f62c5dcda55 100644
--- a/vespalib/src/vespa/vespalib/component/vtag.cpp
+++ b/vespalib/src/vespa/vespalib/component/vtag.cpp
@@ -1,5 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <stdio.h>
+#include <cstdio>
#include "vtag.h"
#ifndef V_TAG
diff --git a/vespalib/src/vespa/vespalib/eval/basic_nodes.h b/vespalib/src/vespa/vespalib/eval/basic_nodes.h
index aadf0cbf25a..2887856a66d 100644
--- a/vespalib/src/vespa/vespalib/eval/basic_nodes.h
+++ b/vespalib/src/vespa/vespalib/eval/basic_nodes.h
@@ -2,12 +2,13 @@
#pragma once
-#include <memory>
-#include <map>
-#include <vector>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/string_hash.h>
+#include <memory>
+#include <map>
+#include <vector>
+#include <cassert>
namespace vespalib {
namespace eval {
diff --git a/vespalib/src/vespa/vespalib/net/socket_address.cpp b/vespalib/src/vespa/vespalib/net/socket_address.cpp
index 76ae01418c6..d6cb5a3582b 100644
--- a/vespalib/src/vespa/vespalib/net/socket_address.cpp
+++ b/vespalib/src/vespa/vespalib/net/socket_address.cpp
@@ -7,6 +7,7 @@
#include <sys/un.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <cassert>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.hpp b/vespalib/src/vespa/vespalib/objects/nbostream.hpp
index 767c485550c..9de31b10916 100644
--- a/vespalib/src/vespa/vespalib/objects/nbostream.hpp
+++ b/vespalib/src/vespa/vespalib/objects/nbostream.hpp
@@ -2,6 +2,7 @@
#pragma once
#include "nbostream.h"
+#include <cassert>
namespace vespalib {
diff --git a/vespalib/src/vespa/vespalib/stllike/asciistream.cpp b/vespalib/src/vespa/vespalib/stllike/asciistream.cpp
index f49e1a29581..bcd4cd1dcb5 100644
--- a/vespalib/src/vespa/vespalib/stllike/asciistream.cpp
+++ b/vespalib/src/vespa/vespalib/stllike/asciistream.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <algorithm>
@@ -8,6 +7,7 @@
#include <stdexcept>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/memory.h>
+#include <vespa/fastos/file.h>
namespace vespalib {
@@ -28,6 +28,20 @@ namespace {
std::vector<string> autoPrecisions = getPrecisions('g');
}
+asciistream &
+asciistream::operator << (Precision v) {
+ assert(v.getPrecision() <= VESPALIB_ASCIISTREAM_MAX_PRECISION);
+ _precision = v.getPrecision();
+ return *this;
+}
+
+asciistream &
+asciistream::operator >> (Precision v) {
+ assert(v.getPrecision() <= VESPALIB_ASCIISTREAM_MAX_PRECISION);
+ _precision = v.getPrecision();
+ return *this;
+}
+
asciistream::asciistream() :
_rPos(0),
_wbuf(),
@@ -38,8 +52,7 @@ asciistream::asciistream() :
_width(0),
_fill(' '),
_precision(6)
-{
-}
+{ }
asciistream::asciistream(const stringref & buf) :
_rPos(0),
diff --git a/vespalib/src/vespa/vespalib/stllike/asciistream.h b/vespalib/src/vespa/vespalib/stllike/asciistream.h
index 64d1cbb7fcc..14d0b1b35b3 100644
--- a/vespalib/src/vespa/vespalib/stllike/asciistream.h
+++ b/vespalib/src/vespa/vespalib/stllike/asciistream.h
@@ -35,6 +35,8 @@ public:
~asciistream();
asciistream(const asciistream & rhs);
asciistream & operator = (const asciistream & rhs);
+ asciistream(asciistream &&) = default;
+ asciistream & operator = (asciistream &&) = default;
void swap(asciistream & rhs);
asciistream & operator << (bool v) { if (v) { *this << '1'; } else { *this << '0'; } return *this; }
asciistream & operator << (char v) { doFill(1); write(&v, 1); return *this; }
@@ -139,8 +141,8 @@ public:
asciistream & operator >> (Width v) { _width = v.getWidth(); return *this; }
asciistream & operator << (Fill v) { _fill = v.getFill(); return *this; }
asciistream & operator >> (Fill v) { _fill = v.getFill(); return *this; }
- asciistream & operator << (Precision v) { assert(v.getPrecision() <= VESPALIB_ASCIISTREAM_MAX_PRECISION); _precision = v.getPrecision(); return *this; }
- asciistream & operator >> (Precision v) { assert(v.getPrecision() <= VESPALIB_ASCIISTREAM_MAX_PRECISION); _precision = v.getPrecision(); return *this; }
+ asciistream & operator << (Precision v);
+ asciistream & operator >> (Precision v);
void eatWhite();
static asciistream createFromFile(const vespalib::stringref & fileName);
static asciistream createFromDevice(const vespalib::stringref & fileName);
diff --git a/vespalib/src/vespa/vespalib/stllike/string.cpp b/vespalib/src/vespa/vespalib/stllike/string.cpp
index e8a6552f531..be09f00d4b0 100644
--- a/vespalib/src/vespa/vespalib/stllike/string.cpp
+++ b/vespalib/src/vespa/vespalib/stllike/string.cpp
@@ -1,6 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include <vespa/vespalib/stllike/string.hpp>
#include <ostream>
#include <istream>
@@ -9,6 +8,43 @@ namespace vespalib {
const stringref::size_type stringref::npos;
+stringref::size_type
+stringref::rfind(const char * s, size_type e) const {
+ size_type n = strlen(s);
+ if (n <= size()) {
+ size_type sz = std::min(size()-n, e);
+ const char *b = begin();
+ do {
+ if (s[0] == b[sz]) {
+ bool found(true);
+ for(size_t i(1); found && (i < n); i++) {
+ found = s[i] == b[sz+i];
+ }
+ if (found) {
+ return sz;
+ }
+ }
+ } while (sz-- > 0);
+ }
+ return npos;
+}
+
+stringref::size_type
+stringref::find(const stringref & s, size_type start) const {
+ const char *buf = begin()+start;
+ const char *e = end() - s.size();
+ while (buf <= e) {
+ size_t i(0);
+ for (; (i < s.size()) && (buf[i] == s[i]); i++);
+ if (i == s.size()) {
+ return buf - begin();
+ } else {
+ buf++;
+ }
+ }
+ return npos;
+}
+
std::ostream & operator << (std::ostream & os, const stringref & v)
{
return os.write(v.c_str(), v.size());
diff --git a/vespalib/src/vespa/vespalib/stllike/string.h b/vespalib/src/vespa/vespalib/stllike/string.h
index 79dd95ebf37..bb562ac3a00 100644
--- a/vespalib/src/vespa/vespalib/stllike/string.h
+++ b/vespalib/src/vespa/vespalib/stllike/string.h
@@ -1,11 +1,10 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <assert.h>
#include <string>
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdint>
+#include <cstdlib>
#include <vespa/vespalib/util/alloc.h>
namespace vespalib {
@@ -75,20 +74,7 @@ public:
* @return index from the start of the string at which the character
* was found, or npos if the character could not be located
*/
- size_type find(const stringref & s, size_type start=0) const {
- const char *buf = begin()+start;
- const char *e = end() - s.size();
- while (buf <= e) {
- size_t i(0);
- for (; (i < s.size()) && (buf[i] == s[i]); i++);
- if (i == s.size()) {
- return buf - begin();
- } else {
- buf++;
- }
- }
- return npos;
- }
+ size_type find(const stringref & s, size_type start=0) const;
/**
* Find the first occurrence of a character, searching from @c start
*
@@ -132,25 +118,7 @@ public:
* @return index from the start of the string at which the substring
* was found, or npos if the substring could not be located
*/
- size_type rfind(const char * s, size_type e=npos) const {
- size_type n = strlen(s);
- if (n <= size()) {
- size_type sz = std::min(size()-n, e);
- const char *b = begin();
- do {
- if (s[0] == b[sz]) {
- bool found(true);
- for(size_t i(1); found && (i < n); i++) {
- found = s[i] == b[sz+i];
- }
- if (found) {
- return sz;
- }
- }
- } while (sz-- > 0);
- }
- return npos;
- }
+ size_type rfind(const char * s, size_type e=npos) const;
int compare(const stringref & s) const { return compare(s.c_str(), s.size()); }
int compare(const char *s, size_type sz) const {
int diff(memcmp(_s, s, std::min(sz, size())));
@@ -282,25 +250,7 @@ public:
* @return index from the start of the string at which the substring
* was found, or npos if the substring could not be located
*/
- size_type rfind(const char * s, size_type e=npos) const {
- size_type n = strlen(s);
- if (n <= size()) {
- size_type sz = std::min(size()-n, e);
- const char *b = buffer();
- do {
- if (s[0] == b[sz]) {
- bool found(true);
- for(size_t i(1); found && (i < n); i++) {
- found = s[i] == b[sz+i];
- }
- if (found) {
- return sz;
- }
- }
- } while (sz-- > 0);
- }
- return npos;
- }
+ size_type rfind(const char * s, size_type e=npos) const;
/**
* Find the last occurrence of a character, starting at e and
@@ -369,17 +319,7 @@ public:
return (found != NULL) ? (found - buffer()) : (size_type)npos;
}
small_string & assign(const char * s) { return assign(s, strlen(s)); }
- small_string & assign(const void * s, size_type sz) {
- if (__builtin_expect(capacity() >= sz, true)) {
- char *buf = buffer();
- memmove(buf, s, sz);
- buf[sz] = '\0';
- _sz = sz;
- } else {
- assign_slower(s, sz);
- }
- return *this;
- }
+ small_string & assign(const void * s, size_type sz);
small_string & assign(const stringref &s, size_type pos, size_type sz) {
return assign(s.c_str() + pos, sz);
}
@@ -478,10 +418,7 @@ public:
* @param p2 position in s where replacement content starts
* @param n2 how many new characters to use
**/
- small_string& replace (size_t p1, size_t n1, const small_string& s, size_t p2, size_t n2 ) {
- assert(s.size() >= (p2+n2));
- return replace(p1, n1, s.c_str()+p2, n2);
- }
+ small_string& replace (size_t p1, size_t n1, const small_string& s, size_t p2, size_t n2);
/**
* at position p1, replace n1 characters with
@@ -492,18 +429,7 @@ public:
* @param s pointer to new content
* @param n2 how many new characters to use
**/
- small_string& replace (size_t p1, size_t n1, const char *s, size_t n2 ) {
- assert (size() >= (p1 + n1));
- const size_t newSz = n2 + size() - n1;
- if (n1 < n2) {
- reserve(newSz);
- }
- size_t rest = size()-(p1+n1);
- memmove(buffer()+p1+n2, buffer()+p1+n1, rest);
- memcpy(buffer()+p1, s, n2);
- _resize(newSz);
- return *this;
- }
+ small_string& replace (size_t p1, size_t n1, const char *s, size_t n2);
/**
* at position p1, replace n1 characters with the contents of s
@@ -576,14 +502,11 @@ public:
/**
* Will extend the string within its current buffer. Assumes memory is already initialized.
* Can not extend beyond capacity.
- * Not this is non-STL.
+ * Note this is non-STL.
*
* @param newSz new size of string.
*/
- void append_from_reserved(size_type sz) {
- assert(size() + sz <= capacity());
- _resize(size() + sz);
- }
+ void append_from_reserved(size_type sz);
/**
* Ensure string has at least newCapacity characters of available
@@ -598,17 +521,10 @@ public:
private:
void assign_slower(const void * s, size_type sz) __attribute((noinline));
void init_slower(const void *s) __attribute((noinline));
+ void _reserveBytes(size_type newBufferSize);
void reserveBytes(size_type newBufferSize) {
if (newBufferSize > _bufferSize) {
- if (isAllocated()) {
- _buf = (char *) realloc(_buf, newBufferSize);
- } else {
- char *tmp = (char *) malloc(newBufferSize);
- memcpy(tmp, _stack, _sz);
- tmp[_sz] = '\0';
- _buf = tmp;
- }
- _bufferSize = newBufferSize;
+ _reserveBytes(newBufferSize);
}
}
typedef uint32_t isize_type;
diff --git a/vespalib/src/vespa/vespalib/stllike/string.hpp b/vespalib/src/vespa/vespalib/stllike/string.hpp
index 2c5548e30cd..94d5475740b 100644
--- a/vespalib/src/vespa/vespalib/stllike/string.hpp
+++ b/vespalib/src/vespa/vespalib/stllike/string.hpp
@@ -1,8 +1,88 @@
#include "string.h"
+#include <cassert>
namespace vespalib {
template <uint32_t StackSize>
+void
+small_string<StackSize>::append_from_reserved(size_type sz) {
+ assert(size() + sz <= capacity());
+ _resize(size() + sz);
+}
+
+template <uint32_t StackSize>
+void
+small_string<StackSize>::_reserveBytes(size_type newBufferSize) {
+ if (isAllocated()) {
+ _buf = (char *) realloc(_buf, newBufferSize);
+ } else {
+ char *tmp = (char *) malloc(newBufferSize);
+ memcpy(tmp, _stack, _sz);
+ tmp[_sz] = '\0';
+ _buf = tmp;
+ }
+ _bufferSize = newBufferSize;
+}
+
+template <uint32_t StackSize>
+small_string<StackSize>&
+small_string<StackSize>::replace (size_t p1, size_t n1, const small_string& s, size_t p2, size_t n2 ) {
+ assert(s.size() >= (p2+n2));
+ return replace(p1, n1, s.c_str()+p2, n2);
+}
+
+template <uint32_t StackSize>
+small_string<StackSize>&
+small_string<StackSize>::replace (size_t p1, size_t n1, const char *s, size_t n2 ) {
+ assert (size() >= (p1 + n1));
+ const size_t newSz = n2 + size() - n1;
+ if (n1 < n2) {
+ reserve(newSz);
+ }
+ size_t rest = size()-(p1+n1);
+ memmove(buffer()+p1+n2, buffer()+p1+n1, rest);
+ memcpy(buffer()+p1, s, n2);
+ _resize(newSz);
+ return *this;
+}
+
+template <uint32_t StackSize>
+typename small_string<StackSize>::size_type
+small_string<StackSize>::rfind(const char * s, size_type e) const {
+ size_type n = strlen(s);
+ if (n <= size()) {
+ size_type sz = std::min(size()-n, e);
+ const char *b = buffer();
+ do {
+ if (s[0] == b[sz]) {
+ bool found(true);
+ for(size_t i(1); found && (i < n); i++) {
+ found = s[i] == b[sz+i];
+ }
+ if (found) {
+ return sz;
+ }
+ }
+ } while (sz-- > 0);
+ }
+ return npos;
+}
+
+template <uint32_t StackSize>
+small_string<StackSize> &
+small_string<StackSize>::assign(const void * s, size_type sz) {
+ if (__builtin_expect(capacity() >= sz, true)) {
+ char *buf = buffer();
+ memmove(buf, s, sz);
+ buf[sz] = '\0';
+ _sz = sz;
+ } else {
+ assign_slower(s, sz);
+ }
+ return *this;
+}
+
+template <uint32_t StackSize>
void small_string<StackSize>::assign_slower(const void * s, size_type sz)
{
reset();
diff --git a/vespalib/src/vespa/vespalib/tensor/dense/dense_tensor_builder.cpp b/vespalib/src/vespa/vespalib/tensor/dense/dense_tensor_builder.cpp
index db2a4ffaac8..872be49f9b4 100644
--- a/vespalib/src/vespa/vespalib/tensor/dense/dense_tensor_builder.cpp
+++ b/vespalib/src/vespa/vespalib/tensor/dense/dense_tensor_builder.cpp
@@ -2,6 +2,7 @@
#include "dense_tensor_builder.h"
#include <vespa/vespalib/util/exceptions.h>
+#include <cassert>
using vespalib::IllegalArgumentException;
using vespalib::make_string;
diff --git a/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_padder.h b/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_padder.h
index abf73d5458e..89372004a09 100644
--- a/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_padder.h
+++ b/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_padder.h
@@ -4,6 +4,7 @@
#include "sparse_tensor_address_builder.h"
#include "sparse_tensor_address_decoder.h"
+#include <cassert>
namespace vespalib {
namespace tensor {
diff --git a/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_reducer.h b/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_reducer.h
index d92d83236c9..d1698681a55 100644
--- a/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_reducer.h
+++ b/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_address_reducer.h
@@ -5,6 +5,7 @@
#include "sparse_tensor_address_builder.h"
#include <vespa/vespalib/tensor/types.h>
#include "sparse_tensor_address_decoder.h"
+#include <cassert>
namespace vespalib {
namespace eval { class ValueType; }
diff --git a/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_builder.cpp b/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_builder.cpp
index beddc79cc9a..afab04fef6c 100644
--- a/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_builder.cpp
+++ b/vespalib/src/vespa/vespalib/tensor/sparse/sparse_tensor_builder.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "sparse_tensor_builder.h"
+#include <cassert>
namespace vespalib {
namespace tensor {
diff --git a/vespalib/src/vespa/vespalib/text/lowercase.cpp b/vespalib/src/vespa/vespalib/text/lowercase.cpp
index 1e320c657b3..8320fe2e53a 100644
--- a/vespalib/src/vespa/vespalib/text/lowercase.cpp
+++ b/vespalib/src/vespa/vespalib/text/lowercase.cpp
@@ -1,7 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
-#include <assert.h>
#include "lowercase.h"
#include <vespa/vespalib/text/utf8.h>
diff --git a/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp b/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp
index 8ce49bec213..d1e9ef9e9ca 100644
--- a/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp
+++ b/vespalib/src/vespa/vespalib/text/stringtokenizer.cpp
@@ -1,8 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/fastos/fastos.h>
#include "stringtokenizer.h"
-#include <set>
namespace {
diff --git a/vespalib/src/vespa/vespalib/text/utf8.cpp b/vespalib/src/vespa/vespalib/text/utf8.cpp
index 6fba50825af..f970ec4a725 100644
--- a/vespalib/src/vespa/vespalib/text/utf8.cpp
+++ b/vespalib/src/vespa/vespalib/text/utf8.cpp
@@ -3,7 +3,7 @@
#include "utf8.h"
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/exceptions.h>
-#include <assert.h>
+#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".vespalib.utf8");
diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.cpp b/vespalib/src/vespa/vespalib/trace/tracenode.cpp
index 39c138bb875..5cd3a18f19a 100644
--- a/vespalib/src/vespa/vespalib/trace/tracenode.cpp
+++ b/vespalib/src/vespa/vespalib/trace/tracenode.cpp
@@ -2,9 +2,8 @@
#include <vespa/vespalib/trace/tracenode.h>
#include <vespa/vespalib/trace/tracevisitor.h>
-
#include <algorithm>
-#include <vespa/fastos/fastos.h>
+
#include <vespa/log/log.h>
LOG_SETUP(".tracenode");
@@ -48,9 +47,7 @@ TraceNode::TraceNode() :
_note(""),
_children(),
_timestamp(0)
-{
- // empty
-}
+{ }
TraceNode::TraceNode(const TraceNode &rhs) :
_parent(NULL),
@@ -72,9 +69,7 @@ TraceNode::TraceNode(const string &note, int64_t timestamp) :
_note(note),
_children(),
_timestamp(timestamp)
-{
- // empty
-}
+{ }
TraceNode::TraceNode(int64_t timestamp) :
_parent(NULL),
@@ -83,9 +78,7 @@ TraceNode::TraceNode(int64_t timestamp) :
_note(""),
_children(),
_timestamp(timestamp)
-{
- // empty
-}
+{ }
TraceNode &
TraceNode::swap(TraceNode &other)
diff --git a/vespalib/src/vespa/vespalib/trace/tracevisitor.h b/vespalib/src/vespa/vespalib/trace/tracevisitor.h
index ceed30a7fd0..6c61073884b 100644
--- a/vespalib/src/vespa/vespalib/trace/tracevisitor.h
+++ b/vespalib/src/vespa/vespalib/trace/tracevisitor.h
@@ -1,9 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include <vector>
-#include <vespa/vespalib/stllike/string.h>
-
namespace vespalib {
class TraceNode;
diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.cpp b/vespalib/src/vespa/vespalib/util/stringfmt.cpp
index ca6d2d5af17..3a82194bb41 100644
--- a/vespalib/src/vespa/vespalib/util/stringfmt.cpp
+++ b/vespalib/src/vespa/vespalib/util/stringfmt.cpp
@@ -2,6 +2,7 @@
#include "stringfmt.h"
#include "vstringfmt.h"
+#include <cassert>
namespace vespalib {