> -----Original Message-----
> From: Matthew Malcomson <matthew.malcom...@arm.com>
> Sent: 09 April 2020 15:31
> To: gcc-patches@gcc.gnu.org
> Cc: nd <n...@arm.com>; Ramana Radhakrishnan
> <ramana.radhakrish...@arm.com>; Kyrylo Tkachov
> <kyrylo.tkac...@arm.com>; Richard Earnshaw
> <richard.earns...@arm.com>; ni...@redhat.com
> Subject: [Arm] Allow the use of arm_cde.h for C++
> 
> arm_cde.h includes the arm_mve_types.h header, which declares some C++
> overloaded functions.
> 
> There is a superfluous `extern "C"` statement in arm_cde.h, which
> encompasses these functions.  This means that if compiling for C++, the
> overloaded functions are declared, but are declared without name
> mangling.  Hence all the function names are the same and we have many
> conflicting declarations.
> 
> Testing Done:
>   Regression tested for arm-none-eabi.

Ok.
Thanks,
Kyrill

> 
> gcc/ChangeLog:
> 
> 2020-04-09  Matthew Malcomson  <matthew.malcom...@arm.com>
> 
>       * config/arm/arm_cde.h: Remove `extern "C"` when compiling for
>       C++.
> 
> gcc/testsuite/ChangeLog:
> 
> 2020-04-09  Matthew Malcomson  <matthew.malcom...@arm.com>
> 
>       * g++.target/arm/cde_mve.C: New test.
> 
> 
> 
> ###############     Attachment also inlined for ease of reply
> ###############
> 
> 
> diff --git a/gcc/config/arm/arm_cde.h b/gcc/config/arm/arm_cde.h
> index
> d8ddda6bd648d8b94e97f7b6403b7708cebc9eb3..0ba3ee02d057dd280c9b34
> 00ef70b46ed472aec3 100644
> --- a/gcc/config/arm/arm_cde.h
> +++ b/gcc/config/arm/arm_cde.h
> @@ -27,10 +27,6 @@
>  #ifndef _GCC_ARM_CDE_H
>  #define _GCC_ARM_CDE_H 1
> 
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
>  #include <stdint.h>
> 
>  #if defined (__ARM_FEATURE_CDE)
> @@ -177,8 +173,4 @@ extern "C" {
> 
>  #endif
> 
> -#ifdef __cplusplus
> -}
> -#endif
> -
>  #endif
> diff --git a/gcc/testsuite/g++.target/arm/cde_mve.C
> b/gcc/testsuite/g++.target/arm/cde_mve.C
> new file mode 100644
> index
> 0000000000000000000000000000000000000000..897cbd2b8119471385c1c51
> 158b1aa4851acbaf1
> --- /dev/null
> +++ b/gcc/testsuite/g++.target/arm/cde_mve.C
> @@ -0,0 +1,10 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target arm_v8_1m_main_cde_mve_fp_ok } */
> +/* { dg-add-options arm_v8_1m_main_cde_mve_fp } */
> +
> +/* Ensure this compiles.  */
> +#include "arm_cde.h"
> +int foo ()
> +{
> +  return 1;
> +}

Reply via email to