aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-19 13:10:22 +0300
committerthegeorg <thegeorg@yandex-team.ru>2022-02-19 13:10:22 +0300
commit7d7953cb46099a2517822b5832d49351eeecbde1 (patch)
tree36870cca6282667dacc5c0385c42a76dd00cf1f3
parent709f0db82ea5003ac1f26d3206f1904ec17bbe92 (diff)
downloadydb-7d7953cb46099a2517822b5832d49351eeecbde1.tar.gz
Properly attribute err.h replacements as [[noreturn]]
ref:e86419934a6858c3f36f45e15d1e42cc501ea395
-rw-r--r--util/system/compat.h8
-rw-r--r--util/system/err.cpp13
2 files changed, 12 insertions, 9 deletions
diff --git a/util/system/compat.h b/util/system/compat.h
index c53dbcca17..437e287497 100644
--- a/util/system/compat.h
+++ b/util/system/compat.h
@@ -37,13 +37,15 @@ extern "C" {
#endif
#if defined(_MSC_VER)
- void err(int e, const char* m, ...);
- void errx(int e, const char* m, ...);
void warn(const char* m, ...);
void warnx(const char* m, ...);
void vwarnx(const char* format, va_list ap);
void vwarn(const char* format, va_list ap);
- void verrx(int status, const char* format, va_list ap);
+
+ [[noreturn]] void err(int e, const char* m, ...);
+ [[noreturn]] void errx(int e, const char* m, ...);
+ [[noreturn]] void verr(int status, const char* fmt, va_list args);
+ [[noreturn]] void verrx(int status, const char* format, va_list ap);
#else
#include <err.h>
#endif
diff --git a/util/system/err.cpp b/util/system/err.cpp
index 5573ea1ee9..e2e5d8c9fd 100644
--- a/util/system/err.cpp
+++ b/util/system/err.cpp
@@ -5,6 +5,7 @@
#include <util/generic/scope.h>
+#include <util/system/compat.h>
#include <util/stream/printf.h>
#include <util/stream/output.h>
@@ -52,12 +53,12 @@ void warnx(const char* fmt, ...) {
va_end(args);
}
-void verr(int status, const char* fmt, va_list args) {
+[[noreturn]] void verr(int status, const char* fmt, va_list args) {
vwarn(fmt, args);
- exit(status);
+ std::exit(status);
}
-void err(int status, const char* fmt, ...) {
+[[noreturn]] void err(int status, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
@@ -65,12 +66,12 @@ void err(int status, const char* fmt, ...) {
va_end(args);
}
-void verrx(int status, const char* fmt, va_list args) {
+[[noreturn]] void verrx(int status, const char* fmt, va_list args) {
vwarnx(fmt, args);
- exit(status);
+ std::exit(status);
}
-void errx(int status, const char* fmt, ...) {
+[[noreturn]] void errx(int status, const char* fmt, ...) {
va_list args;
va_start(args, fmt);