LibC: Move architecture detection from fenv.h to arch/fenv.h

This is similar to how it is done in sys/arch/regs.h.
This commit is contained in:
Dan Klishch 2024-04-26 22:01:02 -04:00 committed by Andrew Kaster
parent 4439b4afcf
commit f60a02fc78
Notes: sideshowbarker 2024-07-17 02:22:23 +09:00
3 changed files with 40 additions and 14 deletions

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2024, Dan Klishch <danilklishch@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <sys/cdefs.h>
#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

View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2024, Dan Klishch <danilklishch@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#if defined(__x86_64__)
# include <arch/x86_64/fenv.h>
#elif defined(__aarch64__)
# include <arch/aarch64/fenv.h>
#elif defined(__riscv) && __riscv_xlen == 64
# include <arch/riscv64/fenv.h>
#else
# error Unknown architecture
#endif

View file

@ -6,23 +6,10 @@
#pragma once
#include <arch/fenv.h>
#include <stdint.h>
#include <sys/cdefs.h>
#if defined(__x86_64__)
# include <arch/x86_64/fenv.h>
#elif defined(__aarch64__)
// TODO: Implement this.
typedef struct fenv_t {
} fenv_t;
#elif defined(__riscv) && __riscv_xlen == 64
# include <arch/riscv64/fenv.h>
#else
# error "Unknown architecture"
#endif
__BEGIN_DECLS
#define FE_DFL_ENV ((fenv_t const*)-1)