diff options
77 files changed, 180 insertions, 304 deletions
diff --git a/configd/src/apps/sentinel/sentinel.cpp b/configd/src/apps/sentinel/sentinel.cpp index 61aec8b3376..45bbbe19cf3 100644 --- a/configd/src/apps/sentinel/sentinel.cpp +++ b/configd/src/apps/sentinel/sentinel.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/config/common/exceptions.h> -#include <signal.h> +#include <csignal> #include <unistd.h> #include <sys/time.h> #include <vespa/defaults.h> diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index 492616c2db4..fc1f768f989 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -4,7 +4,7 @@ #include "output-connection.h" #include <vespa/vespalib/util/stringfmt.h> -#include <signal.h> +#include <csignal> #include <unistd.h> #include <fcntl.h> #include <sys/wait.h> diff --git a/document/src/tests/heapdebuggerlinux.cpp b/document/src/tests/heapdebuggerlinux.cpp index 125bb2cce24..1b9b2e48e1a 100644 --- a/document/src/tests/heapdebuggerlinux.cpp +++ b/document/src/tests/heapdebuggerlinux.cpp @@ -22,7 +22,7 @@ #include <iostream> #include <pthread.h> -#include <signal.h> +#include <csignal> #include <unistd.h> #include <string.h> #include <ctype.h> diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp index cc5ec08dc73..479896f9124 100644 --- a/document/src/vespa/document/select/valuenodes.cpp +++ b/document/src/vespa/document/select/valuenodes.cpp @@ -13,6 +13,7 @@ #include <vespa/vespalib/text/lowercase.h> #include <regex> #include <iomanip> +#include <sys/time.h> #include <vespa/log/log.h> diff --git a/fastos/src/tests/backtracetest.cpp b/fastos/src/tests/backtracetest.cpp index 48935e4b6a3..df0887c6b63 100644 --- a/fastos/src/tests/backtracetest.cpp +++ b/fastos/src/tests/backtracetest.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/backtrace.h> -#include <assert.h> +#include <cassert> #include <string.h> #include "tests.h" diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp index 0b6e8c9360d..3a9c9dab565 100644 --- a/fastos/src/tests/sockettest.cpp +++ b/fastos/src/tests/sockettest.cpp @@ -4,6 +4,7 @@ #include <vespa/fastos/file.h> #include <vespa/fastos/serversocket.h> #include <cassert> +#include <arpa/inet.h> #define MAZE_FILE_OFFSET 1078 diff --git a/fastos/src/vespa/fastos/process.h b/fastos/src/vespa/fastos/process.h index e29b90d49cd..1810a730d9d 100644 --- a/fastos/src/vespa/fastos/process.h +++ b/fastos/src/vespa/fastos/process.h @@ -11,6 +11,7 @@ #pragma once #include "types.h" +#include <cstddef> /** * This class serves as a sink for redirected (piped) output from diff --git a/fastos/src/vespa/fastos/serversocket.cpp b/fastos/src/vespa/fastos/serversocket.cpp index 2ad8ed32bb3..a79e163db17 100644 --- a/fastos/src/vespa/fastos/serversocket.cpp +++ b/fastos/src/vespa/fastos/serversocket.cpp @@ -1,12 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//************************************************************************ -/** - * Implementation of FastOS_ServerSocket methods. - * - * @author Div, Oivind H. Danielsen - */ #include "serversocket.h" +#include <netinet/in.h> #include <cstring> @@ -23,75 +18,57 @@ void FastOS_ServerSocket::SetSocketFactory(FastOS_SocketFactory *socketFactory) FastOS_SocketInterface *FastOS_ServerSocket::CreateHandlerSocket(void) { - FastOS_SocketInterface *newSocket = NULL; - if (_socketFactory != NULL) - { - newSocket = _socketFactory->CreateSocket(); - } - else - { - newSocket = new FastOS_Socket(); - } - - return newSocket; + return (_socketFactory != nullptr) + ? _socketFactory->CreateSocket() + : (FastOS_SocketInterface *)new FastOS_Socket(); } FastOS_SocketInterface *FastOS_ServerSocket::Accept() { - FastOS_SocketInterface *handlerSocket = NULL; - int handlerSocketHandle; struct sockaddr_storage clientAddress; socklen_t clientAddressLength = sizeof(clientAddress); memset(&clientAddress, 0, sizeof(clientAddress)); - handlerSocketHandle = accept(_socketHandle, - reinterpret_cast<struct sockaddr *>(&clientAddress), - &clientAddressLength); + int handlerSocketHandle = accept(_socketHandle, reinterpret_cast<struct sockaddr *>(&clientAddress), + &clientAddressLength); - if (handlerSocketHandle >= 0) - { - handlerSocket = CreateHandlerSocket(); + if (handlerSocketHandle >= 0) { + FastOS_SocketInterface *handlerSocket = CreateHandlerSocket(); - if (handlerSocket != NULL) - { - handlerSocket->SetUp(handlerSocketHandle, - reinterpret_cast<struct sockaddr *>(&clientAddress)); + if (handlerSocket != nullptr) { + handlerSocket->SetUp(handlerSocketHandle, reinterpret_cast<struct sockaddr *>(&clientAddress)); } + return handlerSocket; } - return handlerSocket; + return nullptr; } FastOS_Socket *FastOS_ServerSocket::AcceptPlain() { - FastOS_Socket *handlerSocket = NULL; - int handlerSocketHandle; struct sockaddr_storage clientAddress; socklen_t clientAddressLength = sizeof(clientAddress); memset(&clientAddress, 0, sizeof(clientAddress)); - handlerSocketHandle = accept(_socketHandle, - reinterpret_cast<struct sockaddr *>(&clientAddress), - &clientAddressLength); + int handlerSocketHandle = accept(_socketHandle, reinterpret_cast<struct sockaddr *>(&clientAddress), + &clientAddressLength); - if (handlerSocketHandle >= 0) - { - handlerSocket = new FastOS_Socket(); + if (handlerSocketHandle >= 0) { + FastOS_Socket *handlerSocket = new FastOS_Socket(); - if (handlerSocket != NULL) - { - handlerSocket->SetUp(handlerSocketHandle, - reinterpret_cast<struct sockaddr *>(&clientAddress)); + if (handlerSocket != nullptr) { + handlerSocket->SetUp(handlerSocketHandle, reinterpret_cast<struct sockaddr *>(&clientAddress)); } + return handlerSocket; } - return handlerSocket; + return nullptr; } FastOS_ServerSocket::FastOS_ServerSocket(int socketHandle, FastOS_SocketFactory *socketFactory) @@ -117,8 +94,7 @@ bool FastOS_ServerSocket::Listen () (_address.ss_family == AF_INET6 && reinterpret_cast<const sockaddr_in6 &>(_address).sin6_port != 0)) reuseAddr = true; - if (SetSoReuseAddr(reuseAddr)) - { + if (SetSoReuseAddr(reuseAddr)) { size_t socketAddrLen; switch (_address.ss_family) { @@ -135,11 +111,8 @@ bool FastOS_ServerSocket::Listen () default: socketAddrLen = sizeof(sockaddr_storage); } - if(bind(_socketHandle, reinterpret_cast<struct sockaddr *>(&_address), - socketAddrLen) >= 0) - { - if(listen(_socketHandle, _backLog) >= 0) - { + if(bind(_socketHandle, reinterpret_cast<struct sockaddr *>(&_address), socketAddrLen) >= 0) { + if(listen(_socketHandle, _backLog) >= 0) { rc = true; } } diff --git a/fastos/src/vespa/fastos/serversocket.h b/fastos/src/vespa/fastos/serversocket.h index 8452649015c..93f1efe21fc 100644 --- a/fastos/src/vespa/fastos/serversocket.h +++ b/fastos/src/vespa/fastos/serversocket.h @@ -10,7 +10,7 @@ #pragma once -#include <vespa/fastos/socket.h> +#include "socket.h" /** diff --git a/fastos/src/vespa/fastos/socket.cpp b/fastos/src/vespa/fastos/socket.cpp index 21f5d788b18..2732a38cf4c 100644 --- a/fastos/src/vespa/fastos/socket.cpp +++ b/fastos/src/vespa/fastos/socket.cpp @@ -5,6 +5,8 @@ #include <cassert> #include <cstring> #include <netinet/tcp.h> +#include <netinet/in.h> +#include <netdb.h> FastOS_SocketInterface::FastOS_SocketInterface() : _readEventEnabled(false), @@ -264,6 +266,19 @@ int FastOS_SocketInterface::GetLocalPort () return result; } +unsigned short +FastOS_SocketInterface::GetPort () const +{ + switch (_address.ss_family) { + case AF_INET: + return reinterpret_cast<const sockaddr_in &>(_address).sin_port; + case AF_INET6: + return reinterpret_cast<const sockaddr_in6 &>(_address).sin6_port; + default: + return 0; + } +} + std::string FastOS_SocketInterface::getLastErrorString(void) { return FastOS_Socket::getErrorString(FastOS_Socket::GetLastError()); diff --git a/fastos/src/vespa/fastos/socket.h b/fastos/src/vespa/fastos/socket.h index 1d4bf31bf52..6f4650ab64a 100644 --- a/fastos/src/vespa/fastos/socket.h +++ b/fastos/src/vespa/fastos/socket.h @@ -3,9 +3,8 @@ #pragma once #include <vespa/fastos/types.h> - #include <string> -#include <vector> +#include <sys/socket.h> class FastOS_SocketInterface; class FastOS_ServerSocket; @@ -64,7 +63,7 @@ public: * Convenience method. Does GetErrorString(GetLastError()) * @return Error string */ - static std::string getLastErrorString(void); + static std::string getLastErrorString(); static const char *InitializeServices (); static void CleanupServices (); @@ -282,17 +281,7 @@ public: /** * Return socket port. */ - unsigned short GetPort () const - { - switch (_address.ss_family) { - case AF_INET: - return reinterpret_cast<const sockaddr_in &>(_address).sin_port; - case AF_INET6: - return reinterpret_cast<const sockaddr_in6 &>(_address).sin6_port; - default: - return 0; - } - } + unsigned short GetPort () const; /** * Tune the socket for transport use. diff --git a/fastos/src/vespa/fastos/socketevent.h b/fastos/src/vespa/fastos/socketevent.h index e7f67816586..6ed6b73a86c 100644 --- a/fastos/src/vespa/fastos/socketevent.h +++ b/fastos/src/vespa/fastos/socketevent.h @@ -47,8 +47,8 @@ public: static FastOS_SocketEventObjects *_objects; static FastOS_SocketEventObjects *ObtainObject (FastOS_SocketEvent *event); static void ReleaseObject (FastOS_SocketEventObjects *node); - static void ClassCleanup(void); - static void InitializeClass(void); + static void ClassCleanup(); + static void InitializeClass(); }; diff --git a/fastos/src/vespa/fastos/timestamp.cpp b/fastos/src/vespa/fastos/timestamp.cpp index c671b71de8c..da0aa6bbd01 100644 --- a/fastos/src/vespa/fastos/timestamp.cpp +++ b/fastos/src/vespa/fastos/timestamp.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/timestamp.h> -#include <vespa/fastos/mutex.h> +#include "timestamp.h" #include <cmath> +#include <sys/time.h> namespace fastos { diff --git a/fastos/src/vespa/fastos/types.h b/fastos/src/vespa/fastos/types.h index 506d514f642..c474558cdcc 100644 --- a/fastos/src/vespa/fastos/types.h +++ b/fastos/src/vespa/fastos/types.h @@ -1,87 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//**************************************************************************** -/** - * @file - * Type definitions used in FastOS. - * @author Oivind H. Danielsen - * @date Creation date: 2000-01-18 - *****************************************************************************/ - #pragma once -/** - * @def __STDC_LIMIT_MACROS - * According to C99, C++ implementations will only define UINT64_MAX - * etc when __STDC_LIMIT_MACROS is defined when including stdint.h. - * UINT64_C etc will only be defined when __STDC_CONSTANT_MACROS is - * defined. Since this file can be included from any of the files - * below, we define the behaviour here. - */ -#ifndef __STDC_LIMIT_MACROS - #define __STDC_LIMIT_MACROS 1 -#endif -#ifndef __STDC_CONSTANT_MACROS - #define __STDC_CONSTANT_MACROS 1 -#endif -#ifndef __STDC_FORMAT_MACROS - #define __STDC_FORMAT_MACROS -#endif - -#ifdef __TYPES_H_PTHREAD_U98 -#undef __USE_UNIX98 -#endif - - - -#ifndef __USE_UNIX98 -#define __TYPES_H_UNISTD_U98 -#define __USE_UNIX98 -#endif -#ifdef __TYPES_H_UNISTD_U98 -#undef __USE_UNIX98 -#endif - -#include <dirent.h> - -#include <sys/socket.h> - -#include <netinet/in.h> -#include <arpa/inet.h> -#include <netdb.h> - -#include <sys/resource.h> -#include <signal.h> - -#include <sys/time.h> -#include <time.h> - -#ifndef __USE_GNU -#define __USE_GNU /* for O_DIRECT define */ -#define __TYPES_H_DIRECTIO_GNU -#endif - - -#ifdef __TYPES_H_DIRECTIO_GNU -#undef __USE_GNU /* for O_DIRECT define */ -#endif - -#if (__WORDSIZE == 64) - -#else - #error "Only LP 64 environments are supported." -#endif - #define FASTOS_PREFIX(a) FastOS_##a -#define FASTOS_EMFILE_VERIFIED (-1) -#ifdef EMFILE -#undef FASTOS_EMFILE_VERIFIED -#define FASTOS_EMFILE_VERIFIED EMFILE -#endif - -#define FASTOS_ENFILE_VERIFIED (-1) -#ifdef ENFILE -#undef FASTOS_ENFILE_VERIFIED -#define FASTOS_ENFILE_VERIFIED ENFILE -#endif diff --git a/fastos/src/vespa/fastos/unix_app.cpp b/fastos/src/vespa/fastos/unix_app.cpp index e736a157eb8..5916017e95c 100644 --- a/fastos/src/vespa/fastos/unix_app.cpp +++ b/fastos/src/vespa/fastos/unix_app.cpp @@ -12,6 +12,7 @@ #include "process.h" #include "unix_ipc.h" #include <unistd.h> +#include <csignal> #include <getopt.h> diff --git a/fastos/src/vespa/fastos/unix_cond.cpp b/fastos/src/vespa/fastos/unix_cond.cpp index 6704ba5ea33..f2e541055ff 100644 --- a/fastos/src/vespa/fastos/unix_cond.cpp +++ b/fastos/src/vespa/fastos/unix_cond.cpp @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/cond.h> +#include "cond.h" +#include <sys/time.h> +#include <cstdint> FastOS_UNIX_Cond::FastOS_UNIX_Cond(void) : FastOS_CondInterface(), @@ -23,6 +25,7 @@ FastOS_UNIX_Cond::Wait(void) bool FastOS_UNIX_Cond::TimedWait(int milliseconds) { + struct timeval currentTime; struct timespec absTime; int error; diff --git a/fastos/src/vespa/fastos/unix_file.cpp b/fastos/src/vespa/fastos/unix_file.cpp index ac474dfcf1a..fb3bcab6b53 100644 --- a/fastos/src/vespa/fastos/unix_file.cpp +++ b/fastos/src/vespa/fastos/unix_file.cpp @@ -13,6 +13,7 @@ #include <cstring> #include <unistd.h> #include <fcntl.h> +#include <dirent.h> #include <sys/stat.h> #include <sys/mman.h> #include <sys/vfs.h> @@ -388,10 +389,10 @@ FastOS_UNIX_File::TranslateError (const int osError) case ENXIO: return ERR_NXIO; // Device not configured } - if (osError == FASTOS_ENFILE_VERIFIED) + if (osError == ENFILE) return ERR_NFILE; - if (osError == FASTOS_EMFILE_VERIFIED) + if (osError == EMFILE) return ERR_MFILE; return ERR_UNKNOWN; diff --git a/fastos/src/vespa/fastos/unix_file.h b/fastos/src/vespa/fastos/unix_file.h index 3311782b47a..aa5ea4edb01 100644 --- a/fastos/src/vespa/fastos/unix_file.h +++ b/fastos/src/vespa/fastos/unix_file.h @@ -94,8 +94,7 @@ public: static int64_t GetFreeDiskSpace (const char *path); }; - - +#include <dirent.h> /** * This is the generic UNIX implementation of @ref FastOS_DirectoryScan. */ diff --git a/fastos/src/vespa/fastos/unix_process.cpp b/fastos/src/vespa/fastos/unix_process.cpp index f3d15561958..70e441c64db 100644 --- a/fastos/src/vespa/fastos/unix_process.cpp +++ b/fastos/src/vespa/fastos/unix_process.cpp @@ -7,6 +7,7 @@ #include <cstring> #include <unistd.h> #include <fcntl.h> +#include <sys/socket.h> #include <sys/wait.h> #ifndef AF_LOCAL diff --git a/fastos/src/vespa/fastos/unix_socket.h b/fastos/src/vespa/fastos/unix_socket.h index a4b5d738d32..a1f25a8d159 100644 --- a/fastos/src/vespa/fastos/unix_socket.h +++ b/fastos/src/vespa/fastos/unix_socket.h @@ -2,7 +2,7 @@ #pragma once -#include <vespa/fastos/socket.h> +#include "socket.h" class FastOS_UNIX_Socket : public FastOS_SocketInterface { @@ -26,8 +26,8 @@ public: ERR_INPROGRESS = EINPROGRESS, ERR_WOULDBLOCK = EWOULDBLOCK, ERR_ADDRNOTAVAIL = EADDRNOTAVAIL, - ERR_MFILE = FASTOS_EMFILE_VERIFIED, - ERR_NFILE = FASTOS_ENFILE_VERIFIED, + ERR_MFILE = EMFILE, + ERR_NFILE = ENFILE, ERR_CONNRESET = ECONNRESET, ERR_EAGAIN = EAGAIN, // Old style error codes @@ -36,8 +36,8 @@ public: ERR_EINPROGRESS = EINPROGRESS, ERR_EWOULDBLOCK = EWOULDBLOCK, ERR_EADDRNOTAVAIL = EADDRNOTAVAIL, - ERR_EMFILE = FASTOS_EMFILE_VERIFIED, - ERR_ENFILE = FASTOS_ENFILE_VERIFIED + ERR_EMFILE = EMFILE, + ERR_ENFILE = ENFILE }; }; diff --git a/fastos/src/vespa/fastos/unix_time.cpp b/fastos/src/vespa/fastos/unix_time.cpp index 5961d875840..4b83dcd60f5 100644 --- a/fastos/src/vespa/fastos/unix_time.cpp +++ b/fastos/src/vespa/fastos/unix_time.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "time.h" -#include "types.h" +#include <sys/time.h> double FastOS_UNIX_Time::MicroSecs() const diff --git a/fbench/src/fbench/fbench.cpp b/fbench/src/fbench/fbench.cpp index c6a34099b3b..c98c3ead4fe 100644 --- a/fbench/src/fbench/fbench.cpp +++ b/fbench/src/fbench/fbench.cpp @@ -7,6 +7,7 @@ #include "fbench.h" #include <cstring> #include <cmath> +#include <csignal> sig_atomic_t exitSignal = 0; diff --git a/fbench/src/filterfile/filterfile.cpp b/fbench/src/filterfile/filterfile.cpp index 918d62215e6..ca93b70a046 100644 --- a/fbench/src/filterfile/filterfile.cpp +++ b/fbench/src/filterfile/filterfile.cpp @@ -2,7 +2,7 @@ #include <util/filereader.h> #include <iostream> #include <string.h> -#include <assert.h> +#include <cassert> /** * Extract query urls from web logs. The filterfile application reads diff --git a/fbench/src/test/filereader.cpp b/fbench/src/test/filereader.cpp index e85ef6c5821..d01c42fab6f 100644 --- a/fbench/src/test/filereader.cpp +++ b/fbench/src/test/filereader.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <util/filereader.h> #include <string.h> -#include <assert.h> +#include <cassert> int main(int argc, char **argv) diff --git a/fnet/src/tests/examples/examples_test.cpp b/fnet/src/tests/examples/examples_test.cpp index df5cceb624d..c823c52b995 100644 --- a/fnet/src/tests/examples/examples_test.cpp +++ b/fnet/src/tests/examples/examples_test.cpp @@ -4,6 +4,7 @@ #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/thread.h> #include <atomic> +#include <csignal> // reserved in vespa/factory/doc/port-ranges.txt static const int PORT0 = 18570; diff --git a/fnet/src/vespa/fnet/transport_thread.cpp b/fnet/src/vespa/fnet/transport_thread.cpp index 4a637b03532..6610d217294 100644 --- a/fnet/src/vespa/fnet/transport_thread.cpp +++ b/fnet/src/vespa/fnet/transport_thread.cpp @@ -10,6 +10,7 @@ #include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/net/socket_spec.h> #include <vespa/vespalib/net/server_socket.h> +#include <csignal> #include <vespa/log/log.h> LOG_SETUP(".fnet"); diff --git a/fsa/src/libfsa/automaton-alternate.h b/fsa/src/libfsa/automaton-alternate.h index 535b0f16014..1d64a08ee52 100644 --- a/fsa/src/libfsa/automaton-alternate.h +++ b/fsa/src/libfsa/automaton-alternate.h @@ -13,7 +13,7 @@ #include <list> #include <string> #include <vector> -#include <assert.h> +#include <cassert> #include <sys/mman.h> // for mmap() etc #include "blob.h" diff --git a/fsa/src/vespa/fsa/automaton.h b/fsa/src/vespa/fsa/automaton.h index 18d56cd4291..f1bcca87cf6 100644 --- a/fsa/src/vespa/fsa/automaton.h +++ b/fsa/src/vespa/fsa/automaton.h @@ -13,7 +13,7 @@ #include <map> #include <list> #include <string> -#include <assert.h> +#include <cassert> #include "blob.h" #include "fsa.h" diff --git a/fsa/src/vespa/fsa/conceptnet.h b/fsa/src/vespa/fsa/conceptnet.h index f082660ff18..d17b64bead5 100644 --- a/fsa/src/vespa/fsa/conceptnet.h +++ b/fsa/src/vespa/fsa/conceptnet.h @@ -10,7 +10,7 @@ #pragma once -#include <assert.h> +#include <cassert> #include <stdlib.h> #include "file.h" // for FileAccessMethod #include "fsa.h" diff --git a/fsa/src/vespa/fsa/unicode.cpp b/fsa/src/vespa/fsa/unicode.cpp index d4e92d6ca23..870d16ced2c 100644 --- a/fsa/src/vespa/fsa/unicode.cpp +++ b/fsa/src/vespa/fsa/unicode.cpp @@ -5,7 +5,7 @@ #include "unicode.h" -#include <assert.h> +#include <cassert> #include <cstdlib> namespace fsa { diff --git a/fsa/src/vespa/fsamanagers/mutex.cpp b/fsa/src/vespa/fsamanagers/mutex.cpp index 01915b3c185..ba3e5b70c6f 100644 --- a/fsa/src/vespa/fsamanagers/mutex.cpp +++ b/fsa/src/vespa/fsamanagers/mutex.cpp @@ -15,7 +15,7 @@ #ifndef DISABLE_THREADS #include <pthread.h> #include <sched.h> -#include <assert.h> +#include <cassert> #endif #include "mutex.h" diff --git a/fsa/src/vespa/fsamanagers/rwlock.cpp b/fsa/src/vespa/fsamanagers/rwlock.cpp index 3e15d5fd9cf..ee322494968 100644 --- a/fsa/src/vespa/fsamanagers/rwlock.cpp +++ b/fsa/src/vespa/fsamanagers/rwlock.cpp @@ -15,7 +15,7 @@ #ifndef DISABLE_THREADS #include <pthread.h> #include <sched.h> -#include <assert.h> +#include <cassert> #endif #include "rwlock.h" diff --git a/juniper/src/vespa/juniper/hashbase.h b/juniper/src/vespa/juniper/hashbase.h index 0fe03514e48..d651e1d2705 100644 --- a/juniper/src/vespa/juniper/hashbase.h +++ b/juniper/src/vespa/juniper/hashbase.h @@ -2,7 +2,7 @@ #pragma once #include <stdio.h> -#include <assert.h> +#include <cassert> // Simple default order that everybody has - pointer order: template <typename T> diff --git a/logd/src/apps/logd/main.cpp b/logd/src/apps/logd/main.cpp index 48450f323e9..caeaf83c7cc 100644 --- a/logd/src/apps/logd/main.cpp +++ b/logd/src/apps/logd/main.cpp @@ -1,16 +1,4 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> -#include <time.h> -#include <sys/stat.h> - -#include <vespa/log/log.h> -LOG_SETUP("logdemon"); -LOG_RCSID("$Id$"); #include <logd/errhandle.h> #include <logd/sigterm.h> @@ -18,8 +6,14 @@ LOG_RCSID("$Id$"); #include <logd/forward.h> #include <logd/conf.h> #include <logd/watch.h> -#include <logd/conn.h> #include <vespa/config/common/exceptions.h> +#include <csignal> +#include <unistd.h> + +#include <vespa/log/log.h> +LOG_SETUP("logdemon"); + + using namespace logdemon; using config::FileSpec; diff --git a/logd/src/logd/service.cpp b/logd/src/logd/service.cpp index 8e2237b1973..cd4304f5405 100644 --- a/logd/src/logd/service.cpp +++ b/logd/src/logd/service.cpp @@ -7,7 +7,7 @@ #include <unistd.h> #include <time.h> #include <sys/stat.h> -#include <assert.h> +#include <cassert> #include <vespa/log/log.h> #include <vespa/log/control-file.h> diff --git a/logd/src/logd/watch.cpp b/logd/src/logd/watch.cpp index 4a5e7df1474..0558d0b4548 100644 --- a/logd/src/logd/watch.cpp +++ b/logd/src/logd/watch.cpp @@ -12,6 +12,7 @@ #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> +#include <sys/time.h> LOG_SETUP(""); diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp index baba449adff..4372f0a67d3 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp @@ -1,6 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include <vespa/document/util/stringutil.h> #include <vespa/fnet/frt/frt.h> #include <vespa/memfilepersistence/device/mountpointlist.h> @@ -9,15 +8,15 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/programoptions.h> #include <vespa/vespalib/util/exceptions.h> -#include <sstream> +#include <csignal> +#include <dirent.h> #include <vespa/log/log.h> LOG_SETUP(".vdsdiskapp"); using std::vector; -namespace storage { -namespace memfile { +namespace storage::memfile { using vespalib::getLastErrorString; @@ -516,5 +515,4 @@ VdsDiskTool::run(int argc, const char * const * argv, return 0; } -} // memfile -} // storage +} diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp index f7588a83236..9a351b56eda 100644 --- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp +++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp @@ -1,15 +1,13 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/slobrok/sbmirror.h> -#include <vespa/config-slobroks.h> #include <vespa/config/common/configsystem.h> #include <vespa/config/common/exceptions.h> #include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/host_name.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/fastos/app.h> -#include <algorithm> -#include <string> +#include <sys/time.h> #include <vespa/log/log.h> LOG_SETUP("vespa-proton-cmd"); diff --git a/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp b/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp index 7578f0e33f4..84e5a632c09 100644 --- a/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp +++ b/searchcore/src/vespa/searchcore/proton/common/config_hash.hpp @@ -4,7 +4,7 @@ #include "config_hash.h" #include <vespa/vespalib/stllike/hash_map.hpp> -#include <assert.h> +#include <cassert> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp b/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp index b2a12d8a9c0..3cecc8308ad 100644 --- a/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/monitored_refcount.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "monitored_refcount.h" -#include <assert.h> +#include <cassert> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp index a70fb5b119d..e7b347c4c80 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp @@ -5,7 +5,7 @@ #include <vespa/searchlib/common/lambdatask.h> #include <vespa/searchcorespi/index/i_thread_service.h> #include <vespa/document/base/globalid.h> -#include <assert.h> +#include <cassert> using search::makeLambdaTask; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp index 19ec153c741..3567a69e8a3 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_registrator.cpp @@ -2,7 +2,7 @@ #include "gid_to_lid_change_registrator.h" #include "i_gid_to_lid_change_listener.h" -#include <assert.h> +#include <cassert> namespace proton { diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index 00321093600..8eef498d85c 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -8,13 +8,12 @@ #include <vespa/searchlib/attribute/singlestringattribute.h> #include <vespa/searchlib/attribute/multistringattribute.h> #include <vespa/searchlib/attribute/attrvector.h> -#include <vespa/vespalib/util/sync.h> #include <vespa/fastos/app.h> #include <iostream> #include <fstream> #include "../attributesearcher.h" #include "../attributeupdater.h" -#include "../runnable.h" +#include <sys/resource.h> #include <vespa/log/log.h> diff --git a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp index ba78f00ffca..37aa9cc3268 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp @@ -13,6 +13,8 @@ #include <vespa/vespalib/objects/objectpredicate.h> #include <vespa/vespalib/objects/objectoperation.h> #include <vespa/vespalib/util/rusage.h> +#include <csignal> + #include <vespa/log/log.h> LOG_SETUP("grouping_benchmark"); diff --git a/searchlib/src/tests/query/query-old-large.cpp b/searchlib/src/tests/query/query-old-large.cpp index 8bdc65c12c1..f1ff391cc2c 100644 --- a/searchlib/src/tests/query/query-old-large.cpp +++ b/searchlib/src/tests/query/query-old-large.cpp @@ -4,7 +4,7 @@ #include <vespa/searchlib/query/tree/simplequery.h> #include <vespa/searchlib/query/tree/stackdumpcreator.h> #include <vespa/vespalib/testkit/test_kit.h> -#include <limits> +#include <sys/resource.h> using namespace search; using namespace search::query; diff --git a/searchlib/src/vespa/searchlib/common/address_space.cpp b/searchlib/src/vespa/searchlib/common/address_space.cpp index a2dcaf024e5..af5e754e68f 100644 --- a/searchlib/src/vespa/searchlib/common/address_space.cpp +++ b/searchlib/src/vespa/searchlib/common/address_space.cpp @@ -2,7 +2,7 @@ #include "address_space.h" #include <ostream> -#include <assert.h> +#include <cassert> namespace search { diff --git a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp index b8ac5822692..7e479cb2905 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fileheader.cpp @@ -5,6 +5,7 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/data/fileheader.h> #include <vespa/fastos/file.h> +#include <arpa/inet.h> #include <vespa/log/log.h> LOG_SETUP(".diskindex.fileheader"); @@ -25,19 +26,7 @@ FileHeader::FileHeader() { } - -FileHeader::~FileHeader() -{ -} - - -static inline uint32_t -bswap(uint32_t val) -{ - __asm__("bswap %0" : "=r" (val) : "0" (val)); - return val; -} - +FileHeader::~FileHeader() {} bool FileHeader::taste(const vespalib::string &name, @@ -62,10 +51,8 @@ FileHeader::taste(const vespalib::string &name, } catch (vespalib::IllegalHeaderException &e) { if (e.getMessage() != "Failed to read header info." && e.getMessage() != "Failed to verify magic bits.") { - LOG(error, - "FileHeader::tastGeneric(\"%s\") exception: %s", - name.c_str(), - e.getMessage().c_str()); + LOG(error, "FileHeader::tastGeneric(\"%s\") exception: %s", + name.c_str(), e.getMessage().c_str()); } file.Close(); return false; @@ -82,9 +69,7 @@ FileHeader::taste(const vespalib::string &name, } else if (endian == "little") { _bigEndian = false; } else { - LOG(error, - "Bad endian: %s", - endian.c_str()); + LOG(error, "Bad endian: %s", endian.c_str()); return false; } } @@ -92,33 +77,23 @@ FileHeader::taste(const vespalib::string &name, if (header.hasTag("frozen")) { _completed = header.getTag("frozen").asInteger() != 0; } else { - LOG(error, - "FileHeader::taste(\"%s\"): Missing frozen tag", - name.c_str()); + LOG(error, "FileHeader::taste(\"%s\"): Missing frozen tag", name.c_str()); return false; } if (header.hasTag("fileBitSize")) { _fileBitSize = header.getTag("fileBitSize").asInteger(); if (_completed && _fileBitSize < 8 * _headerLen) { - LOG(error, - "FileHeader::taste(\"%s\"): " - "fleBitSize(%" PRIu64 ") < 8 * headerLen(%u)", - name.c_str(), - _fileBitSize, _headerLen); + LOG(error, "FileHeader::taste(\"%s\"): fleBitSize(%" PRIu64 ") < 8 * headerLen(%u)", + name.c_str(), _fileBitSize, _headerLen); return false; } if (_completed && _fileBitSize > 8 * fileSize) { - LOG(error, - "FileHeader::taste(\"%s\"): " - "fleBitSize(%" PRIu64 ") > 8 * fileSize(%" PRIu64 ")", - name.c_str(), - _fileBitSize, fileSize); + LOG(error, "FileHeader::taste(\"%s\"): fleBitSize(%" PRIu64 ") > 8 * fileSize(%" PRIu64 ")", + name.c_str(), _fileBitSize, fileSize); abort(); } } else if (!_allowNoFileBitSize) { - LOG(error, - "FileHeader::taste(\"%s\"): Missing fileBitSize tag", - name.c_str()); + LOG(error, "FileHeader::taste(\"%s\"): Missing fileBitSize tag", name.c_str()); return false; } for (uint32_t i = 0; ;++i) { @@ -132,10 +107,8 @@ FileHeader::taste(const vespalib::string &name, return true; } - bool -FileHeader::taste(const vespalib::string &name, - const TuneFileSeqWrite &tuneFileWrite) +FileHeader::taste(const vespalib::string &name, const TuneFileSeqWrite &tuneFileWrite) { TuneFileSeqRead tuneFileRead; if (tuneFileWrite.getWantDirectIO()) @@ -143,10 +116,8 @@ FileHeader::taste(const vespalib::string &name, return taste(name, tuneFileRead); } - bool -FileHeader::taste(const vespalib::string &name, - const TuneFileRandRead &tuneFileSearch) +FileHeader::taste(const vespalib::string &name, const TuneFileRandRead &tuneFileSearch) { TuneFileSeqRead tuneFileRead; if (tuneFileSearch.getWantDirectIO()) diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.h b/searchlib/src/vespa/searchlib/fef/simpletermdata.h index 2126d1c69ba..ef2d91d6e68 100644 --- a/searchlib/src/vespa/searchlib/fef/simpletermdata.h +++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.h @@ -7,7 +7,7 @@ #include "simpletermfielddata.h" #include <vespa/searchlib/query/weight.h> #include <vector> -#include <assert.h> +#include <cassert> namespace search { namespace fef { diff --git a/slobrok/src/apps/slobrok/slobrok.cpp b/slobrok/src/apps/slobrok/slobrok.cpp index 688181865be..277cc2f3a87 100644 --- a/slobrok/src/apps/slobrok/slobrok.cpp +++ b/slobrok/src/apps/slobrok/slobrok.cpp @@ -4,6 +4,7 @@ #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/fastos/app.h> +#include <csignal> #include <vespa/log/log.h> LOG_SETUP("vespa-slobrok"); diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index 1331c070612..d222a26c496 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -4,6 +4,8 @@ #include <vespa/vespalib/util/optimized.h> #include <vespa/vespalib/util/allocinarray.h> #include <vespa/vespalib/util/array.hpp> +#include <csignal> + #include <vespa/log/log.h> LOG_SETUP("allocinarray_benchmark"); diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index f3650273644..a7629084094 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -2,6 +2,8 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/rusage.h> #include <vespa/vespalib/util/array.hpp> +#include <csignal> + #include <vespa/log/log.h> LOG_SETUP("sort_benchmark"); diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp index b8fd84f812e..5d8ec190d59 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.cpp @@ -1,12 +1,23 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "shutdownguard.h" #include <unistd.h> +#include <sys/time.h> #include <vespa/log/log.h> LOG_SETUP(".vespalib.shutdownguard"); namespace vespalib { +namespace { +enum { STACK_SIZE = (1u << 16) }; + +static uint64_t getTimeInMillis() { + struct timeval mytime; + gettimeofday(&mytime, 0); + uint64_t mult = 1000; + return (mytime.tv_sec * mult) + (mytime.tv_usec / mult); +} +} void ShutdownGuard::Run(FastOS_ThreadInterface *, void *) { while (_dieAtTime > getTimeInMillis()) { @@ -32,5 +43,4 @@ ShutdownGuard::~ShutdownGuard() _pool.Close(); } - } diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h index 2eeb06e1a03..5a9aad5d4d4 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h @@ -2,6 +2,7 @@ #pragma once #include <vespa/fastos/thread.h> +#include <cstdint> namespace vespalib { @@ -14,15 +15,6 @@ namespace vespalib { **/ class ShutdownGuard : public FastOS_Runnable { - enum { STACK_SIZE = (1u << 16) }; - - static uint64_t getTimeInMillis() { - struct timeval mytime; - gettimeofday(&mytime, 0); - uint64_t mult = 1000; - return (mytime.tv_sec * mult) + (mytime.tv_usec / mult); - } - FastOS_ThreadPool _pool; volatile uint64_t _dieAtTime; diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp index f1a22d93d41..1f3109381fd 100644 --- a/storageserver/src/apps/storaged/storage.cpp +++ b/storageserver/src/apps/storaged/storage.cpp @@ -11,7 +11,7 @@ * application, but as little as possible else. */ -#include <signal.h> +#include <csignal> #include <vespa/persistence/spi/exceptions.h> #include <vespa/storage/storageutil/utils.h> #include <vespa/storageserver/app/distributorprocess.h> diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp index d1ef15b7298..2564c500cbc 100644 --- a/storageserver/src/tests/storageservertest.cpp +++ b/storageserver/src/tests/storageservertest.cpp @@ -24,6 +24,8 @@ #include <vespa/storageserver/app/distributorprocess.h> #include <vespa/storageserver/app/memfileservicelayerprocess.h> #include <vespa/vespalib/util/exceptions.h> +#include <sys/time.h> + #include <vespa/log/log.h> LOG_SETUP(".storageservertest"); diff --git a/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp b/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp index a0fc63da0be..08c7b80e406 100644 --- a/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp +++ b/vdslib/src/vespa/vdslib/thread/taskscheduler.cpp @@ -3,6 +3,7 @@ #include "taskscheduler.h" #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <sys/time.h> namespace vdslib { diff --git a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp index dbec559e5da..99c91216d20 100644 --- a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp +++ b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp @@ -13,6 +13,7 @@ #include <vespa/fastos/app.h> #include <sstream> #include <iostream> +#include <sys/time.h> #include <vespa/log/log.h> LOG_SETUP("vdsstatetool"); diff --git a/vespalib/src/tests/alloc/allocate_and_core.cpp b/vespalib/src/tests/alloc/allocate_and_core.cpp index faf44aa2669..7b72f35ac0e 100644 --- a/vespalib/src/tests/alloc/allocate_and_core.cpp +++ b/vespalib/src/tests/alloc/allocate_and_core.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/util/alloc.h> #include <string.h> -#include <assert.h> +#include <cassert> using namespace vespalib::alloc; diff --git a/vespalib/src/tests/exception_classes/mmap.cpp b/vespalib/src/tests/exception_classes/mmap.cpp index 3ba286f2a35..2d4c4796473 100644 --- a/vespalib/src/tests/exception_classes/mmap.cpp +++ b/vespalib/src/tests/exception_classes/mmap.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/util/alloc.h> #include <vector> -#include <assert.h> +#include <cassert> #include <string.h> #include <sys/resource.h> diff --git a/vespalib/src/tests/zcurve/zcurve_test.cpp b/vespalib/src/tests/zcurve/zcurve_test.cpp index 89bc3fed051..67f6a622ff0 100644 --- a/vespalib/src/tests/zcurve/zcurve_test.cpp +++ b/vespalib/src/tests/zcurve/zcurve_test.cpp @@ -1,12 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("zcurve_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/geo/zcurve.h> #include <algorithm> #include <limits> #include <map> +#include <sys/time.h> + +#include <vespa/log/log.h> +LOG_SETUP("zcurve_test"); namespace vespalib { @@ -20,34 +22,26 @@ public: { } - void - testEncoding(void); + void testEncoding(); - void - testDecoding(void); + void testDecoding(); - double - ftime(void); + double ftime(); - static inline int64_t - encodexy3(int32_t x, int32_t y); + static inline int64_t encodexy3(int32_t x, int32_t y); #define BMLIMIT 0x1000000 template <bool decode> - int64_t - bm(void); + int64_t bm(); template <bool decode> - int64_t - bm2(void); + int64_t bm2(); template <bool decode> - int64_t - bm3(void); + int64_t bm3(); - int64_t - bmcheck(); + int64_t bmcheck(); int Main() override; }; @@ -140,7 +134,7 @@ ZCurveTest::testDecoding(void) double -ZCurveTest::ftime(void) +ZCurveTest::ftime() { struct timeval tv; gettimeofday(&tv, NULL); @@ -183,7 +177,7 @@ ZCurveTest::encodexy3(int32_t x, int32_t y) template <bool decode> int64_t -ZCurveTest::bm(void) +ZCurveTest::bm() { int64_t res = 0; double before = ftime(); @@ -265,7 +259,7 @@ ZCurveTest::bm2(void) template <bool decode> int64_t -ZCurveTest::bm3(void) +ZCurveTest::bm3() { int64_t res = 0; double before = ftime(); @@ -305,7 +299,7 @@ ZCurveTest::bm3(void) int64_t -ZCurveTest::bmcheck(void) +ZCurveTest::bmcheck() { int64_t res = 0; double before = ftime(); @@ -348,7 +342,7 @@ ZCurveTest::bmcheck(void) int -ZCurveTest::Main(void) +ZCurveTest::Main() { TEST_INIT("zcurve_test"); diff --git a/vespalib/src/vespa/vespalib/data/slime/inspector.cpp b/vespalib/src/vespa/vespalib/data/slime/inspector.cpp index 46847c20754..1f5631accc6 100644 --- a/vespalib/src/vespa/vespalib/data/slime/inspector.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/inspector.cpp @@ -3,7 +3,7 @@ #include "inspector.h" #include "object_traverser.h" #include "array_traverser.h" -#include <assert.h> +#include <cassert> namespace vespalib { namespace slime { diff --git a/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp b/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp index 7b16382dde3..487badfabf8 100644 --- a/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp +++ b/vespalib/src/vespa/vespalib/data/slime/strfmt.cpp @@ -3,7 +3,7 @@ #include "strfmt.h" #include <stdarg.h> #include <stdio.h> -#include <assert.h> +#include <cassert> namespace vespalib { namespace slime { diff --git a/vespalib/src/vespa/vespalib/net/socket_handle.cpp b/vespalib/src/vespa/vespalib/net/socket_handle.cpp index 5e1e8f0155b..36eae46031f 100644 --- a/vespalib/src/vespa/vespalib/net/socket_handle.cpp +++ b/vespalib/src/vespa/vespalib/net/socket_handle.cpp @@ -3,7 +3,7 @@ #include "socket_handle.h" #include <sys/socket.h> #include <errno.h> -#include <assert.h> +#include <cassert> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/test/socket_options_verifier.h b/vespalib/src/vespa/vespalib/test/socket_options_verifier.h index 2be96b861af..72694f643e2 100644 --- a/vespalib/src/vespa/vespalib/test/socket_options_verifier.h +++ b/vespalib/src/vespa/vespalib/test/socket_options_verifier.h @@ -6,9 +6,10 @@ #include <fcntl.h> #include <unistd.h> #include <netinet/tcp.h> +#include <sys/socket.h> +#include <netinet/in.h> -namespace vespalib { -namespace test { +namespace vespalib::test { namespace { @@ -59,5 +60,4 @@ struct SocketOptionsVerifier { } }; -} // namespace vespalib::test -} // namespace vespalib +} diff --git a/vespalib/src/vespa/vespalib/util/arrayqueue.hpp b/vespalib/src/vespa/vespalib/util/arrayqueue.hpp index 85f4afabf9f..6c26fd3a0c4 100644 --- a/vespalib/src/vespa/vespalib/util/arrayqueue.hpp +++ b/vespalib/src/vespa/vespalib/util/arrayqueue.hpp @@ -5,7 +5,7 @@ #include <stdint.h> #include <stdlib.h> -#include <assert.h> +#include <cassert> #include <algorithm> #include "traits.h" diff --git a/vespalib/src/vespa/vespalib/util/backtrace.cpp b/vespalib/src/vespa/vespalib/util/backtrace.cpp index 33c3cebe8a8..ee7f39597a6 100644 --- a/vespalib/src/vespa/vespalib/util/backtrace.cpp +++ b/vespalib/src/vespa/vespalib/util/backtrace.cpp @@ -7,7 +7,7 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/fastos/backtrace.h> #include <execinfo.h> -#include <signal.h> +#include <csignal> namespace { diff --git a/vespalib/src/vespa/vespalib/util/generationhandler.h b/vespalib/src/vespa/vespalib/util/generationhandler.h index fbc6f1ae78a..d8af7f39c3e 100644 --- a/vespalib/src/vespa/vespalib/util/generationhandler.h +++ b/vespalib/src/vespa/vespalib/util/generationhandler.h @@ -4,7 +4,7 @@ #include <stdint.h> #include <atomic> -#include <assert.h> +#include <cassert> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/linkedptr.h b/vespalib/src/vespa/vespalib/util/linkedptr.h index ca464f48cbb..517208b9ef9 100644 --- a/vespalib/src/vespa/vespalib/util/linkedptr.h +++ b/vespalib/src/vespa/vespalib/util/linkedptr.h @@ -5,7 +5,7 @@ #include <algorithm> #include <memory> -#include <assert.h> +#include <cassert> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/signalhandler.h b/vespalib/src/vespa/vespalib/util/signalhandler.h index 7db23f72570..6b233b2e690 100644 --- a/vespalib/src/vespa/vespalib/util/signalhandler.h +++ b/vespalib/src/vespa/vespalib/util/signalhandler.h @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <signal.h> +#include <csignal> #include <vector> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/valgrind.cpp b/vespalib/src/vespa/vespalib/util/valgrind.cpp index d84855e8005..cbb6cc808fc 100644 --- a/vespalib/src/vespa/vespalib/util/valgrind.cpp +++ b/vespalib/src/vespa/vespalib/util/valgrind.cpp @@ -1,7 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/util/valgrind.h> -#include <assert.h> +#include <cassert> #include <fcntl.h> #include <unistd.h> diff --git a/vespalog/src/logger/runserver.cpp b/vespalog/src/logger/runserver.cpp index ee8125c333a..7cbe3711889 100644 --- a/vespalog/src/logger/runserver.cpp +++ b/vespalog/src/logger/runserver.cpp @@ -6,7 +6,7 @@ #include <errno.h> #include <unistd.h> #include <time.h> -#include <signal.h> +#include <csignal> #include <sys/select.h> #include <sys/types.h> diff --git a/vespalog/src/test/logtest.cpp b/vespalog/src/test/logtest.cpp index b55c05ae93e..42b7bfc6ef9 100644 --- a/vespalog/src/test/logtest.cpp +++ b/vespalog/src/test/logtest.cpp @@ -2,7 +2,7 @@ #include <sys/types.h> #include <stdlib.h> #include <unistd.h> -#include <signal.h> +#include <csignal> #include <vespa/log/log.h> diff --git a/vespalog/src/test/simple/logtest.cpp b/vespalog/src/test/simple/logtest.cpp index ff52eeff1bf..020c97dd1a8 100644 --- a/vespalog/src/test/simple/logtest.cpp +++ b/vespalog/src/test/simple/logtest.cpp @@ -2,7 +2,7 @@ #include <sys/types.h> #include <stdlib.h> #include <unistd.h> -#include <signal.h> +#include <csignal> #include <vespa/log/log.h> diff --git a/vespalog/src/vespa-logfmt/logfilter.c b/vespalog/src/vespa-logfmt/logfilter.c index cd8dcc86deb..2db108771ee 100644 --- a/vespalog/src/vespa-logfmt/logfilter.c +++ b/vespalog/src/vespa-logfmt/logfilter.c @@ -4,7 +4,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> -#include <signal.h> +#include <csignal> int main(int argc, char *argv[]) { diff --git a/vespalog/src/vespa/log/log.cpp b/vespalog/src/vespa/log/log.cpp index eb100fd6631..a0977406dc0 100644 --- a/vespalog/src/vespa/log/log.cpp +++ b/vespalog/src/vespa/log/log.cpp @@ -16,6 +16,7 @@ LOG_SETUP_INDIRECT(".log", "$Id$"); #include <cassert> #include <cstdarg> #include <unistd.h> +#include <sys/time.h> namespace ns_log { diff --git a/vespamalloc/src/vespamalloc/malloc/memorywatcher.h b/vespamalloc/src/vespamalloc/malloc/memorywatcher.h index 05290bcda60..00240cadf12 100644 --- a/vespamalloc/src/vespamalloc/malloc/memorywatcher.h +++ b/vespamalloc/src/vespamalloc/malloc/memorywatcher.h @@ -2,7 +2,7 @@ #pragma once #include <stdio.h> -#include <signal.h> +#include <csignal> #include <limits.h> #include <sys/stat.h> #include <ctype.h> diff --git a/vespamalloc/src/vespamalloc/util/traceutil.h b/vespamalloc/src/vespamalloc/util/traceutil.h index 664ee970a89..513dfdf8c80 100644 --- a/vespamalloc/src/vespamalloc/util/traceutil.h +++ b/vespamalloc/src/vespamalloc/util/traceutil.h @@ -2,9 +2,9 @@ #pragma once #include <dlfcn.h> -#include <signal.h> +#include <csignal> #include <stdlib.h> -#include <assert.h> +#include <cassert> #include <vector> #include <vespamalloc/util/index.h> #include <vespamalloc/util/callstack.h> |