Skip to content

Commit 1b3534d

Browse files
stephanosiodanieldegrasse
authored andcommitted
cmake: gcc: Fix code formatting of target_riscv.cmake
This commit fixes the incorrect code formatting used by target_riscv.cmake by changing the 4-space indent to 2-space and removing the space between if keyword and parenthesis. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent 9b428c8 commit 1b3534d

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

cmake/compiler/gcc/target_riscv.cmake

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,54 @@ set(riscv_mabi "lp")
44
set(riscv_march "rv")
55

66
if(CONFIG_64BIT)
7-
string(CONCAT riscv_mabi ${riscv_mabi} "64")
8-
string(CONCAT riscv_march ${riscv_march} "64")
9-
list(APPEND TOOLCHAIN_C_FLAGS -mcmodel=medany)
10-
list(APPEND TOOLCHAIN_LD_FLAGS -mcmodel=medany)
7+
string(CONCAT riscv_mabi ${riscv_mabi} "64")
8+
string(CONCAT riscv_march ${riscv_march} "64")
9+
list(APPEND TOOLCHAIN_C_FLAGS -mcmodel=medany)
10+
list(APPEND TOOLCHAIN_LD_FLAGS -mcmodel=medany)
1111
else()
12-
string(CONCAT riscv_mabi "i" ${riscv_mabi} "32")
13-
string(CONCAT riscv_march ${riscv_march} "32")
12+
string(CONCAT riscv_mabi "i" ${riscv_mabi} "32")
13+
string(CONCAT riscv_march ${riscv_march} "32")
1414
endif()
1515

16-
if (CONFIG_RISCV_ISA_RV32E)
17-
string(CONCAT riscv_mabi ${riscv_mabi} "e")
18-
string(CONCAT riscv_march ${riscv_march} "e")
16+
if(CONFIG_RISCV_ISA_RV32E)
17+
string(CONCAT riscv_mabi ${riscv_mabi} "e")
18+
string(CONCAT riscv_march ${riscv_march} "e")
1919
else()
20-
string(CONCAT riscv_march ${riscv_march} "i")
20+
string(CONCAT riscv_march ${riscv_march} "i")
2121
endif()
2222

23-
if (CONFIG_RISCV_ISA_EXT_M)
24-
string(CONCAT riscv_march ${riscv_march} "m")
23+
if(CONFIG_RISCV_ISA_EXT_M)
24+
string(CONCAT riscv_march ${riscv_march} "m")
2525
endif()
26-
if (CONFIG_RISCV_ISA_EXT_A)
27-
string(CONCAT riscv_march ${riscv_march} "a")
26+
27+
if(CONFIG_RISCV_ISA_EXT_A)
28+
string(CONCAT riscv_march ${riscv_march} "a")
2829
endif()
2930

3031
if(CONFIG_FPU)
31-
if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)
32-
if(CONFIG_FLOAT_HARD)
33-
string(CONCAT riscv_mabi ${riscv_mabi} "d")
34-
endif()
35-
string(CONCAT riscv_march ${riscv_march} "fd")
36-
else()
37-
if(CONFIG_FLOAT_HARD)
38-
string(CONCAT riscv_mabi ${riscv_mabi} "f")
39-
endif()
40-
string(CONCAT riscv_march ${riscv_march} "f")
32+
if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)
33+
if(CONFIG_FLOAT_HARD)
34+
string(CONCAT riscv_mabi ${riscv_mabi} "d")
35+
endif()
36+
string(CONCAT riscv_march ${riscv_march} "fd")
37+
else()
38+
if(CONFIG_FLOAT_HARD)
39+
string(CONCAT riscv_mabi ${riscv_mabi} "f")
4140
endif()
41+
string(CONCAT riscv_march ${riscv_march} "f")
42+
endif()
4243
endif()
4344

4445
if(CONFIG_RISCV_ISA_EXT_C)
45-
string(CONCAT riscv_march ${riscv_march} "c")
46+
string(CONCAT riscv_march ${riscv_march} "c")
4647
endif()
4748

4849
if(CONFIG_RISCV_ISA_EXT_ZICSR)
49-
string(CONCAT riscv_march ${riscv_march} "_zicsr")
50+
string(CONCAT riscv_march ${riscv_march} "_zicsr")
5051
endif()
5152

5253
if(CONFIG_RISCV_ISA_EXT_ZIFENCEI)
53-
string(CONCAT riscv_march ${riscv_march} "_zifencei")
54+
string(CONCAT riscv_march ${riscv_march} "_zifencei")
5455
endif()
5556

5657
# Check whether we already imply Zaamo/Zlrsc by selecting the A extension; if not - check them
@@ -66,26 +67,26 @@ if(NOT CONFIG_RISCV_ISA_EXT_A)
6667
endif()
6768

6869
if(CONFIG_RISCV_ISA_EXT_ZBA)
69-
string(CONCAT riscv_march ${riscv_march} "_zba")
70+
string(CONCAT riscv_march ${riscv_march} "_zba")
7071
endif()
7172

7273
if(CONFIG_RISCV_ISA_EXT_ZBB)
73-
string(CONCAT riscv_march ${riscv_march} "_zbb")
74+
string(CONCAT riscv_march ${riscv_march} "_zbb")
7475
endif()
7576

7677
if(CONFIG_RISCV_ISA_EXT_ZBC)
77-
string(CONCAT riscv_march ${riscv_march} "_zbc")
78+
string(CONCAT riscv_march ${riscv_march} "_zbc")
7879
endif()
7980

8081
if(CONFIG_RISCV_ISA_EXT_ZBS)
81-
string(CONCAT riscv_march ${riscv_march} "_zbs")
82+
string(CONCAT riscv_march ${riscv_march} "_zbs")
8283
endif()
8384

8485
# Check whether we already imply Zmmul by selecting the M extension; if not - enable it
8586
if(NOT CONFIG_RISCV_ISA_EXT_M AND
8687
CONFIG_RISCV_ISA_EXT_ZMMUL AND
8788
"${GCC_COMPILER_VERSION}" VERSION_GREATER_EQUAL 13.0.0)
88-
string(CONCAT riscv_march ${riscv_march} "_zmmul")
89+
string(CONCAT riscv_march ${riscv_march} "_zmmul")
8990
endif()
9091

9192
list(APPEND TOOLCHAIN_C_FLAGS -mabi=${riscv_mabi} -march=${riscv_march})
@@ -100,7 +101,7 @@ set(LLEXT_REMOVE_FLAGS
100101
-fdata-sections
101102
-g.*
102103
-Os
103-
)
104+
)
104105

105106
# Flags to be added to llext code compilation
106107
# mno-relax is needed to stop gcc from generating R_RISCV_ALIGN relocations,
@@ -113,4 +114,4 @@ set(LLEXT_APPEND_FLAGS
113114
-march=${riscv_march}
114115
-mno-relax
115116
-msmall-data-limit=0
116-
)
117+
)

0 commit comments

Comments
 (0)