From 41d4f61b7e3dd9a1ea904e4e0452cffd614b4e66 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 18:56:18 +0200 Subject: [PATCH] Add definition of enum storage type Some APIs use enum types in their definitions. The C specification does not define the size of the integer type used for storing and passing enum type variables. Provide a definition matching GCC's default behavior. Signed-off-by: Heinrich Schuchardt --- riscv-elf.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/riscv-elf.md b/riscv-elf.md index 81e70cd9..4cfb2dc7 100644 --- a/riscv-elf.md +++ b/riscv-elf.md @@ -443,6 +443,13 @@ member. The size of any object is a multiple of its alignment. Booleans (`bool`/`_Bool`) stored in memory or when being passed as scalar arguments are either `0` (`false`) or `1` (`true`). +`enum` types use `int` as storage type if the value range fits into the value +range of `signed int` or into the value range of `unsigned int`. If the value +range is larger, the enum values use an 64bit integer storage type: + +* `long` for an LP64 calling convention, +* `long long` for an ILP32 calling convention. + A null pointer (for all types) has the value zero. `_Float16` is as defined in the C ISO/IEC TS 18661-3 extension.