Andreas Klebinger pushed to branch wip/andreask/9.10.4-batch1 at Glasgow Haskell Compiler / GHC Commits: cb91b665 by Sylvain Henry at 2026-10-30T15:08:23+01:00 RTS: fix warnings with doing*Profiling (#24918) (cherry picked from commit 5132754b80d468e0c24e39b63eea525dc1ee3a5b) - - - - - 2 changed files: - rts/RtsFlags.h - rts/include/rts/storage/ClosureMacros.h Changes: ===================================== rts/RtsFlags.h ===================================== @@ -24,7 +24,12 @@ void initRtsFlagsDefaults (void); void setupRtsFlags (int *argc, char *argv[], RtsConfig rtsConfig); void freeRtsArgs (void); bool is_io_mng_native_p (void); -#if defined(PROFILING) + +/* These prototypes may also be defined by ClosureMacros.h. We don't want to + * define them twice (#24918). + */ +#if defined(PROFILING) && !defined(RTS_FLAGS_DOING_PROFILING) +#define RTS_FLAGS_DOING_PROFILING 1 bool doingLDVProfiling (void); bool doingRetainerProfiling(void); bool doingErasProfiling(void); ===================================== rts/include/rts/storage/ClosureMacros.h ===================================== @@ -152,10 +152,16 @@ EXTERN_INLINE StgHalfWord GET_TAG(const StgClosure *con) be duplicated here, otherwise there will be some -Wimplicit-function-declaration compilation errors. Especially when GHC compiles out-of-tree cbits that rely on SET_HDR in RTS API. + + However when RtsFlags.h is imported, we don't want to redefine them to avoid + spurious warnings (#24918). */ +#if !defined(RTS_FLAGS_DOING_PROFILING) +#define RTS_FLAGS_DOING_PROFILING 1 bool doingLDVProfiling(void); bool doingRetainerProfiling(void); bool doingErasProfiling(void); +#endif /* The following macro works for both retainer profiling and LDV profiling. For View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cb91b665f91575a71676e39472389fa3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cb91b665f91575a71676e39472389fa3... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help