[Arm] Allow the use of arm_cde.h for C++
authorMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 9 Apr 2020 15:11:09 +0000 (16:11 +0100)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 9 Apr 2020 15:11:09 +0000 (16:11 +0100)
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.

gcc/ChangeLog:

2020-04-09  Matthew Malcomson  <matthew.malcomson@arm.com>

* config/arm/arm_cde.h: Remove `extern "C"` when compiling for
C++.

gcc/testsuite/ChangeLog:

2020-04-09  Matthew Malcomson  <matthew.malcomson@arm.com>

* g++.target/arm/cde_mve.C: New test.

gcc/ChangeLog
gcc/config/arm/arm_cde.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/arm/cde_mve.C [new file with mode: 0644]

index 368dfd6094e08b0a58cbf3888a9375bbc2bba755..d081003609f55a5be61fba4af2f34fbf22a81876 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-09  Matthew Malcomson  <matthew.malcomson@arm.com>
+
+       * config/arm/arm_cde.h: Remove `extern "C"` when compiling for
+       C++.
+
 2020-04-09  Martin Jambor  <mjambor@suse.cz>
            Richard Biener  <rguenther@suse.de>
 
index d8ddda6bd648d8b94e97f7b6403b7708cebc9eb3..0ba3ee02d057dd280c9b3400ef70b46ed472aec3 100644 (file)
 #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
index 5e56c38ffff8585d1026b84c67929c51065a9483..d79c4db1aeee033df3ae7c5e6f58666a3a998a3d 100644 (file)
@@ -1,3 +1,7 @@
+2020-04-09  Matthew Malcomson  <matthew.malcomson@arm.com>
+
+       * g++.target/arm/cde_mve.C: New test.
+
 2020-04-09  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/arm/cmse/cmse-15.c: Use check-function-bodies.
diff --git a/gcc/testsuite/g++.target/arm/cde_mve.C b/gcc/testsuite/g++.target/arm/cde_mve.C
new file mode 100644 (file)
index 0000000..897cbd2
--- /dev/null
@@ -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;
+}