[libc-commits] [PATCH] D145594: [libc] Add fenv_t and signal macros in riscv
Roland McGrath via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Mar 9 11:01:32 PST 2023
mcgrathr added inline comments.
================
Comment at: libc/include/llvm-libc-types/fenv_t.h:27
+#elif defined(__riscv)
+typedef unsigned int fenv_t;
#else
----------------
I would *highly* recommend never using a typedef to a base type (or other existing type) like this. It's much better to define a struct with a single member, as you can see done for the ARM case above. This ensures that the API contract enforces that `fenv_t` and `fenv_t*` values are passed, rather than `unsigned int` or `unsigned int*`. On x86-64, ARM, and RISC-V, the calling convention for a struct like this is the same as for the bare integer type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145594/new/
https://reviews.llvm.org/D145594
More information about the libc-commits
mailing list