public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Rename test-defined macros
@ 2022-06-23 21:21 Dimitar Dimitrov
  2022-06-24  6:55 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Dimitar Dimitrov @ 2022-06-23 21:21 UTC (permalink / raw)
  To: gcc-patches

Epiphany, PRU, ARC and NDS32 may predefine __big_endian__ and
__little_endian__ macros.  This leads to spurious warnings like:
  gcc.dg/sso/memcpy-1.c:7: warning: "__little_endian__" redefined

Fix by renaming the macros in the test.

Ok for trunk?

gcc/testsuite/ChangeLog:

	* gcc.dg/sso/memcpy-1.c (__big_endian__, __little_endian__):
	Rename macros to avoid conflicts with predefined ones.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
 gcc/testsuite/gcc.dg/sso/memcpy-1.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/sso/memcpy-1.c b/gcc/testsuite/gcc.dg/sso/memcpy-1.c
index b4e1c8786d9..0dea955cbaf 100644
--- a/gcc/testsuite/gcc.dg/sso/memcpy-1.c
+++ b/gcc/testsuite/gcc.dg/sso/memcpy-1.c
@@ -3,20 +3,20 @@
 typedef unsigned char uint8_t;
 typedef unsigned int uint32_t;
 
-#define __big_endian__ scalar_storage_order("big-endian")
-#define __little_endian__ scalar_storage_order("little-endian")
+#define __big_endian_attr__ scalar_storage_order("big-endian")
+#define __little_endian_attr__ scalar_storage_order("little-endian")
 
 typedef union
 {
   uint32_t val;
   uint8_t v[4];
-} __attribute__((__big_endian__)) upal_u32be_t;
+} __attribute__((__big_endian_attr__)) upal_u32be_t;
 
 typedef union
 {
   uint32_t val;
   uint8_t v[4];
-} __attribute__((__little_endian__)) upal_u32le_t;
+} __attribute__((__little_endian_attr__)) upal_u32le_t;
 
 static inline uint32_t native_to_big_endian(uint32_t t)
 {
-- 
2.36.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] testsuite: Rename test-defined macros
  2022-06-23 21:21 [PATCH] testsuite: Rename test-defined macros Dimitar Dimitrov
@ 2022-06-24  6:55 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-06-24  6:55 UTC (permalink / raw)
  To: Dimitar Dimitrov; +Cc: GCC Patches

On Thu, Jun 23, 2022 at 11:23 PM Dimitar Dimitrov <dimitar@dinux.eu> wrote:
>
> Epiphany, PRU, ARC and NDS32 may predefine __big_endian__ and
> __little_endian__ macros.  This leads to spurious warnings like:
>   gcc.dg/sso/memcpy-1.c:7: warning: "__little_endian__" redefined
>
> Fix by renaming the macros in the test.
>
> Ok for trunk?

OK

> gcc/testsuite/ChangeLog:
>
>         * gcc.dg/sso/memcpy-1.c (__big_endian__, __little_endian__):
>         Rename macros to avoid conflicts with predefined ones.
>
> Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
> ---
>  gcc/testsuite/gcc.dg/sso/memcpy-1.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/sso/memcpy-1.c b/gcc/testsuite/gcc.dg/sso/memcpy-1.c
> index b4e1c8786d9..0dea955cbaf 100644
> --- a/gcc/testsuite/gcc.dg/sso/memcpy-1.c
> +++ b/gcc/testsuite/gcc.dg/sso/memcpy-1.c
> @@ -3,20 +3,20 @@
>  typedef unsigned char uint8_t;
>  typedef unsigned int uint32_t;
>
> -#define __big_endian__ scalar_storage_order("big-endian")
> -#define __little_endian__ scalar_storage_order("little-endian")
> +#define __big_endian_attr__ scalar_storage_order("big-endian")
> +#define __little_endian_attr__ scalar_storage_order("little-endian")
>
>  typedef union
>  {
>    uint32_t val;
>    uint8_t v[4];
> -} __attribute__((__big_endian__)) upal_u32be_t;
> +} __attribute__((__big_endian_attr__)) upal_u32be_t;
>
>  typedef union
>  {
>    uint32_t val;
>    uint8_t v[4];
> -} __attribute__((__little_endian__)) upal_u32le_t;
> +} __attribute__((__little_endian_attr__)) upal_u32le_t;
>
>  static inline uint32_t native_to_big_endian(uint32_t t)
>  {
> --
> 2.36.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-24  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 21:21 [PATCH] testsuite: Rename test-defined macros Dimitar Dimitrov
2022-06-24  6:55 ` Richard Biener

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 read-only IMAP folder(s) and NNTP newsgroup(s).