[Git][ghc/ghc][wip/backports] 6 commits: rts: Drop field initializer on thread_basic_info_data_t

Ben Gamari gitlab at gitlab.haskell.org
Mon Sep 21 16:17:51 UTC 2020



Ben Gamari pushed to branch wip/backports at Glasgow Haskell Compiler / GHC


Commits:
4ffa7d40 by Ben Gamari at 2020-09-18T08:31:56-04:00
rts: Drop field initializer on thread_basic_info_data_t

This struct has a number of fields and we only care that the value is
initialized with zeros. This eliminates the warnings noted in #17905.

(cherry picked from commit 09b91e8b95eb16fe72aef8405896fd6caf789f61)

- - - - -
e5f6188b by Zubin Duggal at 2020-09-18T08:32:37-04:00
Stop removing definitions of record fields in GHC.Iface.Ext.Ast

- - - - -
d16223fd by Alan Zimmerman at 2020-09-18T08:38:16-04:00
Api Annotations : Adjust SrcSpans for prefix bang (!).

And prefix ~

(cherry picked from commit 8dbee2c578b1f642d45561be3f416119863e01eb)
(cherry picked from commit 701463ec9998c679b03dcc848912a7ce9da9a66a)

- - - - -
23f34f7b by Alan Zimmerman at 2020-09-18T08:38:29-04:00
ApiAnnotations: Fix parser for new GHC 9.0 features

(cherry picked from commit 0f4d29cac3826392ceb26ea219fce6e8a7505107)

- - - - -
37c65f13 by Ben Gamari at 2020-09-21T09:37:03-04:00
Bump Win32 submodule

- - - - -
83201c2a by Ben Gamari at 2020-09-21T12:12:28-04:00
ci.sh: Enforce minimum happy/alex versions

Also, always invoke cabal-install to ensure that happy/alex symlinks are
up-to-date.

(cherry picked from commit a89c2fbab9bcf7d769e9d27262ab29f93342f114)

- - - - -


8 changed files:

- .gitlab/ci.sh
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- libraries/Win32
- rts/posix/GetTime.c
- testsuite/tests/ghc-api/annotations/Makefile
- testsuite/tests/ghc-api/annotations/T10358.stdout


Changes:

=====================================
.gitlab/ci.sh
=====================================
@@ -8,6 +8,9 @@ set -e -o pipefail
 # Configuration:
 hackage_index_state="@1579718451"
 
+MIN_HAPPY_VERSION="1.19"
+MIN_ALEX_VERSION="3.2"
+
 # Colors
 BLACK="0;30"
 GRAY="1;30"
@@ -168,6 +171,7 @@ function set_toolchain_paths() {
       HAPPY="$HOME/.cabal/bin/happy"
       ALEX="$HOME/.cabal/bin/alex"
   fi
+
   export GHC
   export CABAL
   export HAPPY
@@ -286,17 +290,13 @@ function setup_toolchain() {
     *) ;;
   esac
 
-  if [ ! -e "$HAPPY" ]; then
-      info "Building happy..."
-      cabal update
-      $cabal_install happy
-  fi
+  cabal update
 
-  if [ ! -e "$ALEX" ]; then
-      info "Building alex..."
-      cabal update
-      $cabal_install alex
-  fi
+  info "Building happy..."
+  $cabal_install happy --constraint="happy>=$MIN_HAPPY_VERSION"
+
+  info "Building alex..."
+  $cabal_install alex --constraint="alex>=$MIN_ALEX_VERSION"
 }
 
 function cleanup_submodules() {


=====================================
compiler/GHC/Iface/Ext/Ast.hs
=====================================
@@ -42,7 +42,7 @@ import GHC.Driver.Types
 import GHC.Unit.Module            ( ModuleName, ml_hs_file )
 import GHC.Utils.Monad            ( concatMapM, liftIO )
 import GHC.Types.Id               ( isDataConId_maybe )
-import GHC.Types.Name             ( Name, nameSrcSpan, setNameLoc, nameUnique )
+import GHC.Types.Name             ( Name, nameSrcSpan, nameUnique )
 import GHC.Types.Name.Env         ( NameEnv, emptyNameEnv, extendNameEnv, lookupNameEnv )
 import GHC.Types.SrcLoc
 import GHC.Tc.Utils.Zonk          ( hsLitType, hsPatType )
@@ -52,7 +52,7 @@ import GHC.Core.InstEnv
 import GHC.Builtin.Types          ( mkListTy, mkSumTy )
 import GHC.Tc.Types
 import GHC.Tc.Types.Evidence
-import GHC.Types.Var              ( Id, Var, EvId, setVarName, varName, varType, varUnique )
+import GHC.Types.Var              ( Id, Var, EvId, varName, setVarName, varType, varUnique )
 import GHC.Types.Var.Env
 import GHC.Types.Unique
 import GHC.Iface.Make             ( mkIfaceExports )
@@ -1274,26 +1274,22 @@ instance ( ToHie (RFContext (Located label))
       , toHie expr
       ]
 
-removeDefSrcSpan :: Name -> Name
-removeDefSrcSpan n = setNameLoc n noSrcSpan
-
 instance ToHie (RFContext (LFieldOcc GhcRn)) where
   toHie (RFC c rhs (L nspan f)) = concatM $ case f of
     FieldOcc name _ ->
-      [ toHie $ C (RecField c rhs) (L nspan $ removeDefSrcSpan name)
+      [ toHie $ C (RecField c rhs) (L nspan name)
       ]
 
 instance ToHie (RFContext (LFieldOcc GhcTc)) where
   toHie (RFC c rhs (L nspan f)) = concatM $ case f of
     FieldOcc var _ ->
-      let var' = setVarName var (removeDefSrcSpan $ varName var)
-      in [ toHie $ C (RecField c rhs) (L nspan var')
-         ]
+      [ toHie $ C (RecField c rhs) (L nspan var)
+      ]
 
 instance ToHie (RFContext (Located (AmbiguousFieldOcc GhcRn))) where
   toHie (RFC c rhs (L nspan afo)) = concatM $ case afo of
     Unambiguous name _ ->
-      [ toHie $ C (RecField c rhs) $ L nspan $ removeDefSrcSpan name
+      [ toHie $ C (RecField c rhs) $ L nspan name
       ]
     Ambiguous _name _ ->
       [ ]
@@ -1301,13 +1297,11 @@ instance ToHie (RFContext (Located (AmbiguousFieldOcc GhcRn))) where
 instance ToHie (RFContext (Located (AmbiguousFieldOcc GhcTc))) where
   toHie (RFC c rhs (L nspan afo)) = concatM $ case afo of
     Unambiguous var _ ->
-      let var' = setVarName var (removeDefSrcSpan $ varName var)
-      in [ toHie $ C (RecField c rhs) (L nspan var')
-         ]
+      [ toHie $ C (RecField c rhs) (L nspan var)
+      ]
     Ambiguous var _ ->
-      let var' = setVarName var (removeDefSrcSpan $ varName var)
-      in [ toHie $ C (RecField c rhs) (L nspan var')
-         ]
+      [ toHie $ C (RecField c rhs) (L nspan var)
+      ]
 
 instance HiePass p => ToHie (RScoped (ApplicativeArg (GhcPass p))) where
   toHie (RS sc (ApplicativeArgOne _ pat expr _)) = concatM


=====================================
compiler/GHC/Parser.y
=====================================
@@ -1961,7 +1961,7 @@ type :: { LHsType GhcPs }
 
         | btype '#->' ctype             {% hintLinear (getLoc $2) >>
                                          ams (sLL $1 $> $ HsFunTy noExtField HsLinearArrow $1 $3)
-                                             [mu AnnRarrow $2] }
+                                             [mu AnnLolly $2] }
 
 mult :: { LHsType GhcPs }
         : btype                  { $1 }
@@ -2080,10 +2080,10 @@ tv_bndrs :: { [LHsTyVarBndr Specificity GhcPs] }
 tv_bndr :: { LHsTyVarBndr Specificity GhcPs }
         : tv_bndr_no_braces             { $1 }
         | '{' tyvar '}'                 {% ams (sLL $1 $> (UserTyVar noExtField InferredSpec $2))
-                                               [mop $1, mcp $3] }
+                                               [moc $1, mcc $3] }
         | '{' tyvar '::' kind '}'       {% ams (sLL $1 $> (KindedTyVar noExtField InferredSpec $2 $4))
-                                               [mop $1,mu AnnDcolon $3
-                                               ,mcp $5] }
+                                               [moc $1,mu AnnDcolon $3
+                                               ,mcc $5] }
 
 tv_bndr_no_braces :: { LHsTyVarBndr Specificity GhcPs }
         : tyvar                         { sL1 $1 (UserTyVar noExtField SpecifiedSpec $1) }
@@ -3717,6 +3717,7 @@ isUnicode (L _ (ITcparenbar      iu)) = iu == UnicodeSyntax
 isUnicode (L _ (ITopenExpQuote _ iu)) = iu == UnicodeSyntax
 isUnicode (L _ (ITcloseQuote     iu)) = iu == UnicodeSyntax
 isUnicode (L _ (ITstar           iu)) = iu == UnicodeSyntax
+isUnicode (L _ (ITlolly          iu)) = iu == UnicodeSyntax
 isUnicode _                           = False
 
 hasE :: Located Token -> Bool


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -1231,13 +1231,14 @@ makeFunBind fn ms
 checkPatBind :: LPat GhcPs
              -> Located (a,GRHSs GhcPs (LHsExpr GhcPs))
              -> P ([AddAnn],HsBind GhcPs)
-checkPatBind lhs (L match_span (_,grhss))
+checkPatBind lhs (L rhs_span (_,grhss))
     | BangPat _ p <- unLoc lhs
     , VarPat _ v <- unLoc p
     = return ([], makeFunBind v [L match_span (m v)])
   where
+    match_span = combineSrcSpans (getLoc lhs) rhs_span
     m v = Match { m_ext = noExtField
-                , m_ctxt = FunRhs { mc_fun    = L (getLoc lhs) (unLoc v)
+                , m_ctxt = FunRhs { mc_fun    = v
                                   , mc_fixity = Prefix
                                   , mc_strictness = SrcStrict }
                 , m_pats = []


=====================================
libraries/Win32
=====================================
@@ -1 +1 @@
-Subproject commit ca5fbc12851b98a52f96a43ea19c54c9ecf0f9e3
+Subproject commit d68374423fa3d3edd6b776e412e4093cc69b5f64


=====================================
rts/posix/GetTime.c
=====================================
@@ -71,7 +71,7 @@ Time getCurrentThreadCPUTime(void)
     // support clock_getcpuclockid. Hence we prefer to use the Darwin-specific
     // path on Darwin, even if clock_gettime is available.
 #if defined(darwin_HOST_OS)
-    thread_basic_info_data_t info = { 0 };
+    thread_basic_info_data_t info = { };
     mach_msg_type_number_t info_count = THREAD_BASIC_INFO_COUNT;
     kern_return_t kern_err = thread_info(mach_thread_self(), THREAD_BASIC_INFO,
                                          (thread_info_t) &info, &info_count);


=====================================
testsuite/tests/ghc-api/annotations/Makefile
=====================================
@@ -39,7 +39,8 @@ listcomps:
 
 .PHONY: T10358
 T10358:
-	$(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test10358.hs
+	# Ignore result code, we have an unattached (superfluous) AnnBang
+	- $(CHECK_API_ANNOTATIONS) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" Test10358.hs
 
 .PHONY: T10396
 T10396:


=====================================
testsuite/tests/ghc-api/annotations/T10358.stdout
=====================================
@@ -1,5 +1,5 @@
 ---Unattached Annotation Problems (should be empty list)---
-[]
+[(AnnBang, Test10358.hs:5:19)]
 ---Ann before enclosing span problem (should be empty list)---
 [
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7080f074481ed27cc58399754a0eb9360945f0a3...83201c2af667436cdaab31618f106c36fb277225

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7080f074481ed27cc58399754a0eb9360945f0a3...83201c2af667436cdaab31618f106c36fb277225
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/20200921/556b7242/attachment-0001.html>


More information about the ghc-commits mailing list