From b5c75f1d4652f7aebea27a09509707a24615dbd7 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 23 Nov 2022 19:42:02 -0500 Subject: rts: Fix C++ compilation issues Make the RTS compilable with a C++ compiler by inserting necessary casts. --- rts/Schedule.h | 2 +- rts/Trace.h | 2 ++ rts/include/Stg.h | 2 ++ rts/sm/NonMovingMark.h | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) (limited to 'rts') 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); -- cgit v1.2.1