* [PATCH] Use __ASSEMBLER__ instead of __ASSEMBLY__
@ 2025-03-13 19:27 Thomas Huth
2025-03-14 3:02 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2025-03-13 19:27 UTC (permalink / raw)
To: devicetree-compiler
Both, Clang and GCC define __ASSEMBLER__ automatically when
compiling .S files, so this macro is a much better fit for
fdt.h - programs that want to use it from .S files don't have
to manually #define __ASSEMBLY__ that way.
While we're at it, also change it in testdata.h, then we don't
have to define __ASSEMBLY__ in the Makefile / meson.build file
anymore.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
Makefile | 2 +-
libfdt/fdt.h | 4 ++--
tests/meson.build | 2 +-
tests/testdata.h | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index f1f0ab3..a00123d 100644
--- a/Makefile
+++ b/Makefile
@@ -360,7 +360,7 @@ clean: libfdt_clean pylibfdt_clean tests_clean
%.o: %.S
@$(VECHO) AS $@
- $(CC) $(CPPFLAGS) $(AFLAGS) -D__ASSEMBLY__ -o $@ -c $<
+ $(CC) $(CPPFLAGS) $(AFLAGS) -o $@ -c $<
%.d: %.c
@$(VECHO) DEP $<
diff --git a/libfdt/fdt.h b/libfdt/fdt.h
index 0c91aa7..a07abfc 100644
--- a/libfdt/fdt.h
+++ b/libfdt/fdt.h
@@ -7,7 +7,7 @@
* Copyright 2012 Kim Phillips, Freescale Semiconductor.
*/
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
struct fdt_header {
fdt32_t magic; /* magic word FDT_MAGIC */
@@ -45,7 +45,7 @@ struct fdt_property {
char data[];
};
-#endif /* !__ASSEMBLY */
+#endif /* !__ASSEMBLER__ */
#define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
#define FDT_TAGSIZE sizeof(fdt32_t)
diff --git a/tests/meson.build b/tests/meson.build
index 52d657e..37bfd47 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,4 +1,4 @@
-trees = static_library('trees', files('trees.S'), c_args: '-D__ASSEMBLY__',
+trees = static_library('trees', files('trees.S'),
build_by_default: false,
include_directories: libfdt_inc)
diff --git a/tests/testdata.h b/tests/testdata.h
index 4f9e3ba..fcebc2c 100644
--- a/tests/testdata.h
+++ b/tests/testdata.h
@@ -1,4 +1,4 @@
-#ifdef __ASSEMBLY__
+#ifdef __ASSEMBLER__
#define ASM_CONST_LL(x) (x)
#else
#define ASM_CONST_LL(x) (x##ULL)
@@ -46,7 +46,7 @@
#define TEST_MEMREGION_SIZE_HI 0x0fedcba900000000
#define TEST_MEMREGION_SIZE_INC 0x1000
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
extern struct fdt_header test_tree1;
extern struct fdt_header truncated_property;
extern struct fdt_header bad_node_char;
@@ -57,4 +57,4 @@ extern struct fdt_header truncated_string;
extern struct fdt_header truncated_memrsv;
extern struct fdt_header two_roots;
extern struct fdt_header named_root;
-#endif /* ! __ASSEMBLY */
+#endif /* ! __ASSEMBLER__ */
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Use __ASSEMBLER__ instead of __ASSEMBLY__
2025-03-13 19:27 [PATCH] Use __ASSEMBLER__ instead of __ASSEMBLY__ Thomas Huth
@ 2025-03-14 3:02 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2025-03-14 3:02 UTC (permalink / raw)
To: Thomas Huth; +Cc: devicetree-compiler
[-- Attachment #1: Type: text/plain, Size: 3106 bytes --]
On Thu, Mar 13, 2025 at 08:27:18PM +0100, Thomas Huth wrote:
> Both, Clang and GCC define __ASSEMBLER__ automatically when
> compiling .S files, so this macro is a much better fit for
> fdt.h - programs that want to use it from .S files don't have
> to manually #define __ASSEMBLY__ that way.
> While we're at it, also change it in testdata.h, then we don't
> have to define __ASSEMBLY__ in the Makefile / meson.build file
> anymore.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Applied, thanks.
> ---
> Makefile | 2 +-
> libfdt/fdt.h | 4 ++--
> tests/meson.build | 2 +-
> tests/testdata.h | 6 +++---
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index f1f0ab3..a00123d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -360,7 +360,7 @@ clean: libfdt_clean pylibfdt_clean tests_clean
>
> %.o: %.S
> @$(VECHO) AS $@
> - $(CC) $(CPPFLAGS) $(AFLAGS) -D__ASSEMBLY__ -o $@ -c $<
> + $(CC) $(CPPFLAGS) $(AFLAGS) -o $@ -c $<
>
> %.d: %.c
> @$(VECHO) DEP $<
> diff --git a/libfdt/fdt.h b/libfdt/fdt.h
> index 0c91aa7..a07abfc 100644
> --- a/libfdt/fdt.h
> +++ b/libfdt/fdt.h
> @@ -7,7 +7,7 @@
> * Copyright 2012 Kim Phillips, Freescale Semiconductor.
> */
>
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
>
> struct fdt_header {
> fdt32_t magic; /* magic word FDT_MAGIC */
> @@ -45,7 +45,7 @@ struct fdt_property {
> char data[];
> };
>
> -#endif /* !__ASSEMBLY */
> +#endif /* !__ASSEMBLER__ */
>
> #define FDT_MAGIC 0xd00dfeed /* 4: version, 4: total size */
> #define FDT_TAGSIZE sizeof(fdt32_t)
> diff --git a/tests/meson.build b/tests/meson.build
> index 52d657e..37bfd47 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -1,4 +1,4 @@
> -trees = static_library('trees', files('trees.S'), c_args: '-D__ASSEMBLY__',
> +trees = static_library('trees', files('trees.S'),
> build_by_default: false,
> include_directories: libfdt_inc)
>
> diff --git a/tests/testdata.h b/tests/testdata.h
> index 4f9e3ba..fcebc2c 100644
> --- a/tests/testdata.h
> +++ b/tests/testdata.h
> @@ -1,4 +1,4 @@
> -#ifdef __ASSEMBLY__
> +#ifdef __ASSEMBLER__
> #define ASM_CONST_LL(x) (x)
> #else
> #define ASM_CONST_LL(x) (x##ULL)
> @@ -46,7 +46,7 @@
> #define TEST_MEMREGION_SIZE_HI 0x0fedcba900000000
> #define TEST_MEMREGION_SIZE_INC 0x1000
>
> -#ifndef __ASSEMBLY__
> +#ifndef __ASSEMBLER__
> extern struct fdt_header test_tree1;
> extern struct fdt_header truncated_property;
> extern struct fdt_header bad_node_char;
> @@ -57,4 +57,4 @@ extern struct fdt_header truncated_string;
> extern struct fdt_header truncated_memrsv;
> extern struct fdt_header two_roots;
> extern struct fdt_header named_root;
> -#endif /* ! __ASSEMBLY */
> +#endif /* ! __ASSEMBLER__ */
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-14 3:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 19:27 [PATCH] Use __ASSEMBLER__ instead of __ASSEMBLY__ Thomas Huth
2025-03-14 3:02 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).