[Git][ghc/ghc][master] 12 commits: rts/ipe: Fix unused lock warning

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jun 20 20:57:06 UTC 2023



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


Commits:
b65e78dd by Ben Gamari at 2023-06-20T16:56:43-04:00
rts/ipe: Fix unused lock warning

- - - - -
6086effd by Ben Gamari at 2023-06-20T16:56:44-04:00
rts/ProfilerReportJson: Fix memory leak

- - - - -
1e48c434 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Various warnings fixes

- - - - -
471486b9 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Fix printf format mismatch

- - - - -
80603fb3 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Fix incorrect #include <sys/poll.h>

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

- - - - -
ff18e6fd by Ben Gamari at 2023-06-20T16:56:44-04:00
nonmoving: Fix unused definition warrnings

- - - - -
6e7fe8ee by Ben Gamari at 2023-06-20T16:56:44-04:00
Disable futimens on Darwin.

See #22938

- - - - -
b7706508 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Fix incorrect CPP guard

- - - - -
94f00e9b by Ben Gamari at 2023-06-20T16:56:44-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.

- - - - -
5fb54bf8 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Disable `#pragma GCC`s on clang compilers

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

- - - - -
cf87f380 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Fix capitalization of prototype

- - - - -
17f250d7 by Ben Gamari at 2023-06-20T16:56:44-04:00
rts: Fix incorrect format specifier

- - - - -


14 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


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);
 }



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1464a2a8de082f66ae250d63ab9d94dbe2ef8620...17f250d70ebe90a55fb9385460e5c5500bdb42a6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1464a2a8de082f66ae250d63ab9d94dbe2ef8620...17f250d70ebe90a55fb9385460e5c5500bdb42a6
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/b373795f/attachment-0001.html>


More information about the ghc-commits mailing list