[Git][ghc/ghc][master] RTS: fix warnings with doing*Profiling (#24918)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jun 5 10:34:27 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
5132754b by Sylvain Henry at 2024-06-05T06:33:57-04:00
RTS: fix warnings with doing*Profiling (#24918)

- - - - -


2 changed files:

- rts/RtsFlags.h
- rts/include/rts/storage/ClosureMacros.h


Changes:

=====================================
rts/RtsFlags.h
=====================================
@@ -23,7 +23,12 @@ char** getUTF8Args(int* argc);
 void initRtsFlagsDefaults (void);
 void setupRtsFlags        (int *argc, char *argv[], RtsConfig rtsConfig);
 void freeRtsArgs          (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/5132754b80d468e0c24e39b63eea525dc1ee3a5b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5132754b80d468e0c24e39b63eea525dc1ee3a5b
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/20240605/a8bb8003/attachment-0001.html>


More information about the ghc-commits mailing list