ghci024.py 6.07 KB
Newer Older
1
2
3
import os
import re

4
5
6
# prepare version-/platform-specific ghci024.stdout
# - listen to ghci -package ghc, to figure out package ghc contents for :show packages
# - change flag defaults according to platform (unregistered -> -fno-asm-mangling)
7
8
# - prepare separate flag lists for 6.9 or earlier 
#   (please make sure to add your flags to the right section!)
9
#
10
11
12
13
14
15
16
17
18
19
20
def prepare024( opts ):
  h = os.popen('echo :q | '+config.compiler+' --interactive -package ghc ')
  packages = h.read()
  h.close()
  packagelist = []
  for l in packages.splitlines():
    if re.match('^Loading package',l): 
      packagelist += [re.sub(r'^Loading package (\S*) .*$',r'\1',l)]
  packagelist.reverse()
  packagelist += ['rts']

21
22
23
24
25
26
  if config.unregisterised :
    mangling = 'no-'
  else:
    mangling = ''

  if version_lt(config.compiler_version, '6.9') :
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
    outtext = """\
-- ghci024.stdout is a generated file! please edit ghci024.py instead.
options currently set: none.
GHCi-specific dynamic flag settings:
  -fno-print-explicit-foralls
  -fprint-bind-result
  -fno-break-on-exception
  -fno-break-on-error
  -fno-print-evld-with-show
other dynamic, non-language, flag settings:
  -fno-warn-dodgy-imports
  -fwarn-duplicate-exports
  -fno-warn-hi-shadowing
  -fno-warn-implicit-prelude
  -fno-warn-incomplete-patterns
  -fno-warn-incomplete-record-updates
  -fwarn-missing-fields
  -fwarn-missing-methods
  -fno-warn-missing-signatures
  -fno-warn-name-shadowing
  -fwarn-overlapping-patterns
  -fno-warn-simple-patterns
  -fno-warn-type-defaults
  -fno-warn-monomorphism-restriction
  -fno-warn-unused-binds
  -fno-warn-unused-imports
  -fno-warn-unused-matches
  -fwarn-deprecations
  -fno-warn-orphans
  -fno-warn-tabs
  -fno-strictness
  -fno-full-laziness
  -fno-liberate-case
  -fno-spec-constr
  -fno-cse
  -fignore-interface-pragmas
  -fomit-interface-pragmas
  -fdo-lambda-eta-expansion
  -fno-ignore-asserts
  -fno-ignore-breakpoints
  -fno-do-eta-reduction
  -fno-case-merge
  -fno-unbox-strict-fields
  -fno-dicts-cheap
  -fno-excess-precision
  -f%(mangling)sasm-mangling
  -fno-force-recomp
  -fno-hpc-no-auto
  -fno-rewrite-rules
76
  -fprint-bind-contents
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
  -fno-vectorise
  -fno-regs-graph
  -fno-regs-iterative
  -fgen-manifest
  -fembed-manifest
active language flags:
  -XImplicitPrelude
  -XMonomorphismRestriction
  -XMonoPatBinds
-- :set -fglasgow-exts
active language flags:
  -XPatternGuards
  -XUnicodeSyntax
  -XMagicHash
  -XPolymorphicComponents
  -XExistentialQuantification
  -XKindSignatures
  -XPatternSignatures
  -XEmptyDataDecls
  -XParallelListComp
  -XForeignFunctionInterface
  -XUnliftedFFITypes
  -XLiberalTypeSynonyms
  -XRankNTypes
  -XTypeOperators
  -XRecursiveDo
  -XImplicitPrelude
  -XGADTs
  -XTypeFamilies
  -XMonomorphismRestriction
  -XMonoPatBinds
  -XRelaxedPolyRec
  -XImplicitParams
  -XScopedTypeVariables
  -XUnboxedTuples
  -XStandaloneDeriving
  -XDeriveDataTypeable
  -XTypeSynonymInstances
  -XFlexibleContexts
  -XFlexibleInstances
  -XConstrainedClassMethods
  -XMultiParamTypeClasses
  -XFunctionalDependencies
  -XGeneralizedNewtypeDeriving
active package flags: none
packages currently loaded:
  base
  rts
-- :set -package ghc
active package flags:
  -package ghc
packages currently loaded:
"""%{'mangling': mangling}
130

131
132
133
  else:
    outtext = """\
-- ghci024.stdout is a generated file! please edit ghci024.py instead.
134
135
136
options currently set: none.
GHCi-specific dynamic flag settings:
  -fno-print-explicit-foralls
Ian Lynagh's avatar
Ian Lynagh committed
137
  -fno-print-bind-result
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  -fno-break-on-exception
  -fno-break-on-error
  -fno-print-evld-with-show
other dynamic, non-language, flag settings:
  -fno-warn-dodgy-imports
  -fwarn-duplicate-exports
  -fno-warn-hi-shadowing
  -fno-warn-implicit-prelude
  -fno-warn-incomplete-patterns
  -fno-warn-incomplete-record-updates
  -fwarn-missing-fields
  -fwarn-missing-methods
  -fno-warn-missing-signatures
  -fno-warn-name-shadowing
  -fwarn-overlapping-patterns
  -fno-warn-simple-patterns
  -fno-warn-type-defaults
  -fno-warn-monomorphism-restriction
  -fno-warn-unused-binds
  -fno-warn-unused-imports
  -fno-warn-unused-matches
  -fwarn-deprecations
  -fno-warn-orphans
  -fno-warn-tabs
  -fno-strictness
163
  -fno-static-argument-transformation
164
165
166
167
168
169
170
171
172
173
174
175
176
  -fno-full-laziness
  -fno-liberate-case
  -fno-spec-constr
  -fno-cse
  -fignore-interface-pragmas
  -fomit-interface-pragmas
  -fdo-lambda-eta-expansion
  -fno-ignore-asserts
  -fno-do-eta-reduction
  -fno-case-merge
  -fno-unbox-strict-fields
  -fno-dicts-cheap
  -fno-excess-precision
177
  -f%(mangling)sasm-mangling
178
179
180
  -fno-force-recomp
  -fno-hpc-no-auto
  -fno-rewrite-rules
181
182
183
184
  -fprint-bind-contents
  -fno-run-cps
  -fno-convert-to-zipper-and-back
  -fno-vectorise
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
  -fno-regs-graph
  -fno-regs-iterative
  -fgen-manifest
  -fembed-manifest
active language flags:
  -XImplicitPrelude
  -XMonomorphismRestriction
  -XMonoPatBinds
-- :set -fglasgow-exts
active language flags:
  -XPatternGuards
  -XUnicodeSyntax
  -XMagicHash
  -XPolymorphicComponents
  -XExistentialQuantification
  -XKindSignatures
  -XPatternSignatures
  -XEmptyDataDecls
  -XParallelListComp
  -XForeignFunctionInterface
  -XUnliftedFFITypes
  -XLiberalTypeSynonyms
  -XRankNTypes
208
  -XImpredicativeTypes
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
  -XTypeOperators
  -XRecursiveDo
  -XImplicitPrelude
  -XGADTs
  -XTypeFamilies
  -XMonomorphismRestriction
  -XMonoPatBinds
  -XRelaxedPolyRec
  -XImplicitParams
  -XScopedTypeVariables
  -XUnboxedTuples
  -XStandaloneDeriving
  -XDeriveDataTypeable
  -XTypeSynonymInstances
  -XFlexibleContexts
  -XFlexibleInstances
  -XConstrainedClassMethods
  -XMultiParamTypeClasses
  -XFunctionalDependencies
  -XGeneralizedNewtypeDeriving
active package flags: none
packages currently loaded:
  base
Ian Lynagh's avatar
Ian Lynagh committed
232
233
  integer
  ghc-prim
234
235
236
237
238
  rts
-- :set -package ghc
active package flags:
  -package ghc
packages currently loaded:
239
"""%{'mangling': mangling}
240
241
242
243
244
245
246
247

  outfile = open(in_testdir('ghci024.stdout'), 'w')
  outfile.write(outtext)
  for l in packagelist: outfile.write('  '+l+'\n')
  outfile.close()

  return;