[Git][ghc/ghc][master] 3 commits: rts: Don't rely on initializers for sigaction_t

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jul 5 02:08:25 UTC 2023



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


Commits:
46c9bcd6 by Ben Gamari at 2023-07-04T22:07:58-04:00
rts: Don't rely on initializers for sigaction_t

As noted in #23577, CentOS's ancient toolchain throws spurious
missing-field-initializer warnings.

- - - - -
ec55035f by Ben Gamari at 2023-07-04T22:07:58-04:00
hadrian: Don't treat -Winline warnings as fatal

Such warnings are highly dependent upon the toolchain, platform, and
build configuration. It's simply too fragile to rely on these.

- - - - -
3a09b789 by Ben Gamari at 2023-07-04T22:07:58-04:00
hadrian: Only pass -Wno-nonportable-include-path on Darwin

This flag, which was introduced due to #17798, is only understood by
Clang and consequently throws warnings on platforms using gcc. Sadly,
there is no good way to treat such warnings as non-fatal with `-Werror`
so for now we simply make this flag specific to platforms known to use
Clang and case-insensitive filesystems (Darwin and Windows).

See #23577.

- - - - -


3 changed files:

- hadrian/src/Flavour.hs
- hadrian/src/Settings/Warnings.hs
- rts/posix/Signals.c


Changes:

=====================================
hadrian/src/Flavour.hs
=====================================
@@ -142,6 +142,8 @@ werror =
           [ arg "-optc-Werror"
             -- clang complains about #pragma GCC pragmas
           , arg "-optc-Wno-error=unknown-pragmas"
+            -- rejected inlinings are highly dependent upon toolchain and way
+          , arg "-optc-Wno-error=inline"
           ]
       -- N.B. We currently don't build the boot libraries' C sources with -Werror
       -- as this tends to be a portability nightmare.


=====================================
hadrian/src/Settings/Warnings.hs
=====================================
@@ -2,6 +2,7 @@ module Settings.Warnings (defaultGhcWarningsArgs, ghcWarningsArgs) where
 
 import Expression
 import Oracles.Flag
+import Oracles.Setting (isOsxTarget, isWinTarget)
 import Packages
 
 -- See @mk/warnings.mk@ for warning-related arguments in the Make build system.
@@ -12,7 +13,11 @@ defaultGhcWarningsArgs = mconcat
     [ notStage0 ? arg "-Wnoncanonical-monad-instances"
     , notM (flag CcLlvmBackend) ? arg "-optc-Wno-error=inline"
     , flag CcLlvmBackend ? arg "-optc-Wno-unknown-pragmas"
-    , arg "-optP-Wno-nonportable-include-path" -- #17798
+      -- Cabal can seemingly produce filepaths with incorrect case on filesystems
+      -- with case-insensitive names. Ignore such issues for now as they seem benign.
+      -- See #17798.
+    , isOsxTarget ? arg "-optP-Wno-nonportable-include-path"
+    , isWinTarget ? arg "-optP-Wno-nonportable-include-path"
     ]
 
 -- | Package-specific warnings-related arguments, mostly suppressing various warnings.


=====================================
rts/posix/Signals.c
=====================================
@@ -368,9 +368,11 @@ int
 stg_sig_install(int sig, int spi, void *mask)
 {
     sigset_t signals, osignals;
-    struct sigaction action;
     StgInt previous_spi;
 
+    struct sigaction action;
+    memset(&action, 0, sizeof(struct sigaction));
+
     ACQUIRE_LOCK(&sig_mutex);
 
     // Block the signal until we figure out what to do
@@ -619,6 +621,7 @@ static void
 set_sigtstp_action (bool handle)
 {
     struct sigaction sa;
+    memset(&sa, 0, sizeof(struct sigaction));
     if (handle) {
         sa.sa_handler = sigtstp_handler;
     } else {
@@ -635,7 +638,8 @@ set_sigtstp_action (bool handle)
 void
 install_vtalrm_handler(int sig, TickProc handle_tick)
 {
-    struct sigaction action = {};
+    struct sigaction action;
+    memset(&action, 0, sizeof(struct sigaction));
 
     action.sa_handler = handle_tick;
 
@@ -677,8 +681,11 @@ install_vtalrm_handler(int sig, TickProc handle_tick)
 void
 initDefaultHandlers(void)
 {
-    struct sigaction action = {};
-    struct sigaction oact = {};
+    // N.B. We can't use initializers here as CentOS's ancient toolchain throws
+    // spurious warnings. See #23577.
+    struct sigaction action, oact;
+    memset(&oact, 0, sizeof(struct sigaction));
+    memset(&action, 0, sizeof(struct sigaction));
 
     // install the SIGINT handler
     action.sa_handler = shutdown_handler;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2be99b7e81e2ae5ef81fef21b0a55cfe77f917a3...3a09b789102dc0ea20a9af0912bc817ac5cb8c59

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2be99b7e81e2ae5ef81fef21b0a55cfe77f917a3...3a09b789102dc0ea20a9af0912bc817ac5cb8c59
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/20230704/946a4da6/attachment-0001.html>


More information about the ghc-commits mailing list