Skip to content

Commit 56ae27d

Browse files
asbcmuellner
authored andcommitted
Refer to the RISC-V C API document for preprocessor definitions
The list in this document is incomplete, and the riscv-c-api-doc repo has since been created to hold this kind of information. Let's just point there rather than trying to maintain the same information in two places. That document doesn't mention that older version of GCC defined `__riscv__` but I think this is just a historical curiousity at this point, so this isn't a real loss of information.
1 parent 923fc70 commit 56ae27d

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

src/toolchain-conventions.adoc

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -170,34 +170,9 @@ disable the automatic 'compression' of instructions.
170170

171171
== C/C++ preprocessor definitions
172172

173-
- `+__riscv+`: defined for any RISC-V target. Older versions of the GCC
174-
toolchain defined `+__riscv__+`.
175-
- `+__riscv_xlen+`: 32 for RV32 and 64 for RV64.
176-
- `+__riscv_float_abi_soft+`, `+__riscv_float_abi_single+`,
177-
`+__riscv_float_abi_double+`: one of these three will be defined, depending on
178-
target ABI.
179-
- `+__riscv_cmodel_medlow+`, `+__riscv_cmodel_medany+`,
180-
`+__riscv_cmodel_large+`: one of these three will be defined, depending on
181-
the target code model.
182-
- `+__riscv_mul+`: defined when targeting the 'M' ISA extension.
183-
- `+__riscv_muldiv+`: defined when targeting the 'M' ISA extension and
184-
`-mno-div` has not been used.
185-
- `+__riscv_div+`: defined when targeting the 'M' ISA extension and `-mno-div`
186-
has not been used.
187-
- `+__riscv_atomic+`: defined when targeting the 'A' ISA extension.
188-
- `+__riscv_flen+`: 32 when targeting the 'F' ISA extension (but not 'D') and 64
189-
when targeting 'FD'.
190-
- `+__riscv_fdiv+`: defined when targeting the 'F' or 'D' ISA extensions and
191-
`-mno-fdiv` has not been used.
192-
- `+__riscv_fsqrt+`: defined when targeting the 'F' or 'D' ISA extensions and
193-
`-mno-fdiv` has not been used.
194-
- `+__riscv_compressed+`: defined when targeting the 'C' ISA extension.
195-
196-
=== Issues for consideration
197-
- What should the naming convention be for defines that indicate support for
198-
non-standard extensions?
199-
- What additional information could/should be exposed via preprocessor
200-
defines?
173+
These are now maintained in the
174+
https://github.com/riscv-non-isa/riscv-c-api-doc/blob/main/src/c-api.adoc[RISC-V
175+
C API specification].
201176

202177
== Specifying stack alignment
203178

0 commit comments

Comments
 (0)