diff options
-rw-r--r-- | absl/base/attributes.h | 3 | ||||
-rw-r--r-- | absl/log/die_if_null.h | 2 | ||||
-rw-r--r-- | absl/log/internal/conditions.h | 4 | ||||
-rw-r--r-- | absl/log/internal/log_message.h | 8 | ||||
-rw-r--r-- | absl/log/internal/nullstream.h | 11 | ||||
-rw-r--r-- | absl/status/internal/statusor_internal.h | 4 | ||||
-rw-r--r-- | absl/strings/internal/cord_internal.h | 2 |
7 files changed, 14 insertions, 20 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h index e781995e..5acbdb6c 100644 --- a/absl/base/attributes.h +++ b/absl/base/attributes.h @@ -195,6 +195,9 @@ // ABSL_ATTRIBUTE_NORETURN // // Tells the compiler that a given function never returns. +// +// Deprecated: Prefer the `[[noreturn]]` attribute standardized by C++11 over +// this macro. #if ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__)) #define ABSL_ATTRIBUTE_NORETURN __attribute__((noreturn)) #elif defined(_MSC_VER) diff --git a/absl/log/die_if_null.h b/absl/log/die_if_null.h index 127a9ac8..f773aa85 100644 --- a/absl/log/die_if_null.h +++ b/absl/log/die_if_null.h @@ -55,7 +55,7 @@ namespace log_internal { // `line` location. Called when `ABSL_DIE_IF_NULL` fails. Calling this function // generates less code than its implementation would if inlined, for a slight // code size reduction each time `ABSL_DIE_IF_NULL` is called. -ABSL_ATTRIBUTE_NORETURN ABSL_ATTRIBUTE_NOINLINE void DieBecauseNull( +[[noreturn]] ABSL_ATTRIBUTE_NOINLINE void DieBecauseNull( const char* file, int line, const char* exprtext); // Helper for `ABSL_DIE_IF_NULL`. diff --git a/absl/log/internal/conditions.h b/absl/log/internal/conditions.h index 645f3c23..9dc15db4 100644 --- a/absl/log/internal/conditions.h +++ b/absl/log/internal/conditions.h @@ -230,8 +230,8 @@ class LogEveryNSecState final { // Helper routines to abort the application quietly -ABSL_ATTRIBUTE_NORETURN inline void AbortQuietly() { abort(); } -ABSL_ATTRIBUTE_NORETURN inline void ExitQuietly() { _exit(1); } +[[noreturn]] inline void AbortQuietly() { abort(); } +[[noreturn]] inline void ExitQuietly() { _exit(1); } } // namespace log_internal ABSL_NAMESPACE_END } // namespace absl diff --git a/absl/log/internal/log_message.h b/absl/log/internal/log_message.h index fa721214..0c067da9 100644 --- a/absl/log/internal/log_message.h +++ b/absl/log/internal/log_message.h @@ -187,11 +187,11 @@ class LogMessage { protected: // Call `abort()` or similar to perform `LOG(FATAL)` crash. It is assumed // that the caller has already generated and written the trace as appropriate. - ABSL_ATTRIBUTE_NORETURN static void FailWithoutStackTrace(); + [[noreturn]] static void FailWithoutStackTrace(); // Similar to `FailWithoutStackTrace()`, but without `abort()`. Terminates // the process with an error exit code. - ABSL_ATTRIBUTE_NORETURN static void FailQuietly(); + [[noreturn]] static void FailQuietly(); // Dispatches the completed `absl::LogEntry` to applicable `absl::LogSink`s. // This might as well be inlined into `~LogMessage` except that @@ -354,7 +354,7 @@ class LogMessageFatal final : public LogMessage { LogMessageFatal(const char* file, int line) ABSL_ATTRIBUTE_COLD; LogMessageFatal(const char* file, int line, absl::string_view failure_msg) ABSL_ATTRIBUTE_COLD; - ABSL_ATTRIBUTE_NORETURN ~LogMessageFatal(); + [[noreturn]] ~LogMessageFatal(); }; // `LogMessageDebugFatal` ensures the process will exit in failure after logging @@ -381,7 +381,7 @@ class LogMessageQuietlyFatal final : public LogMessage { LogMessageQuietlyFatal(const char* file, int line) ABSL_ATTRIBUTE_COLD; LogMessageQuietlyFatal(const char* file, int line, absl::string_view failure_msg) ABSL_ATTRIBUTE_COLD; - ABSL_ATTRIBUTE_NORETURN ~LogMessageQuietlyFatal(); + [[noreturn]] ~LogMessageQuietlyFatal(); }; } // namespace log_internal diff --git a/absl/log/internal/nullstream.h b/absl/log/internal/nullstream.h index 9266852e..973e91ab 100644 --- a/absl/log/internal/nullstream.h +++ b/absl/log/internal/nullstream.h @@ -117,16 +117,7 @@ class NullStreamMaybeFatal final : public NullStream { class NullStreamFatal final : public NullStream { public: NullStreamFatal() = default; - // ABSL_ATTRIBUTE_NORETURN doesn't seem to work on destructors with msvc, so - // disable msvc's warning about the d'tor never returning. -#if defined(_MSC_VER) && !defined(__clang__) -#pragma warning(push) -#pragma warning(disable : 4722) -#endif - ABSL_ATTRIBUTE_NORETURN ~NullStreamFatal() { _exit(1); } -#if defined(_MSC_VER) && !defined(__clang__) -#pragma warning(pop) -#endif + [[noreturn]] ~NullStreamFatal() { _exit(1); } }; } // namespace log_internal diff --git a/absl/status/internal/statusor_internal.h b/absl/status/internal/statusor_internal.h index 414aa300..67603156 100644 --- a/absl/status/internal/statusor_internal.h +++ b/absl/status/internal/statusor_internal.h @@ -186,7 +186,7 @@ class Helper { public: // Move type-agnostic error handling to the .cc. static void HandleInvalidStatusCtorArg(absl::Nonnull<Status*>); - ABSL_ATTRIBUTE_NORETURN static void Crash(const absl::Status& status); + [[noreturn]] static void Crash(const absl::Status& status); }; // Construct an instance of T in `p` through placement new, passing Args... to @@ -438,7 +438,7 @@ struct MoveAssignBase<T, false> { MoveAssignBase& operator=(MoveAssignBase&&) = delete; }; -ABSL_ATTRIBUTE_NORETURN void ThrowBadStatusOrAccess(absl::Status status); +[[noreturn]] void ThrowBadStatusOrAccess(absl::Status status); // Used to introduce jitter into the output of printing functions for // `StatusOr` (i.e. `AbslStringify` and `operator<<`). diff --git a/absl/strings/internal/cord_internal.h b/absl/strings/internal/cord_internal.h index 3de8e46b..9420e764 100644 --- a/absl/strings/internal/cord_internal.h +++ b/absl/strings/internal/cord_internal.h @@ -85,7 +85,7 @@ enum Constants { }; // Emits a fatal error "Unexpected node type: xyz" and aborts the program. -ABSL_ATTRIBUTE_NORETURN void LogFatalNodeType(CordRep* rep); +[[noreturn]] void LogFatalNodeType(CordRep* rep); // Fast implementation of memmove for up to 15 bytes. This implementation is // safe for overlapping regions. If nullify_tail is true, the destination is |