Use clang format attribute (#4624)

This commit is contained in:
Alexander Shabalin
2021-01-12 13:22:13 +03:00
committed by Nikolay Krasko
parent adf80418af
commit 3eb2ec5cc1
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -32,7 +32,7 @@
#define CURRENT_SOURCE_LOCATION nullptr #define CURRENT_SOURCE_LOCATION nullptr
#endif #endif
RUNTIME_NORETURN void RuntimeAssertFailed(const char* location, const char* message, ...); RUNTIME_NORETURN void RuntimeAssertFailed(const char* location, const char* format, ...) __attribute__((format(printf, 2, 3)));
namespace internal { namespace internal {
@@ -42,7 +42,7 @@ inline RUNTIME_NORETURN void TODOImpl(const char* location) {
// TODO: Support format string when `RuntimeAssertFailed` supports it. // TODO: Support format string when `RuntimeAssertFailed` supports it.
inline RUNTIME_NORETURN void TODOImpl(const char* location, const char* message) { inline RUNTIME_NORETURN void TODOImpl(const char* location, const char* message) {
RuntimeAssertFailed(location, message); RuntimeAssertFailed(location, "%s", message);
} }
} // namespace internal } // namespace internal
+4 -4
View File
@@ -27,8 +27,8 @@ namespace konan {
// Console operations. // Console operations.
void consoleInit(); void consoleInit();
void consolePrintf(const char* format, ...); void consolePrintf(const char* format, ...) __attribute__((format(printf, 1, 2)));
void consoleErrorf(const char* format, ...); void consoleErrorf(const char* format, ...) __attribute__((format(printf, 1, 2)));
void consoleWriteUtf8(const void* utf8, uint32_t sizeBytes); void consoleWriteUtf8(const void* utf8, uint32_t sizeBytes);
void consoleErrorUtf8(const void* utf8, uint32_t sizeBytes); void consoleErrorUtf8(const void* utf8, uint32_t sizeBytes);
// Negative return value denotes that read wasn't successful. // Negative return value denotes that read wasn't successful.
@@ -46,8 +46,8 @@ void onThreadExit(void (*destructor)(void*), void* destructorParameter);
// memcpy/memmove/memcmp are not here intentionally, as frequently implemented/optimized // memcpy/memmove/memcmp are not here intentionally, as frequently implemented/optimized
// by C compiler. // by C compiler.
void* memmem(const void *big, size_t bigLen, const void *little, size_t littleLen); void* memmem(const void *big, size_t bigLen, const void *little, size_t littleLen);
int snprintf(char* buffer, size_t size, const char* format, ...); int snprintf(char* buffer, size_t size, const char* format, ...) __attribute__((format(printf, 3, 4)));
int vsnprintf(char* buffer, size_t size, const char* format, va_list args); int vsnprintf(char* buffer, size_t size, const char* format, va_list args) __attribute__((format(printf, 3, 0)));
size_t strnlen(const char* buffer, size_t maxSize); size_t strnlen(const char* buffer, size_t maxSize);
@@ -32,7 +32,7 @@ RUNTIME_USED RUNTIME_WEAK extern "C" char* Konan_cxa_demangle(
namespace std { namespace std {
RUNTIME_WEAK void __throw_length_error(const char* __s __attribute__((unused))) { RUNTIME_WEAK void __throw_length_error(const char* __s __attribute__((unused))) {
RuntimeAssert(false, __s); RuntimeCheck(false, "%s", __s);
} }
} // namespace std } // namespace std
@@ -511,7 +511,7 @@ class State {
if (remainingNativeWorkers != 0) { if (remainingNativeWorkers != 0) {
konan::consoleErrorf( konan::consoleErrorf(
"Unfinished workers detected, %lu workers leaked!\n" "Unfinished workers detected, %zu workers leaked!\n"
"Use `Platform.isMemoryLeakCheckerActive = false` to avoid this check.\n", "Use `Platform.isMemoryLeakCheckerActive = false` to avoid this check.\n",
remainingNativeWorkers); remainingNativeWorkers);
konan::consoleFlush(); konan::consoleFlush();