Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/57d657a8d7d149bc6a39f7f1ce3da6f5c69a6d51

>---------------------------------------------------------------

commit 57d657a8d7d149bc6a39f7f1ce3da6f5c69a6d51
Author: Simon Marlow <[email protected]>
Date:   Wed Nov 23 11:22:03 2011 +0000

    Allow the quotes to be omitted in {-# SCC "<varid>" #-}

>---------------------------------------------------------------

 compiler/parser/Parser.y.pp    |    1 +
 docs/users_guide/profiling.xml |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index de15f1c..c07714d 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -1394,6 +1394,7 @@ scc_annot :: { Located FastString }
         : '_scc_' STRING                        {% (addWarning 
Opt_WarnWarningsDeprecations (getLoc $1) (text "_scc_ is deprecated; use an SCC 
pragma instead")) >>= \_ ->
                                    ( do scc <- getSCC $2; return $ LL scc ) }
         | '{-# SCC' STRING '#-}'                {% do scc <- getSCC $2; return 
$ LL scc }
+        | '{-# SCC' VARID  '#-}'                { LL (getVARID $2) }
 
 hpc_annot :: { Located (FastString,(Int,Int),(Int,Int)) }
         : '{-# GENERATED' STRING INTEGER ':' INTEGER '-' INTEGER ':' INTEGER 
'#-}'
diff --git a/docs/users_guide/profiling.xml b/docs/users_guide/profiling.xml
index 0cf2e0e..a5a1d49 100644
--- a/docs/users_guide/profiling.xml
+++ b/docs/users_guide/profiling.xml
@@ -287,7 +287,12 @@ MAIN        MAIN                    102           0    0.0 
   0.0   100.0  100.0
       <literal>&lt;expression&gt;</literal> is any Haskell
       expression.  An <literal>SCC</literal> annotation extends as
       far to the right as possible when parsing. (SCC stands for "Set
-      Cost Centre").</para>
+      Cost Centre").  The double quotes can be omitted
+      if <literal>name</literal> is a Haskell identifier, for example:</para>
+
+<programlisting>
+     {-# SCC my_function #-} &lt;expression&gt;
+</programlisting>
 
       <para>Here is an example of a program with a couple of SCCs:</para>
 
@@ -295,10 +300,10 @@ MAIN        MAIN                    102           0    
0.0    0.0   100.0  100.0
 main :: IO ()
 main = do let xs = [1..1000000]
           let ys = [1..2000000]
-          print $ {-# SCC "last_xs" #-} last xs
-          print $ {-# SCC "last_init_xs" #-} last $ init xs
-          print $ {-# SCC "last_ys" #-} last ys
-          print $ {-# SCC "last_init_ys" #-}last $ init ys
+          print $ {-# SCC last_xs #-} last xs
+          print $ {-# SCC last_init_xs #-} last $ init xs
+          print $ {-# SCC last_ys #-} last ys
+          print $ {-# SCC last_init_ys #-}last $ init ys
 </programlisting>
 
       <para>which gives this profile when run:</para>



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to