This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][sim] Fix linkage errors in Clang.


Hello.

By differences about inline function, we can't build simulators on Clang.

I have write after approval permission. Ok to apply this?


>From 4c2093a1765fdf626335d3f3479bd076627bdb3b Mon Sep 17 00:00:00 2001
From: Masaki Muranaka <monaka@monami-software.com>
Date: Wed, 14 May 2014 11:17:12 +0900
Subject: [PATCH] Fix linkage errors in Clang

* common/cgen-mem.h: Fix linkage errors in Clang
* common/cgen-ops.h: Ditto.
* common/sim-arange.h: Ditto.
---
 sim/ChangeLog           | 6 ++++++
 sim/common/cgen-mem.h   | 4 +++-
 sim/common/cgen-ops.h   | 7 ++++++-
 sim/common/sim-arange.h | 7 ++++++-
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/sim/ChangeLog b/sim/ChangeLog
index 35d0920..94445fa 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-14  Muranaka Masaki  <monaka@monami-software.com>
+
+ * common/cgen-mem.h: Fix linkage errors in Clang
+ * common/cgen-ops.h: Ditto.
+ * common/sim-arange.h: Ditto.
+
 2014-03-12  Nick Clifton  <nickc@redhat.com>

  * MAINTAINERS: Add myself as the maintainer for the MSP430.
diff --git a/sim/common/cgen-mem.h b/sim/common/cgen-mem.h
index 1999b29..f2d93a1 100644
--- a/sim/common/cgen-mem.h
+++ b/sim/common/cgen-mem.h
@@ -20,7 +20,9 @@ along with this program.  If not, see
<http://www.gnu.org/licenses/>.  */
 #ifndef CGEN_MEM_H
 #define CGEN_MEM_H

-#ifdef MEMOPS_DEFINE_INLINE
+#if defined (__clang__)
+#define MEMOPS_INLINE static inline
+#elif defined (MEMOPS_DEFINE_INLINE)
 #define MEMOPS_INLINE
 #else
 #define MEMOPS_INLINE extern inline
diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index e1a827a..96372b3 100644
--- a/sim/common/cgen-ops.h
+++ b/sim/common/cgen-ops.h
@@ -24,7 +24,12 @@ along with this program.  If not, see
<http://www.gnu.org/licenses/>.

 #include <assert.h>

-#if defined (__GNUC__) && ! defined (SEMOPS_DEFINE_INLINE)
+#if defined (__clang__)
+#ifndef SEMOPS_DEFINE_INLINE
+#define SEMOPS_DEFINE_INLINE
+#endif
+#define SEMOPS_INLINE static inline
+#elif defined (__GNUC__) && ! defined (SEMOPS_DEFINE_INLINE)
 #define SEMOPS_DEFINE_INLINE
 #define SEMOPS_INLINE extern inline
 #else
diff --git a/sim/common/sim-arange.h b/sim/common/sim-arange.h
index 61cd4d4..b001105 100644
--- a/sim/common/sim-arange.h
+++ b/sim/common/sim-arange.h
@@ -62,7 +62,12 @@ extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,

 /* Return non-zero if ADDR is in range AR, traversing the entire tree.
    If no range is specified, that is defined to mean "everything".  */
-extern INLINE int
+#if defined (__clang__)
+static
+#else
+extern
+#endif
+INLINE int
 sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
 #define ADDR_RANGE_HIT_P(ar, addr) \
   ((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
-- 
1.8.5.2 (Apple Git-48)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]