Commit ab90e5fa authored by Ian Lynagh's avatar Ian Lynagh

Generate the bit in the user guide where we say what -fglasgow-exts does

Stops the docs going out of sync with the code.
parent c07d7849
......@@ -17,6 +17,7 @@ module DynFlags (
DOpt(..),
DynFlag(..),
ExtensionFlag(..),
glasgowExtsFlags,
flattenExtensionFlags,
ensureFlattenedExtensionFlags,
lopt_set_flattened,
......
......@@ -10,9 +10,17 @@
#
# -----------------------------------------------------------------------------
docs/users_guide_DOCBOOK_SOURCES := \
$(wildcard docs/users_guide/*.xml) \
$(basename $(wildcard docs/users_guide/*.xml.in))
docs/users_guide_GENERATED_DOCBOOK_SOURCES := \
docs/users_guide/what_glasgow_exts_does.gen.xml
# sort remove duplicates
docs/users_guide_DOCBOOK_SOURCES := \
$(sort $(docs/users_guide_GENERATED_DOCBOOK_SOURCES) \
$(wildcard docs/users_guide/*.xml) \
$(basename $(wildcard docs/users_guide/*.xml.in)))
$(docs/users_guide_GENERATED_DOCBOOK_SOURCES): %.gen.xml: inplace/bin/mkUserGuidePart
inplace/bin/mkUserGuidePart $@
$(eval $(call docbook,docs/users_guide,users_guide))
......
......@@ -56,38 +56,7 @@ documentation</ulink> describes all the libraries that come with GHC.
<para>The flag <option>-fglasgow-exts</option>
<indexterm><primary><option>-fglasgow-exts</option></primary></indexterm>
is equivalent to enabling the following extensions:
<option>-XPrintExplicitForalls</option>,
<option>-XForeignFunctionInterface</option>,
<option>-XUnliftedFFITypes</option>,
<option>-XGADTs</option>,
<option>-XImplicitParams</option>,
<option>-XScopedTypeVariables</option>,
<option>-XUnboxedTuples</option>,
<option>-XTypeSynonymInstances</option>,
<option>-XStandaloneDeriving</option>,
<option>-XDeriveDataTypeable</option>,
<option>-XFlexibleContexts</option>,
<option>-XFlexibleInstances</option>,
<option>-XConstrainedClassMethods</option>,
<option>-XMultiParamTypeClasses</option>,
<option>-XFunctionalDependencies</option>,
<option>-XMagicHash</option>,
<option>-XPolymorphicComponents</option>,
<option>-XExistentialQuantification</option>,
<option>-XUnicodeSyntax</option>,
<option>-XPostfixOperators</option>,
<option>-XPatternGuards</option>,
<option>-XLiberalTypeSynonyms</option>,
<option>-XExplicitForAll</option>,
<option>-XRankNTypes</option>,
<option>-XImpredicativeTypes</option>,
<option>-XTypeOperators</option>,
<option>-XDoRec</option>,
<option>-XParallelListComp</option>,
<option>-XEmptyDataDecls</option>,
<option>-XKindSignatures</option>,
<option>-XGeneralizedNewtypeDeriving</option>,
<option>-XTypeFamilies</option>.
&what_glasgow_exts_does;
Enabling these options is the <emphasis>only</emphasis>
effect of <option>-fglasgow-exts</option>.
We are trying to move away from this portmanteau flag,
......
......@@ -21,6 +21,7 @@
<!ENTITY win32-dll SYSTEM "win32-dlls.xml">
<!ENTITY ffi-chap SYSTEM "ffi-chap.xml">
<!ENTITY shared_libs SYSTEM "shared_libs.xml">
<!ENTITY what_glasgow_exts_does SYSTEM "what_glasgow_exts_does.gen.xml">
<!ENTITY libraryBaseLocation "../libraries/base-@LIBRARY_base_VERSION@">
<!ENTITY libraryCabalLocation "../libraries/Cabal-@LIBRARY_Cabal_VERSION@">
<!ENTITY libraryGhcPrimLocation "../libraries/ghc-prim-@LIBRARY_ghc_prim_VERSION@">
......@@ -574,6 +574,11 @@ BUILD_DIRS += \
$(GHC_TOUCHY_DIR)
endif
ifneq "$(BINDIST)" "YES"
BUILD_DIRS += \
utils/mkUserGuidePart
endif
BUILD_DIRS += utils/count_lines
BUILD_DIRS += utils/compare_sizes
......@@ -608,6 +613,7 @@ utils/ghctags_dist_DISABLE = YES
utils/hpc_dist_DISABLE = YES
utils/hsc2hs_dist-install_DISABLE = YES
utils/ghc-pkg_dist-install_DISABLE = YES
utils/mkUserGuidePart_dist_DISABLE = YES
utils/compare_sizes_dist_DISABLE = YES
compiler_stage2_DISABLE = YES
compiler_stage3_DISABLE = YES
......
module Main (main) where
import DynFlags
import Data.List
import System.Environment
main :: IO ()
main = do args <- getArgs
case args of
[] -> error "Need to give filename to generate as an argument"
[f] ->
case f of
"docs/users_guide/what_glasgow_exts_does.gen.xml" ->
writeFile f whatGlasgowExtsDoes
_ ->
error ("Don't know what to do for " ++ show f)
_ -> error "Bad args"
whatGlasgowExtsDoes :: String
whatGlasgowExtsDoes = case maybeInitLast glasgowExtsFlags of
Just (xs, x) ->
let xs' = map mkInitLine xs
x' = mkLastLine x
in unlines (xs' ++ [x'])
Nothing ->
error "glasgowExtsFlags is empty?"
where mkInitLine = mkLine ','
mkLastLine = mkLine '.'
mkLine c f = case stripPrefix "Opt_" (show f) of
Just ext -> "<option>-X" ++ ext ++ "</option>" ++ [c]
Nothing -> error ("Can't parse extension: " ++ show f)
maybeInitLast :: [a] -> Maybe ([a], a)
maybeInitLast xs = case reverse xs of
(y : ys) -> Just (reverse ys, y)
_ -> Nothing
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------
dir = utils/mkUserGuidePart
TOP = ../..
include $(TOP)/mk/sub-makefile.mk
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
# http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------
utils/mkUserGuidePart_dist_MODULES = Main
utils/mkUserGuidePart_dist_PROG = mkUserGuidePart
utils/mkUserGuidePart_HC_OPTS = -package ghc
utils/mkUserGuidePart/dist/build/Main.o: $(compiler_stage2_v_LIB)
$(eval $(call build-prog,utils/mkUserGuidePart,dist,1))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment