[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 18:26:45 UTC 2023



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


Commits:
ad2b4264 by Ben Gamari at 2023-06-20T14:26:31-04:00
rts/ipe: Fix unused lock warning

- - - - -
a5cf9ba3 by Ben Gamari at 2023-06-20T14:26:31-04:00
rts/ProfilerReportJson: Fix memory leak

- - - - -
84820bdc by Ben Gamari at 2023-06-20T14:26:31-04:00
rts: Various warnings fixes

- - - - -
76c76324 by Ben Gamari at 2023-06-20T14:26:31-04:00
rts: Fix printf format mismatch

- - - - -
0153db5d by Ben Gamari at 2023-06-20T14:26:31-04:00
rts: Fix incorrect #include <sys/poll.h>

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

- - - - -
9161f08c by Ben Gamari at 2023-06-20T14:26:31-04:00
nonmoving: Fix unused definition warrnings

- - - - -
d0398448 by Ben Gamari at 2023-06-20T14:26:31-04:00
Disable futimens on Darwin.

See #22938

- - - - -
d7541bb5 by Ben Gamari at 2023-06-20T14:26:31-04:00
rts: Fix incorrect CPP guard

- - - - -
30611243 by Ben Gamari at 2023-06-20T14:26:31-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.

- - - - -
8352af17 by Ben Gamari at 2023-06-20T14:26:31-04:00
rts: Disable `#pragma GCC`s on clang compilers

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

- - - - -
1860d0ce by Ben Gamari at 2023-06-20T14:26:32-04:00
rts: Fix capitalization of prototype

- - - - -
0330240a by Ben Gamari at 2023-06-20T14:26:32-04:00
rts: Fix incorrect format specifier

- - - - -
3ec80b61 by Josh Meredith at 2023-06-20T14:26:37-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/2f514203eb5ae84cac62acbab3b0ef34b9a3e04b...3ec80b613b38917b2152bd760b907a658099dc96

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2f514203eb5ae84cac62acbab3b0ef34b9a3e04b...3ec80b613b38917b2152bd760b907a658099dc96
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/c93798c8/attachment-0001.html>


More information about the ghc-commits mailing list