[Git][ghc/ghc][wip/rts-warnings] 4 commits: nonmoving: Fix unused definition warrnings

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Fri Mar 24 13:56:35 UTC 2023



Ben Gamari pushed to branch wip/rts-warnings at Glasgow Haskell Compiler / GHC


Commits:
5d68cd30 by Ben Gamari at 2023-03-24T09:56:27-04:00
nonmoving: Fix unused definition warrnings

- - - - -
8eb02189 by Ben Gamari at 2023-03-24T09:56:27-04:00
Disable futimens on Darwin.

See #22938

- - - - -
1a40ca00 by Ben Gamari at 2023-03-24T09:56:27-04:00
rts: Fix incorrect CPP guard

- - - - -
318ea2e4 by Ben Gamari at 2023-03-24T09:56:27-04:00
hadrian: Ensure that -Werror is passed when compiling the RTS.

Previously the `+werror` transformer would only pass `-Werror` to GHC,
which does not ensure that the same is passed to the C compiler when
building the RTS. Arguably this is itself a bug but for now we will just
work around this by passing `-optc-Werror` to GHC.

I tried to enable `-Werror` in all C compilations but the boot libraries
are something of a portability nightmare.

- - - - -


5 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- hadrian/src/Flavour.hs
- rts/posix/Ticker.c
- rts/sm/NonMovingMark.c


Changes:

=====================================
.gitlab/gen_ci.hs
=====================================
@@ -397,6 +397,8 @@ opsysVariables Amd64 (Darwin {}) =
           , "ac_cv_func_clock_gettime" =: "no"
           -- # Only newer OS Xs support utimensat. See #17895
           , "ac_cv_func_utimensat" =: "no"
+          -- # Only newer OS Xs support futimens. See #22938
+          , "ac_cv_func_futimens" =: "no"
           , "LANG" =: "en_US.UTF-8"
           , "CONFIGURE_ARGS" =: "--with-intree-gmp --with-system-libffi"
           -- Fonts can't be installed on darwin


=====================================
.gitlab/jobs.yaml
=====================================
@@ -480,6 +480,7 @@
       "TEST_ENV": "x86_64-darwin-validate",
       "XZ_OPT": "-9",
       "ac_cv_func_clock_gettime": "no",
+      "ac_cv_func_futimens": "no",
       "ac_cv_func_utimensat": "no"
     }
   },
@@ -2416,6 +2417,7 @@
       "TEST_ENV": "x86_64-darwin-release",
       "XZ_OPT": "-9",
       "ac_cv_func_clock_gettime": "no",
+      "ac_cv_func_futimens": "no",
       "ac_cv_func_utimensat": "no"
     }
   },
@@ -3458,6 +3460,7 @@
       "NIX_SYSTEM": "x86_64-darwin",
       "TEST_ENV": "x86_64-darwin-validate",
       "ac_cv_func_clock_gettime": "no",
+      "ac_cv_func_futimens": "no",
       "ac_cv_func_utimensat": "no"
     }
   },


=====================================
hadrian/src/Flavour.hs
=====================================
@@ -123,16 +123,25 @@ addArgs args' fl = fl { args = args fl <> args' }
 -- from warnings.
 werror :: Flavour -> Flavour
 werror =
-  addArgs
-    ( builder Ghc
+  addArgs $ mconcat
+    [ builder Ghc
         ? notStage0
         ? mconcat
-          [ arg "-Werror",
-            flag CrossCompiling
+          [ arg "-Werror"
+          , flag CrossCompiling
               ? package unix
               ? mconcat [arg "-Wwarn=unused-imports", arg "-Wwarn=unused-top-binds"]
           ]
-    )
+    , builder Ghc
+        ? package rts
+        ? mconcat
+          [ arg "-optc-Werror"
+            -- clang complains about #pragma GCC pragmas
+          , arg "-optc-Wno-error=unknown-pragmas"
+          ]
+      -- N.B. We currently don't build the boot libraries' C sources with -Werror
+      -- as this tends to be a portability nightmare.
+    ]
 
 -- | Build C and Haskell objects with debugging information.
 enableDebugInfo :: Flavour -> Flavour


=====================================
rts/posix/Ticker.c
=====================================
@@ -71,7 +71,7 @@
  * For older version of linux/netbsd without timerfd we fall back to the
  * pthread based implementation.
  */
-#if HAVE_SYS_TIMERFD_H
+#if defined(HAVE_SYS_TIMERFD_H)
 #define USE_TIMERFD_FOR_ITIMER
 #endif
 


=====================================
rts/sm/NonMovingMark.c
=====================================
@@ -39,7 +39,9 @@ static void trace_PAP_payload (MarkQueue *queue,
                                StgClosure *fun,
                                StgClosure **payload,
                                StgWord size);
+#if defined(DEBUG)
 static bool is_nonmoving_weak(StgWeak *weak);
+#endif
 
 // How many Array# entries to add to the mark queue at once?
 #define MARK_ARRAY_CHUNK_LENGTH 128
@@ -967,7 +969,7 @@ static void nonmovingResetUpdRemSetQueue (MarkQueue *rset)
     rset->top->head = 0;
 }
 
-void nonmovingResetUpdRemSet (UpdRemSet *rset)
+static void nonmovingResetUpdRemSet (UpdRemSet *rset)
 {
     nonmovingResetUpdRemSetQueue(&rset->queue);
 }
@@ -1966,6 +1968,7 @@ void nonmovingMarkWeakPtrList (struct MarkQueue_ *queue)
 
 // Determine whether a weak pointer object is on one of the nonmoving
 // collector's weak pointer lists. Used for sanity checking.
+#if defined(DEBUG)
 static bool is_nonmoving_weak(StgWeak *weak)
 {
     for (StgWeak *w = nonmoving_old_weak_ptr_list; w != NULL; w = w->link) {
@@ -1976,6 +1979,7 @@ static bool is_nonmoving_weak(StgWeak *weak)
     }
     return false;
 }
+#endif
 
 // Non-moving heap variant of `tidyWeakList`
 bool nonmovingTidyWeaks (struct MarkQueue_ *queue)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0b04679afb1418620cf0ff059eca6fdf16b7f7d3...318ea2e411fef8bd2674e74b0ff1454c14713fd4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0b04679afb1418620cf0ff059eca6fdf16b7f7d3...318ea2e411fef8bd2674e74b0ff1454c14713fd4
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/20230324/ae7ed2f0/attachment-0001.html>


More information about the ghc-commits mailing list