This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ARM][PATCH] Make arm_cmse.h C99 compatible
- From: "Andre Vieira (lists)" <Andre dot SimoesDiasVieira at arm dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Jun 2018 11:03:39 +0100
- Subject: Re: [ARM][PATCH] Make arm_cmse.h C99 compatible
- References: <5B165A8C.9040503@arm.com> <5B165AF1.8060204@foss.arm.com>
On 05/06/18 10:42, Kyrill Tkachov wrote:
> Hi Andre,
>
> On 05/06/18 10:40, Andre Vieira (lists) wrote:
>> Hi all,
>>
>> This patch makes the arm_cmse.h header file ISO C compliant. We were
>> using 'typeof' before when we should be using '__typeof__'.
>> Duplicated cmse-1.c with -std=c99 on the command line to test this.
>>
>> Ran the cmse tests for arm-none-eabi.
>>
>> Is this OK for trunk?
>>
>
> I think you forgot to attach the patch.
>
Someone must have switched my coffee for a decaf...
Here it is.Thanks!
Cheers,
Andre
> Kyrill
>
>> Cheers,
>> Andre
>>
>> gcc
>> 2018-06-xx Andre Vieira <andre.simoesdiasvieira@arm.com>
>>
>> * config/arm/arm_cmse.h (cmse_nsfptr_create): Change typeof to
>> __typeof__.
>> (cmse_check_pointed_opject): Idem.
>>
>> gcc/testsuite
>> 2018-06-xx Andre Vieira <andre.simoesdiasvieira@arm.com>
>>
>> * gcc.target/arm/cmse/cmse-1c99.c: New test.
>
diff --git a/gcc/config/arm/arm_cmse.h b/gcc/config/arm/arm_cmse.h
index f972e23659d557728570d7af93d96b0310e4ff47..9b35537cd33bca8053d2d34378581aae7dbc1e8f 100644
--- a/gcc/config/arm/arm_cmse.h
+++ b/gcc/config/arm/arm_cmse.h
@@ -173,7 +173,7 @@ cmse_nonsecure_caller (void)
#define CMSE_MPU_NONSECURE 16
#define CMSE_NONSECURE 18
-#define cmse_nsfptr_create(p) ((typeof ((p))) ((__INTPTR_TYPE__) (p) & ~1))
+#define cmse_nsfptr_create(p) ((__typeof__ ((p))) ((__INTPTR_TYPE__) (p) & ~1))
#define cmse_is_nsfptr(p) (!((__INTPTR_TYPE__) (p) & 1))
@@ -187,7 +187,7 @@ __extension__ void *
cmse_check_address_range (void *, size_t, int);
#define cmse_check_pointed_object(p, f) \
- ((typeof ((p))) cmse_check_address_range ((p), sizeof (*(p)), (f)))
+ ((__typeof__ ((p))) cmse_check_address_range ((p), sizeof (*(p)), (f)))
#endif /* __ARM_FEATURE_CMSE & 1 */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c
new file mode 100644
index 0000000000000000000000000000000000000000..0f99dd341b7e16d6b4ac72a1b820828aa60197a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -mcmse -std=c99" } */
+/* This is a copy of cmse-1.c to test arm_mve.h ISO C compatibility. */
+#include "cmse-1.c"