[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 13 commits: rts/ipe: Fix unused lock warning

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jun 20 15:05:55 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
70bffd8e by Ben Gamari at 2023-06-20T11:05:41-04:00
rts/ipe: Fix unused lock warning

- - - - -
6594b76b by Ben Gamari at 2023-06-20T11:05:41-04:00
rts/ProfilerReportJson: Fix memory leak

- - - - -
31060eea by Ben Gamari at 2023-06-20T11:05:41-04:00
rts: Various warnings fixes

- - - - -
cc5d72bc by Ben Gamari at 2023-06-20T11:05:41-04:00
rts: Fix printf format mismatch

- - - - -
b7db3dcb by Ben Gamari at 2023-06-20T11:05:41-04:00
rts: Fix incorrect #include <sys/poll.h>

According to Alpine's warnings and poll(2), <poll.h> should be
preferred.

- - - - -
026e430b by Ben Gamari at 2023-06-20T11:05:41-04:00
nonmoving: Fix unused definition warrnings

- - - - -
014a7279 by Ben Gamari at 2023-06-20T11:05:41-04:00
Disable futimens on Darwin.

See #22938

- - - - -
f63996d8 by Ben Gamari at 2023-06-20T11:05:41-04:00
rts: Fix incorrect CPP guard

- - - - -
c2eaba6a by Ben Gamari at 2023-06-20T11:05:41-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.

- - - - -
ec1fe0e6 by Ben Gamari at 2023-06-20T11:05:42-04:00
rts: Disable `#pragma GCC`s on clang compilers

Otherwise the build fails due to warnings. See #23530.

- - - - -
a5c6ac72 by Ben Gamari at 2023-06-20T11:05:42-04:00
rts: Fix capitalization of prototype

- - - - -
47d0eac3 by Ben Gamari at 2023-06-20T11:05:42-04:00
rts: Fix incorrect format specifier

- - - - -
2f514203 by Josh Meredith at 2023-06-20T11:05:47-04:00
JS: remove js_broken(22576) in favour of the pre-existing wordsize(32) condition (#22576)

- - - - -


15 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- hadrian/src/Flavour.hs
- rts/Hash.c
- rts/IPE.c
- rts/ProfilerReportJson.c
- rts/Threads.c
- rts/adjustor/LibffiAdjustor.c
- rts/eventlog/EventLog.c
- rts/include/rts/storage/ClosureMacros.h
- rts/posix/Ticker.c
- rts/posix/ticker/Pthread.c
- rts/posix/ticker/TimerFd.c
- rts/sm/NonMovingMark.c
- testsuite/tests/perf/compiler/all.T


Changes:

=====================================
.gitlab/gen_ci.hs
=====================================
@@ -409,6 +409,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"
     }
   },
@@ -2478,6 +2479,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"
     }
   },
@@ -3590,6 +3592,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 { extraArgs = extraArgs 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/Hash.c
=====================================
@@ -18,11 +18,13 @@
    since we compile these things these days with cabal we can no longer
    specify optimization per file.  So we have to resort to pragmas.  */
 #if defined(__GNUC__) || defined(__GNUG__)
+#if !defined(__clang__)
 #if !defined(DEBUG)
 #pragma GCC push_options
 #pragma GCC optimize ("O3")
 #endif
 #endif
+#endif
 
 #define XXH_NAMESPACE __rts_
 #define XXH_STATIC_LINKING_ONLY   /* access advanced declarations */
@@ -565,7 +567,9 @@ int keyCountHashTable (HashTable *table)
 
 
 #if defined(__GNUC__) || defined(__GNUG__)
+#if !defined(__clang__)
 #if !defined(DEBUG)
 #pragma GCC pop_options
 #endif
 #endif
+#endif


=====================================
rts/IPE.c
=====================================
@@ -62,7 +62,10 @@ this all IPE lists of all IpeBufferListNode are traversed to insert all IPEs.
 After the content of a IpeBufferListNode has been inserted, it's freed.
 */
 
+#if defined(THREADED_RTS)
 static Mutex ipeMapLock;
+#endif
+// Protected by ipeMapLock
 static HashTable *ipeMap = NULL;
 
 // Accessed atomically


=====================================
rts/ProfilerReportJson.c
=====================================
@@ -52,11 +52,10 @@ static void escapeString(char const* str, char **buf)
 static void
 logCostCentres(FILE *prof_file)
 {
-    char* lbl;
-    char* src_loc;
     bool needs_comma = false;
     fprintf(prof_file, "[\n");
     for (CostCentre *cc = CC_LIST; cc != NULL; cc = cc->link) {
+        char *lbl, *src_loc;
         escapeString(cc->label, &lbl);
         escapeString(cc->srcloc, &src_loc);
         fprintf(prof_file,
@@ -70,10 +69,10 @@ logCostCentres(FILE *prof_file)
                 cc->ccID, lbl, cc->module, src_loc,
                 cc->is_caf ? "true" : "false");
         needs_comma = true;
+        stgFree(lbl);
+        stgFree(src_loc);
     }
     fprintf(prof_file, "]\n");
-    stgFree(lbl);
-    stgFree(src_loc);
 }
 
 static void


=====================================
rts/Threads.c
=====================================
@@ -1013,10 +1013,10 @@ printGlobalThreads(void)
   for (uint32_t g = 0; g < RtsFlags.GcFlags.generations; g++) {
     debugBelch("\ngen %d\n", g);
     for (StgTSO *t = generations[g].threads; t != END_TSO_QUEUE; t = t->global_link) {
-      debugBelch("thread %p (id=%lu)\n", t, t->id);
+      debugBelch("thread %p (id=%lu)\n", t, (unsigned long)t->id);
     }
     for (StgTSO *t = generations[g].old_threads; t != END_TSO_QUEUE; t = t->global_link) {
-      debugBelch("thread %p (id=%lu) (old)\n", t, t->id);
+      debugBelch("thread %p (id=%lu) (old)\n", t, (unsigned long)t->id);
     }
   }
 }


=====================================
rts/adjustor/LibffiAdjustor.c
=====================================
@@ -39,7 +39,7 @@ static AdjustorWritable allocate_adjustor(AdjustorExecutable *exec_ret, ffi_cif
 {
     AdjustorWritable writ;
 
-    ffi_status r = ffi_alloc_prep_closure(&writ, cif, wptr, hptr, exec_ret);
+    ffi_status r = ffi_alloc_prep_closure((ffi_closure **) &writ, cif, wptr, hptr, exec_ret);
     if (r != FFI_OK)
         barf("ffi_alloc_prep_closure failed: %d", r);
 


=====================================
rts/eventlog/EventLog.c
=====================================
@@ -759,8 +759,10 @@ void postCapsetVecEvent (EventTypeNum tag,
         // 1 + strlen to account for the trailing \0, used as separator
         int increment = 1 + strlen(argv[i]);
         if (size + increment > EVENT_PAYLOAD_SIZE_MAX) {
-            errorBelch("Event size exceeds EVENT_PAYLOAD_SIZE_MAX, record only "
-                       "%d out of %d args", i, argc);
+            errorBelch("Event size exceeds EVENT_PAYLOAD_SIZE_MAX, record only %"
+                       FMT_Word " out of %" FMT_Word " args",
+                       (StgWord) i,
+                       (StgWord) argc);
             argc = i;
             break;
         } else {


=====================================
rts/include/rts/storage/ClosureMacros.h
=====================================
@@ -623,7 +623,7 @@ INLINE_HEADER void overwritingMutableClosureOfs (StgClosure *p, uint32_t offset)
 }
 
 // Version of 'overwritingClosure' which takes closure size as argument.
-void stg_OverwritingClosureSize (StgClosure *p, uint32_t size /* in words */);
+void stg_overwritingClosureSize (StgClosure *p, uint32_t size /* in words */);
 INLINE_HEADER void overwritingClosureSize (StgClosure *p, uint32_t size)
 {
     // This function is only called from stg_AP_STACK so we can assume it's not


=====================================
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/posix/ticker/Pthread.c
=====================================
@@ -43,7 +43,7 @@
 #include "Proftimer.h"
 #include "Schedule.h"
 #include "posix/Clock.h"
-#include <sys/poll.h>
+#include <poll.h>
 
 #include <time.h>
 #if HAVE_SYS_TIME_H


=====================================
rts/posix/ticker/TimerFd.c
=====================================
@@ -43,7 +43,7 @@
 #include "Proftimer.h"
 #include "Schedule.h"
 #include "posix/Clock.h"
-#include <sys/poll.h>
+#include <poll.h>
 
 #include <time.h>
 #if HAVE_SYS_TIME_H


=====================================
rts/sm/NonMovingMark.c
=====================================
@@ -39,7 +39,7 @@ static void trace_PAP_payload (MarkQueue *queue,
                                StgClosure *fun,
                                StgClosure **payload,
                                StgWord size);
-static bool is_nonmoving_weak(StgWeak *weak);
+static bool is_nonmoving_weak(StgWeak *weak) USED_IF_DEBUG;
 
 // How many Array# entries to add to the mark queue at once?
 #define MARK_ARRAY_CHUNK_LENGTH 128
@@ -974,7 +974,7 @@ static void nonmovingResetUpdRemSetQueue (MarkQueue *rset)
     rset->top->head = 0;
 }
 
-void nonmovingResetUpdRemSet (UpdRemSet *rset)
+static void nonmovingResetUpdRemSet (UpdRemSet *rset)
 {
     nonmovingResetUpdRemSetQueue(&rset->queue);
 }


=====================================
testsuite/tests/perf/compiler/all.T
=====================================
@@ -658,7 +658,7 @@ test('T21839c',
     ['-O'])
 
 test ('InfiniteListFusion',
-      [collect_stats('bytes allocated',2), when(wordsize(32), skip), js_broken(22576)],
+      [collect_stats('bytes allocated',2), when(wordsize(32), skip)],
       compile_and_run,
       ['-O2 -package ghc'])
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ab375d314e0c559d7fa3f739ae3bbd14dd141f22...2f514203eb5ae84cac62acbab3b0ef34b9a3e04b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ab375d314e0c559d7fa3f739ae3bbd14dd141f22...2f514203eb5ae84cac62acbab3b0ef34b9a3e04b
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/20230620/698141b0/attachment-0001.html>


More information about the ghc-commits mailing list