[commit: ghc] ghc-7.8: ghc: Do not add a space in '-U __PIC__' (930a2ef)

git at git.haskell.org git at git.haskell.org
Tue Apr 22 06:08:58 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/930a2ef1066bad478fe36e4963c35b89b30e58e7/ghc

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

commit 930a2ef1066bad478fe36e4963c35b89b30e58e7
Author: Austin Seipp <austin at well-typed.com>
Date:   Mon Apr 21 07:22:50 2014 -0500

    ghc: Do not add a space in '-U __PIC__'
    
    GHC previously introduced a space here. However, this can in some cases
    be interpreted as "-U __PIC__" - note that in shell, the -U would still
    be recognized with an argument, but the argument would be " __PIC__",
    with a space in front, as opposed to the single string '__PIC__'.
    
    In practice most tools seem to handle this OK. But the Coverity Scan
    analysis tool does not: it errors on the fact that ' __PIC__' is an
    invalid CPP name to undefine.
    
    With this, it seems the Coverity analysis tool can easily analyze the
    entire GHC build.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>
    (cherry picked from commit 574ef4293b867609f2d28d85747e01f3ac0d052d)


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

930a2ef1066bad478fe36e4963c35b89b30e58e7
 compiler/main/DynFlags.hs |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 053026b..e744952 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -3523,10 +3523,10 @@ picCCOpts dflags
           --     Don't generate "common" symbols - these are unwanted
           --     in dynamic libraries.
 
-       | gopt Opt_PIC dflags -> ["-fno-common", "-U __PIC__", "-D__PIC__"]
+       | gopt Opt_PIC dflags -> ["-fno-common", "-U__PIC__", "-D__PIC__"]
        | otherwise           -> ["-mdynamic-no-pic"]
       OSMinGW32 -- no -fPIC for Windows
-       | gopt Opt_PIC dflags -> ["-U __PIC__", "-D__PIC__"]
+       | gopt Opt_PIC dflags -> ["-U__PIC__", "-D__PIC__"]
        | otherwise           -> []
       _
       -- we need -fPIC for C files when we are compiling with -dynamic,
@@ -3535,12 +3535,12 @@ picCCOpts dflags
       -- objects, but can't without -fPIC.  See
       -- http://ghc.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode
        | gopt Opt_PIC dflags || not (gopt Opt_Static dflags) ->
-          ["-fPIC", "-U __PIC__", "-D__PIC__"]
+          ["-fPIC", "-U__PIC__", "-D__PIC__"]
        | otherwise                             -> []
 
 picPOpts :: DynFlags -> [String]
 picPOpts dflags
- | gopt Opt_PIC dflags = ["-U __PIC__", "-D__PIC__"]
+ | gopt Opt_PIC dflags = ["-U__PIC__", "-D__PIC__"]
  | otherwise           = []
 
 -- -----------------------------------------------------------------------------



More information about the ghc-commits mailing list