From f60a02fc78535ee0d28254353e891a94f6dcaa09 Mon Sep 17 00:00:00 2001 From: Dan Klishch Date: Fri, 26 Apr 2024 22:01:02 -0400 Subject: [PATCH] LibC: Move architecture detection from fenv.h to arch/fenv.h This is similar to how it is done in sys/arch/regs.h. --- Userland/Libraries/LibC/arch/aarch64/fenv.h | 22 +++++++++++++++++++++ Userland/Libraries/LibC/arch/fenv.h | 17 ++++++++++++++++ Userland/Libraries/LibC/fenv.h | 15 +------------- 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 Userland/Libraries/LibC/arch/aarch64/fenv.h create mode 100644 Userland/Libraries/LibC/arch/fenv.h diff --git a/Userland/Libraries/LibC/arch/aarch64/fenv.h b/Userland/Libraries/LibC/arch/aarch64/fenv.h new file mode 100644 index 00000000000..a17752abd86 --- /dev/null +++ b/Userland/Libraries/LibC/arch/aarch64/fenv.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024, Dan Klishch + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +#ifndef __aarch64__ +# error "This file should not be included on architectures other than AArch64." +#endif + +__BEGIN_DECLS + +// TODO: Implement this. +typedef struct fenv_t { + char __dummy; // NOTE: This silences -Wextern-c-compat. +} fenv_t; + +__END_DECLS diff --git a/Userland/Libraries/LibC/arch/fenv.h b/Userland/Libraries/LibC/arch/fenv.h new file mode 100644 index 00000000000..0121f1afc31 --- /dev/null +++ b/Userland/Libraries/LibC/arch/fenv.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2024, Dan Klishch + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#if defined(__x86_64__) +# include +#elif defined(__aarch64__) +# include +#elif defined(__riscv) && __riscv_xlen == 64 +# include +#else +# error Unknown architecture +#endif diff --git a/Userland/Libraries/LibC/fenv.h b/Userland/Libraries/LibC/fenv.h index 34b14ddfa8f..7617921d16e 100644 --- a/Userland/Libraries/LibC/fenv.h +++ b/Userland/Libraries/LibC/fenv.h @@ -6,23 +6,10 @@ #pragma once +#include #include #include -#if defined(__x86_64__) -# include -#elif defined(__aarch64__) - -// TODO: Implement this. -typedef struct fenv_t { -} fenv_t; - -#elif defined(__riscv) && __riscv_xlen == 64 -# include -#else -# error "Unknown architecture" -#endif - __BEGIN_DECLS #define FE_DFL_ENV ((fenv_t const*)-1)