From 842249aff54146bf68d49bfd25165eddaf3c9fae Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Tue, 29 Jun 2021 10:31:48 +0200 Subject: LibC: Don't use C++ attribute syntax in C-visible headers Fixes errors when building Clang's compiler-rt, which compiles in C11 more. --- Userland/Libraries/LibC/assert.h | 4 ++-- Userland/Libraries/LibC/cxxabi.cpp | 2 +- Userland/Libraries/LibC/ssp.cpp | 4 ++-- Userland/Libraries/LibC/sys/internals.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'Userland/Libraries/LibC') diff --git a/Userland/Libraries/LibC/assert.h b/Userland/Libraries/LibC/assert.h index b9756a46e8..b9231dd5d4 100644 --- a/Userland/Libraries/LibC/assert.h +++ b/Userland/Libraries/LibC/assert.h @@ -11,7 +11,7 @@ __BEGIN_DECLS #ifdef DEBUG -[[noreturn]] void __assertion_failed(const char* msg); +__attribute__((noreturn)) void __assertion_failed(const char* msg); # define __stringify_helper(x) # x # define __stringify(x) __stringify_helper(x) # define assert(expr) \ @@ -24,7 +24,7 @@ __BEGIN_DECLS # define VERIFY_NOT_REACHED() _abort() #endif -[[noreturn]] void _abort(); +__attribute__((noreturn)) void _abort(); #ifndef __cplusplus # define static_assert _Static_assert diff --git a/Userland/Libraries/LibC/cxxabi.cpp b/Userland/Libraries/LibC/cxxabi.cpp index 502f22309d..c7af6660ba 100644 --- a/Userland/Libraries/LibC/cxxabi.cpp +++ b/Userland/Libraries/LibC/cxxabi.cpp @@ -104,7 +104,7 @@ void __cxa_finalize(void* dso_handle) __pthread_mutex_unlock(&atexit_mutex); } -[[noreturn]] void __cxa_pure_virtual() +__attribute__((noreturn)) void __cxa_pure_virtual() { VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibC/ssp.cpp b/Userland/Libraries/LibC/ssp.cpp index 2937c5da3e..dbc108bd6e 100644 --- a/Userland/Libraries/LibC/ssp.cpp +++ b/Userland/Libraries/LibC/ssp.cpp @@ -20,7 +20,7 @@ extern "C" { extern u32 __stack_chk_guard; u32 __stack_chk_guard = (u32)0xc6c7c8c9; -[[noreturn]] void __stack_chk_fail() +__attribute__((noreturn)) void __stack_chk_fail() { dbgln("Error: USERSPACE({}) Stack protector failure, stack smashing detected!", getpid()); if (__stdio_is_initialized) @@ -28,7 +28,7 @@ u32 __stack_chk_guard = (u32)0xc6c7c8c9; abort(); } -[[noreturn]] void __stack_chk_fail_local() +__attribute__((noreturn)) void __stack_chk_fail_local() { __stack_chk_fail(); } diff --git a/Userland/Libraries/LibC/sys/internals.h b/Userland/Libraries/LibC/sys/internals.h index e0f755d732..1ddebc0eb3 100644 --- a/Userland/Libraries/LibC/sys/internals.h +++ b/Userland/Libraries/LibC/sys/internals.h @@ -21,8 +21,8 @@ extern bool __stdio_is_initialized; int __cxa_atexit(AtExitFunction exit_function, void* parameter, void* dso_handle); void __cxa_finalize(void* dso_handle); -[[noreturn]] void __cxa_pure_virtual() __attribute__((weak)); -[[noreturn]] void __stack_chk_fail(); -[[noreturn]] void __stack_chk_fail_local(); +__attribute__((noreturn)) void __cxa_pure_virtual() __attribute__((weak)); +__attribute__((noreturn)) void __stack_chk_fail(); +__attribute__((noreturn)) void __stack_chk_fail_local(); __END_DECLS -- cgit v1.2.3