diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-02-15 07:45:24 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-02-15 07:45:24 +0000 |
commit | fc14ad27155e0bdd0e0c20be31bad7dfdf0a3122 (patch) | |
tree | 035efa3d847dcfcd5ca5d749fc302f54c82a18cf /vespalib | |
parent | c5fe5b6be07e57115cd72738a5afd928b0df60ef (diff) |
- [[noreturn]] is standard.
- gnu printf format specification is defacto standard.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/data/output_writer.h | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/data/slime/strfmt.h | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/text/utf8.h | 3 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/inline.h | 16 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/issue.h | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/stringfmt.h | 14 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/unwind_message.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/unwind_message.h | 9 |
8 files changed, 9 insertions, 56 deletions
diff --git a/vespalib/src/vespa/vespalib/data/output_writer.h b/vespalib/src/vespa/vespalib/data/output_writer.h index c95f13ad704..d53ac5e94d5 100644 --- a/vespalib/src/vespa/vespalib/data/output_writer.h +++ b/vespalib/src/vespa/vespalib/data/output_writer.h @@ -72,12 +72,7 @@ public: commit(memory.size); } - void printf(const char *fmt, ...) -#ifdef __GNUC__ - // Add printf format checks with gcc - __attribute__ ((format (printf,2,3))) -#endif - ; + void printf(const char *fmt, ...) __attribute__ ((format (printf,2,3))); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/data/slime/strfmt.h b/vespalib/src/vespa/vespalib/data/slime/strfmt.h index 01e60eac3c0..5421281286c 100644 --- a/vespalib/src/vespa/vespalib/data/slime/strfmt.h +++ b/vespalib/src/vespa/vespalib/data/slime/strfmt.h @@ -6,11 +6,6 @@ namespace vespalib::slime { -extern std::string strfmt(const char *fmt, ...) -#ifdef __GNUC__ - __attribute__ ((format (printf,1,2))) // Add printf format checks with gcc - __attribute__((nonnull(1))) // Format string can never be null -#endif - ; +extern std::string strfmt(const char *fmt, ...) __attribute__((format (printf,1,2), nonnull(1))); } // namespace vespalib::slime diff --git a/vespalib/src/vespa/vespalib/text/utf8.h b/vespalib/src/vespa/vespalib/text/utf8.h index aa0e7c2f680..98e06ca5faf 100644 --- a/vespalib/src/vespa/vespalib/text/utf8.h +++ b/vespalib/src/vespa/vespalib/text/utf8.h @@ -152,8 +152,7 @@ public: protected: - static void throwX(const char *msg, unsigned int number) - __attribute__((__noreturn__)); + [[noreturn]] static void throwX(const char *msg, unsigned int number); enum { low_7bits_mask = 0x7F, diff --git a/vespalib/src/vespa/vespalib/util/inline.h b/vespalib/src/vespa/vespalib/util/inline.h index 9ecee12046f..cf6fe0e696a 100644 --- a/vespalib/src/vespa/vespalib/util/inline.h +++ b/vespalib/src/vespa/vespalib/util/inline.h @@ -3,23 +3,7 @@ #pragma once #ifndef noinline__ -#ifdef __GNUC__ #define noinline__ __attribute__((noinline)) #endif -#ifndef noinline__ -#define noinline__ -#endif -#endif -#ifndef always_inline__ -#ifdef __GNUC__ -/* if user specifies -O -fno-inline the compiler may get confused */ -#if !defined(__NO_INLINE__) && defined(__OPTIMIZE__) -#define always_inline__ __attribute__((always_inline)) -#endif -#endif -#ifndef always_inline__ -#define always_inline__ -#endif -#endif diff --git a/vespalib/src/vespa/vespalib/util/issue.h b/vespalib/src/vespa/vespalib/util/issue.h index a98997dddf4..9bc906b2a33 100644 --- a/vespalib/src/vespa/vespalib/util/issue.h +++ b/vespalib/src/vespa/vespalib/util/issue.h @@ -63,12 +63,7 @@ public: static Binding listen(Handler &handler); static void report(vespalib::string msg); static void report(const std::exception &e); - static void report(const char *format, ...) -#ifdef __GNUC__ - // Add printf format checks with gcc - __attribute__ ((format (printf,1,2))) -#endif - ; + static void report(const char *format, ...) __attribute__ ((format (printf,1,2))); }; } diff --git a/vespalib/src/vespa/vespalib/util/stringfmt.h b/vespalib/src/vespa/vespalib/util/stringfmt.h index ec295572499..5e30869287c 100644 --- a/vespalib/src/vespa/vespalib/util/stringfmt.h +++ b/vespalib/src/vespa/vespalib/util/stringfmt.h @@ -9,20 +9,10 @@ namespace vespalib { extern vespalib::string make_string_va(const char *fmt, va_list ap); -extern vespalib::string make_string(const char *fmt, ...) -#ifdef __GNUC__ - // Add printf format checks with gcc - __attribute__ ((format (printf,1,2))) -#endif - ; +extern vespalib::string make_string(const char *fmt, ...) __attribute__ ((format (printf,1,2))); namespace make_string_short { -extern vespalib::string fmt(const char *format, ...) -#ifdef __GNUC__ - // Add printf format checks with gcc - __attribute__ ((format (printf,1,2))) -#endif - ; +extern vespalib::string fmt(const char *format, ...) __attribute__ ((format (printf,1,2))); } // namespace vespalib::make_string_short } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/unwind_message.cpp b/vespalib/src/vespa/vespalib/util/unwind_message.cpp index 3789ae0d9e9..6a203eaf533 100644 --- a/vespalib/src/vespa/vespalib/util/unwind_message.cpp +++ b/vespalib/src/vespa/vespalib/util/unwind_message.cpp @@ -11,7 +11,7 @@ UnwindMessage::UnwindMessage(const vespalib::string &msg) { } -UnwindMessage::UnwindMessage(UnwindMessage &&rhs) +UnwindMessage::UnwindMessage(UnwindMessage &&rhs) noexcept : _num_active(std::uncaught_exceptions()), _message(rhs._message) { diff --git a/vespalib/src/vespa/vespalib/util/unwind_message.h b/vespalib/src/vespa/vespalib/util/unwind_message.h index 752719c4f74..10d8680e14f 100644 --- a/vespalib/src/vespa/vespalib/util/unwind_message.h +++ b/vespalib/src/vespa/vespalib/util/unwind_message.h @@ -17,19 +17,14 @@ private: vespalib::string _message; public: UnwindMessage(const vespalib::string &msg); - UnwindMessage(UnwindMessage &&rhs); + UnwindMessage(UnwindMessage &&rhs) noexcept ; UnwindMessage(const UnwindMessage &) = delete; UnwindMessage &operator=(const UnwindMessage &) = delete; UnwindMessage &operator=(UnwindMessage &&) = delete; ~UnwindMessage(); }; -extern UnwindMessage unwind_msg(const char *fmt, ...) -#ifdef __GNUC__ - // Add printf format checks with gcc - __attribute__ ((format (printf,1,2))) -#endif - ; +extern UnwindMessage unwind_msg(const char *fmt, ...) __attribute__ ((format (printf,1,2))); // make an unwind message with a hopefully unique name on the stack #define UNWIND_MSG(...) auto VESPA_CAT(unwindMessageOnLine, __LINE__) = unwind_msg(__VA_ARGS__) |