summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-23 19:42:02 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-27 23:56:43 -0500
commitb5c75f1d4652f7aebea27a09509707a24615dbd7 (patch)
tree5229530222e6e6a2771f9885e3bf72ae74cec100 /rts
parent55a81995b7da53afba0d630d0c1b99f8ae475cfa (diff)
downloadhaskell-b5c75f1d4652f7aebea27a09509707a24615dbd7.tar.gz
rts: Fix C++ compilation issues
Make the RTS compilable with a C++ compiler by inserting necessary casts.
Diffstat (limited to 'rts')
-rw-r--r--rts/Schedule.h2
-rw-r--r--rts/Trace.h2
-rw-r--r--rts/include/Stg.h2
-rw-r--r--rts/sm/NonMovingMark.h4
4 files changed, 7 insertions, 3 deletions
diff --git a/rts/Schedule.h b/rts/Schedule.h
index 415d2a3291..e4f17af3cf 100644
--- a/rts/Schedule.h
+++ b/rts/Schedule.h
@@ -131,7 +131,7 @@ setRecentActivity(enum RecentActivity new_value)
INLINE_HEADER enum RecentActivity
getRecentActivity(void)
{
- return RELAXED_LOAD_ALWAYS(&recent_activity);
+ return (enum RecentActivity) RELAXED_LOAD_ALWAYS(&recent_activity);
}
extern bool heap_overflow;
diff --git a/rts/Trace.h b/rts/Trace.h
index 6e08d0d2fd..6b1d797a30 100644
--- a/rts/Trace.h
+++ b/rts/Trace.h
@@ -33,7 +33,9 @@ void tracingAddCapapilities (uint32_t from, uint32_t to);
#endif /* TRACING */
typedef StgWord32 CapsetID;
+#if !defined(__cplusplus)
typedef StgWord16 CapsetType;
+#endif
enum CapsetType { CapsetTypeCustom = CAPSET_TYPE_CUSTOM,
CapsetTypeOsProcess = CAPSET_TYPE_OSPROCESS,
CapsetTypeClockdomain = CAPSET_TYPE_CLOCKDOMAIN };
diff --git a/rts/include/Stg.h b/rts/include/Stg.h
index bd15e73cda..c366fa0362 100644
--- a/rts/include/Stg.h
+++ b/rts/include/Stg.h
@@ -242,6 +242,8 @@
#define STG_PRINTF_ATTR(fmt_arg, rest) GNUC3_ATTRIBUTE(format(printf, fmt_arg, rest))
#endif
+#define STG_RESTRICT __restrict__
+
#define STG_NORETURN GNU_ATTRIBUTE(__noreturn__)
#define STG_MALLOC GNUC3_ATTRIBUTE(__malloc__)
diff --git a/rts/sm/NonMovingMark.h b/rts/sm/NonMovingMark.h
index 4b5c61cb38..04859215b1 100644
--- a/rts/sm/NonMovingMark.h
+++ b/rts/sm/NonMovingMark.h
@@ -63,7 +63,7 @@ INLINE_HEADER enum EntryType nonmovingMarkQueueEntryType(MarkQueueEnt *ent)
{
uintptr_t tag = (uintptr_t) ent->null_entry.p & TAG_MASK;
ASSERT(tag <= MARK_ARRAY);
- return tag;
+ return (enum EntryType) tag;
}
typedef struct {
@@ -155,7 +155,7 @@ void markQueueAddRoot(MarkQueue* q, StgClosure** root);
void initMarkQueue(MarkQueue *queue);
void freeMarkQueue(MarkQueue *queue);
-void nonmovingMark(struct MarkQueue_ *restrict queue);
+void nonmovingMark(struct MarkQueue_ *STG_RESTRICT queue);
bool nonmovingTidyWeaks(struct MarkQueue_ *queue);
void nonmovingTidyThreads(void);