Skip to content

Commit a87f6fe

Browse files
dewitt-garminnashif
authored andcommitted
linker: Fix clang-format breaking linker macros
clang-format will remove the space after the equals sign causing link issues. Disable clang-format for some linker macros since they should not be formatted as C code. Signed-off-by: Josh DeWitt <[email protected]>
1 parent fe8a089 commit a87f6fe

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

include/zephyr/linker/devicetree_regions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
*
212212
* @param node_id devicetree node identifier
213213
*/
214+
/* clang-format off */
214215
#define _SECTION_DECLARE(node_id) \
215216
LINKER_DT_NODE_REGION_NAME_TOKEN(node_id) (NOLOAD) : \
216217
{ \
@@ -221,6 +222,7 @@
221222
} > LINKER_DT_NODE_REGION_NAME_TOKEN(node_id) \
222223
_DT_SECTION_SIZE(node_id) = _DT_SECTION_END(node_id) - _DT_SECTION_START(node_id); \
223224
_DT_SECTION_LOAD(node_id) = LOADADDR(LINKER_DT_NODE_REGION_NAME_TOKEN(node_id));
225+
/* clang-format on */
224226

225227
/** @endcond */
226228

include/zephyr/linker/iterable_sections.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* @{
1313
*/
1414

15+
/* clang-format off */
1516
#define Z_LINK_ITERABLE(struct_type) \
1617
_CONCAT(_##struct_type, _list_start) = .; \
1718
KEEP(*(SORT_BY_NAME(._##struct_type.static.*))); \
@@ -34,6 +35,7 @@
3435
_CONCAT(_##struct_type, _list_start) = .; \
3536
*(SORT_BY_NAME(._##struct_type.static.*)); \
3637
_CONCAT(_##struct_type, _list_end) = .
38+
/* clang-format on */
3739

3840
#define Z_LINK_ITERABLE_SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN
3941

include/zephyr/linker/linker-defs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@
4444
* (sorted by priority). Ensure the objects aren't discarded if there is
4545
* no direct reference to them
4646
*/
47+
/* clang-format off */
4748
#define CREATE_OBJ_LEVEL(object, level) \
4849
__##object##_##level##_start = .; \
4950
KEEP(*(SORT(.z_##object##_##level?_*))); \
5051
KEEP(*(SORT(.z_##object##_##level??_*)));
52+
/* clang-format on */
5153

5254
/*
5355
* link in shell initialization objects for all modules that use shell and

0 commit comments

Comments
 (0)