[commit: ghc] master: Fix bad '... \\' escape in ghcversion.h generation (1289048)

git at git.haskell.org git at git.haskell.org
Mon Jan 19 11:21:44 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1289048eaf31915b9335c6f7e0b7b64625ab0ed5/ghc

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

commit 1289048eaf31915b9335c6f7e0b7b64625ab0ed5
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Mon Jan 19 12:18:02 2015 +0100

    Fix bad '... \\' escape in ghcversion.h generation
    
    Today I learned about the peculiarities of escaping within
    single-quotes:
    
    Turns out,
    
      echo 'foo \\'
    
    emits
    
      foo \\
    
    rather than escaping the '\'. Curiously, if you need to escape a '
    within single-quotes, here's how to do it
    
      echo 'foo '\'' bar'
    
    which will emit
    
      foo ' bar
    
    This fixes #10002


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

1289048eaf31915b9335c6f7e0b7b64625ab0ed5
 includes/ghc.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/includes/ghc.mk b/includes/ghc.mk
index c7cec6c..7a255db 100644
--- a/includes/ghc.mk
+++ b/includes/ghc.mk
@@ -71,12 +71,12 @@ $(includes_H_VERSION) : mk/project.mk | $$(dir $$@)/.
 	  echo "#define __GLASGOW_HASKELL_PATCHLEVEL2__ $(ProjectPatchLevel2)" >> $@; \
 	fi
 	@echo >> $@
-	@echo '#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) (\\'     >> $@
-	@echo '   ((ma)*100+(mi)) <  __GLASGOW_HASKELL__ || \\'            >> $@
-	@echo '   ((ma)*100+(mi)) == __GLASGOW_HASKELL__    \\'            >> $@
-	@echo '          && (pl1) <  __GLASGOW_HASKELL_PATCHLEVEL1__ || \\'>> $@
-	@echo '   ((ma)*100+(mi)) == __GLASGOW_HASKELL__    \\'            >> $@
-	@echo '          && (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \\'   >> $@
+	@echo '#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) (\'      >> $@
+	@echo '   ((ma)*100+(mi)) <  __GLASGOW_HASKELL__ || \'             >> $@
+	@echo '   ((ma)*100+(mi)) == __GLASGOW_HASKELL__    \'             >> $@
+	@echo '          && (pl1) <  __GLASGOW_HASKELL_PATCHLEVEL1__ || \' >> $@
+	@echo '   ((ma)*100+(mi)) == __GLASGOW_HASKELL__    \'             >> $@
+	@echo '          && (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \'    >> $@
 	@echo '          && (pl2) <= __GLASGOW_HASKELL_PATCHLEVEL2__ )'    >> $@
 	@echo >> $@
 	@echo "#endif /* __GHCVERSION_H__ */"          >> $@



More information about the ghc-commits mailing list