[Git][ghc/ghc][wip/rts-fixes] 3 commits: rts: Fix C++ compilation issues
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Thu Jan 26 21:23:56 UTC 2023
Ben Gamari pushed to branch wip/rts-fixes at Glasgow Haskell Compiler / GHC
Commits:
7e686644 by Ben Gamari at 2023-01-26T16:23:48-05:00
rts: Fix C++ compilation issues
Make the RTS compilable with a C++ compiler by inserting necessary
casts.
- - - - -
f3a090e5 by Ben Gamari at 2023-01-26T16:23:48-05:00
rts: Fix typo
"tracingAddCapabilities" was mis-named
- - - - -
d72a0ae1 by Ben Gamari at 2023-01-26T16:23:48-05:00
rts: Drop long-dead fallback definitions for INFINITY & NAN
These are no longer necessary since we now compile as C99.
- - - - -
6 changed files:
- rts/Schedule.c
- rts/Schedule.h
- rts/Trace.c
- rts/Trace.h
- rts/include/Stg.h
- rts/sm/NonMovingMark.h
Changes:
=====================================
rts/Schedule.c
=====================================
@@ -2322,7 +2322,7 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS)
// must be done before calling moreCapabilities(), because that
// will emit events about creating the new capabilities and adding
// them to existing capsets.
- tracingAddCapapilities(n_capabilities, new_n_capabilities);
+ tracingAddCapabilities(n_capabilities, new_n_capabilities);
#endif
// Resize the capabilities array
=====================================
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;
=====================================
rts/Trace.c
=====================================
@@ -143,7 +143,7 @@ void flushTrace ()
}
}
-void tracingAddCapapilities (uint32_t from, uint32_t to)
+void tracingAddCapabilities (uint32_t from, uint32_t to)
{
if (eventlog_enabled) {
moreCapEventBufs(from,to);
=====================================
rts/Trace.h
=====================================
@@ -28,12 +28,14 @@ void initTracing (void);
void endTracing (void);
void freeTracing (void);
void resetTracing (void);
-void tracingAddCapapilities (uint32_t from, uint32_t to);
+void tracingAddCapabilities (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 };
=====================================
rts/include/Stg.h
=====================================
@@ -82,27 +82,6 @@
that depend on config info, such as __USE_FILE_OFFSET64 */
#include <math.h>
-// On Solaris, we don't get the INFINITY and NAN constants unless we
-// #define _STDC_C99, and we can't do that unless we also use -std=c99,
-// because _STDC_C99 causes the headers to use C99 syntax (e.g. restrict).
-// We aren't ready for -std=c99 yet, so define INFINITY/NAN by hand using
-// the gcc builtins.
-#if !defined(INFINITY)
-#if defined(__GNUC__)
-#define INFINITY __builtin_inf()
-#else
-#error No definition for INFINITY
-#endif
-#endif
-
-#if !defined(NAN)
-#if defined(__GNUC__)
-#define NAN __builtin_nan("")
-#else
-#error No definition for NAN
-#endif
-#endif
-
/* -----------------------------------------------------------------------------
Useful definitions
-------------------------------------------------------------------------- */
@@ -242,6 +221,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__)
=====================================
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);
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/db4c2b05c275b5f254db23596bb62612154d9ad5...d72a0ae1103dfdc3e5532aaa388c8b9595554207
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/db4c2b05c275b5f254db23596bb62612154d9ad5...d72a0ae1103dfdc3e5532aaa388c8b9595554207
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230126/20dc022f/attachment-0001.html>
More information about the ghc-commits
mailing list