[rtems commit] cpu.h: Fix gcc 12 warnings

Joel Sherrill joel at rtems.org
Fri Aug 19 20:46:12 UTC 2022


Module:    rtems
Branch:    master
Commit:    b092ad57e2adddb00411147c7644344c874a0ae4
Changeset: http://git.rtems.org/rtems/commit/?id=b092ad57e2adddb00411147c7644344c874a0ae4

Author:    Ryan Long <ryan.long at oarcorp.com>
Date:      Tue Aug 16 12:02:40 2022 -0500

cpu.h: Fix gcc 12 warnings

Added two pragmas to address, and changed the value of
AARCH64_EXCEPTION_MAKE_ENUM_64_BIT to INT_MAX because the old value was not
in range of an int.

Updates #4662

---

 cpukit/score/cpu/aarch64/include/rtems/score/cpu.h | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
index 47a8e97985..282977853f 100644
--- a/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/aarch64/include/rtems/score/cpu.h
@@ -43,6 +43,7 @@
 #endif
 #include <rtems/score/aarch64.h>
 #include <libcpu/vectors.h>
+#include <limits.h>
 
 /**
  * @addtogroup RTEMSScoreCPUAArch64
@@ -156,7 +157,14 @@
 extern "C" {
 #endif
 
+/*
+   This is to fix the following warning
+   ISO C does not support 'uint128_t' types
+*/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
 typedef unsigned __int128 uint128_t;
+#pragma GCC diagnostic pop
 
 typedef struct {
   uint64_t register_x19;
@@ -404,7 +412,7 @@ typedef enum {
   AARCH64_EXCEPTION_LEL32_FIQ = 14,
   AARCH64_EXCEPTION_LEL32_SERROR = 15,
   MAX_EXCEPTIONS = 16,
-  AARCH64_EXCEPTION_MAKE_ENUM_64_BIT = 0xffffffffffffffff
+  AARCH64_EXCEPTION_MAKE_ENUM_64_BIT = INT_MAX
 } AArch64_symbolic_exception_name;
 
 #define VECTOR_POINTER_OFFSET 0x78
@@ -432,7 +440,15 @@ static inline void* AArch64_set_exception_handler(
   *vector_address = handler;
 
   /* return now-previous vector pointer */
-  return (void*)current_vector_pointer;
+
+/*
+ * This was put in to fix the following warning:
+ * warning: ISO C forbids conversion of function pointer to object pointer type.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+ return (void*)current_vector_pointer;
+#pragma GCC diagnostic pop
 }
 
 typedef struct {



More information about the vc mailing list