diff --git a/common/dbgnew.hh b/common/dbgnew.hh index 7721aa578f2e58d013718ad86a8d1d9e3537fdda..14e04a893c578d6ca4de78f24b5efd6d13676a64 100644 --- a/common/dbgnew.hh +++ b/common/dbgnew.hh @@ -42,13 +42,18 @@ static debug_new_counter_t debug_new_counter; void* operator new(size_t size, const char* file, int line); void* operator new[](size_t size, const char* file, int line); -// TODO: these might be GCC version dependant +// TODO: these might be GCC version dependent void* operator new(size_t size, const std::nothrow_t&, const char* file, int line); void* operator new[](size_t size, const std::nothrow_t&, const char* file, int line); inline void* operator new(size_t, void* __p, const char*, int) { return __p; } inline void* operator new[](size_t, void* __p, const char*, int) { return __p; } +#if __cplusplus >= 201703L +void* operator new(size_t size, std::align_val_t, const char* file, int line); +void* operator new[](size_t size, std::align_val_t, const char* file, int line); +#endif // C++11 + // Redirect "normal" new to memory-tracking placement new. #define new(...) new(__VA_ARGS__, __FILE__, __LINE__) diff --git a/common/new.cc b/common/new.cc index d9552aeea3ffb5f945e2e4c81ddb51fa984e668f..a20d2cc7e0f9f1e4ade4a046239cf8d956ec02f5 100644 --- a/common/new.cc +++ b/common/new.cc @@ -18,33 +18,33 @@ static void *dummy = NULL; -void *operator new(size_t size) throw (std::bad_alloc) +void *operator new(size_t size) { return Malloc(size); } -void *operator new[](size_t size) throw (std::bad_alloc) +void *operator new[](size_t size) { if (size == 0) return &dummy; else return Malloc(size); } -void operator delete(void *ptr) throw() +void operator delete(void *ptr) { Free(ptr); } -void operator delete(void *ptr, std::size_t) throw() +void operator delete(void *ptr, std::size_t) { Free(ptr); } -void operator delete[](void *ptr) throw() +void operator delete[](void *ptr) { if (ptr != static_cast<void*>(&dummy)) Free(ptr); } -void operator delete[](void *ptr, std::size_t) throw() +void operator delete[](void *ptr, std::size_t) { if (ptr != static_cast<void*>(&dummy)) Free(ptr); } @@ -76,6 +76,19 @@ void* operator new[](size_t size, const std::nothrow_t&, const char* file, int l else return Malloc_dbg(file, line, size); } +#if __cplusplus >= 201703L +void* operator new(size_t size, std::align_val_t, const char* file, int line) +{ + return Malloc_dbg(file, line, size); +} + +void* operator new[](size_t size, std::align_val_t, const char* file, int line) +{ + if (size == 0) return &dummy; + else return Malloc_dbg(file, line, size); +} +#endif // C++11 + int debug_new_counter_t::count = 0; // initial value #if defined(__CYGWIN__) || defined(INTERIX) diff --git a/compiler2/ProjectGenHelper.cc b/compiler2/ProjectGenHelper.cc index 6a27db55afc3437ddf185c7b98ef10c8169a4f9e..278e2305cccd99a5f8ae9fca13f02af78d3d8867 100644 --- a/compiler2/ProjectGenHelper.cc +++ b/compiler2/ProjectGenHelper.cc @@ -491,7 +491,7 @@ size_t ProjectGenHelper::numOfLibs() const struct CompareStr { - bool operator () (const char* lhs, const char* rhs) { + bool operator () (const char* lhs, const char* rhs) const { int ret = strcmp(lhs, rhs); return (0 > ret); } diff --git a/core/BER.hh b/core/BER.hh index e8236325f51f20009c66eee12958cab5a0bc3d95..84af4cacadff0994014ff8fc8e3da1f82839d2a4 100644 --- a/core/BER.hh +++ b/core/BER.hh @@ -140,8 +140,8 @@ template<typename T> size_t min_needed_bits(T p) { if(p==0) return 1; - register size_t n=0; - register T tmp=p; + size_t n=0; + T tmp=p; while(tmp!=0) n++, tmp/=2; return n; } diff --git a/core/RAW.cc b/core/RAW.cc index 004c3298d1160fe4c3b6356e761d0f000a360451..860d78d81432023408767c6b4aa7226c62763bd6 100644 --- a/core/RAW.cc +++ b/core/RAW.cc @@ -382,8 +382,8 @@ RAW_enc_tree* RAW_enc_tree::get_node(RAW_enc_tr_pos &req_pos) */ int min_bits(int a) { - register int bits = 0; - register int tmp = a; + int bits = 0; + int tmp = a; if (a < 0) { bits = 1; tmp = -a; @@ -398,7 +398,7 @@ int min_bits(int a) int min_bits(BIGNUM *a) { if (!a) return 0; - register int bits = BN_num_bits(a) + BN_is_negative(a); + int bits = BN_num_bits(a) + BN_is_negative(a); return bits; } diff --git a/core/Universal_charstring.cc b/core/Universal_charstring.cc index b34930b05e5b09485ac52319080e9d5912623542..7b94b06ea715f696e3fe6bd4be58184fe0ed23fd 100644 --- a/core/Universal_charstring.cc +++ b/core/Universal_charstring.cc @@ -2016,7 +2016,7 @@ int UNIVERSAL_CHARSTRING::XER_encode(const XERdescriptor_t& p_td, */ inline static unsigned int -hash (register const char *str, register unsigned int len) +hash (const char *str, unsigned int len) { static unsigned char asso_values[] = { @@ -2122,11 +2122,11 @@ in_word_set (const char *str, unsigned int len) if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - register int key = hash (str, len); + int key = hash (str, len); if (key <= MAX_HASH_VALUE && key >= 0) { - register const char s = wordlist[key]; + const char s = wordlist[key]; return s; } } diff --git a/loggerplugins/TSTLogger/TSTLogger.cc b/loggerplugins/TSTLogger/TSTLogger.cc index 074ee899d8b869142c59252f3d9cfdbd319e4c5f..1dee46007d20fcd6d99d77e85a1e732f1b0bf7c9 100644 --- a/loggerplugins/TSTLogger/TSTLogger.cc +++ b/loggerplugins/TSTLogger/TSTLogger.cc @@ -76,19 +76,19 @@ class TCPClient public: TCPClient(): socket_fd(-1), timeout_time(30) {} // opens connection and returns socket file descriptor, throws exception on error - void open_connection(const string host_name, const string service_name) throw(SocketException); + void open_connection(const string host_name, const string service_name); // send a string to a socket, don't return until the whole string is sent - void send_string(const string& str) throw(SocketException); + void send_string(const string& str); // receive available data to the end of the parameter string, blocks until at least wait_for_bytes chars have arrived, // returns false if connection was closed - bool receive_string(string& str, const size_t wait_for_bytes) throw(SocketException); + bool receive_string(string& str, const size_t wait_for_bytes); // close connection - void close_connection() throw(SocketException); + void close_connection(); time_t get_timeout() const { return timeout_time; } void set_timeout(time_t t) { timeout_time = t; } }; -void TCPClient::open_connection(const string host_name, const string service_name) throw(SocketException) +void TCPClient::open_connection(const string host_name, const string service_name) { if (socket_fd!=-1) { close_connection(); @@ -116,7 +116,7 @@ void TCPClient::open_connection(const string host_name, const string service_nam } } -void TCPClient::close_connection() throw(SocketException) +void TCPClient::close_connection() { if (socket_fd==-1) { return; @@ -157,7 +157,7 @@ wait_reset: } } -void TCPClient::send_string(const string& str) throw(SocketException) +void TCPClient::send_string(const string& str) { if (socket_fd==-1) { throw SocketException("Connection is not open"); @@ -177,7 +177,7 @@ void TCPClient::send_string(const string& str) throw(SocketException) // wait_for_bytes - wait until at least so many bytes arrived or timeout or connection closed, // if zero then wait until connection is closed -bool TCPClient::receive_string(string& str, const size_t wait_for_bytes) throw(SocketException) +bool TCPClient::receive_string(string& str, const size_t wait_for_bytes) { if (socket_fd==-1) { throw SocketException("Connection is not open"); @@ -220,7 +220,7 @@ class HTTPClient : public TCPClient public: HTTPClient(): TCPClient() {} string url_encode(const string& str); - string post_request(const string& host, const string& uri, const string& user_agent, const string_map& req_params) throw(SocketException); + string post_request(const string& host, const string& uri, const string& user_agent, const string_map& req_params); }; string HTTPClient::url_encode(const string& str) @@ -240,7 +240,7 @@ string HTTPClient::url_encode(const string& str) return ss.str(); } -string HTTPClient::post_request(const string& host, const string& uri, const string& user_agent, const string_map& req_params) throw(SocketException) +string HTTPClient::post_request(const string& host, const string& uri, const string& user_agent, const string_map& req_params) { // compose request message stringstream req_ss;