-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMain.hs
710 lines (592 loc) · 21.6 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
76
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
130
131
132
133
134
135
136
137
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
-- Copyright (c) 2019 - 2024, Digital Asset (Switzerland) GmbH and/or
-- its affiliates. All rights reserved. SPDX-License-Identifier:
-- (Apache-2.0 OR BSD-3-Clause)
-- hlint examples/ghc-lib-test-mini-hlint/src --cpp-include examples/ghc-lib-test-mini-hlint/extra-source-files
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-missing-fields #-}
#if __GLASGOW_HASKELL__ >= 908
{-# OPTIONS_GHC -Wx-partial #-}
#endif
module Main (main) where
-- We use 0.x for HEAD
#if !MIN_VERSION_ghc_lib_parser(1,0,0)
# define GHC_9_14
# include "ghc-9.14/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,12,0)
# define GHC_9_12
# include "ghc-9.12/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,10,0)
# define GHC_9_10
# include "ghc-9.10/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,8,0)
# define GHC_9_8
# include "ghc-9.8/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,6,0)
# define GHC_9_6
# include "ghc-9.6/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,4,0)
# define GHC_9_4
# include "ghc-9.4/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,2,0)
# define GHC_9_2
# include "ghc-9.2/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(9,0,0)
# define GHC_9_0
# include "ghc-9.0/Main.hs"
#elif MIN_VERSION_ghc_lib_parser(8,10,0)
# define GHC_8_10
# include "ghc-8.10/Main.hs"
#else
# define GHC_8_8
# include "ghc-8.8/Main.hs"
#endif
import Control.Monad.Extra
import System.Environment
import System.IO.Extra
import qualified Data.Map as Map
import Data.Generics.Uniplate.Operations
import Data.Generics.Uniplate.Data
#if defined (GHC_8_10)
import Bag
#elif defined (GHC_9_0) || defined (GHC_9_2)
import GHC.Data.Bag
#endif
#if defined (GHC_8_8) || defined (GHC_8_10)
parse :: String -> DynFlags -> String -> ParseResult (Located (HsModule GhcPs))
parse filename flags str = unP Parser.parseModule parseState
where
location = mkRealSrcLoc (mkFastString filename) 1 1
buffer = stringToStringBuffer str
parseState = mkPState flags buffer location
#elif defined (GHC_9_0)
parse :: String -> DynFlags -> String -> ParseResult (Located HsModule)
parse filename flags str = unP GHC.Parser.parseModule parseState
where
location = mkRealSrcLoc (mkFastString filename) 1 1
buffer = stringToStringBuffer str
parseState = mkPState flags buffer location
#elif defined (GHC_9_2) || defined (GHC_9_4)
parse :: String -> DynFlags -> String -> ParseResult (Located HsModule)
parse filename flags str = unP GHC.Parser.parseModule parseState
where
location = mkRealSrcLoc (mkFastString filename) 1 1
buffer = stringToStringBuffer str
parseState = initParserState (initParserOpts flags) buffer location
#else
{- defined (GHC_9_6) || defined (GHC_9_8) || defined (GHC_9_10) || defined (GHC_9_12) || defined (GHC_9_14) -}
parse :: String -> DynFlags -> String -> ParseResult (Located (HsModule GhcPs))
parse filename flags str = unP GHC.Parser.parseModule parseState
where
location = mkRealSrcLoc (mkFastString filename) 1 1
buffer = stringToStringBuffer str
parseState = initParserState (initParserOpts flags) buffer location
#endif
parsePragmasIntoDynFlags :: DynFlags -> FilePath -> String -> IO (Maybe DynFlags)
parsePragmasIntoDynFlags flags filepath str =
#if defined (GHC_8_8) || defined (GHC_8_10) || defined (GHC_9_0)
catchErrors $ do
let opts = getOptions flags
(stringToStringBuffer str) filepath
(flags, _, _) <- parseDynamicFilePragma flags opts
return $ Just flags
where
catchErrors :: IO (Maybe DynFlags) -> IO (Maybe DynFlags)
catchErrors act = handleGhcException reportGhcException
(handleSourceError reportSourceErr act)
reportGhcException e = do
print e; return Nothing
reportSourceErr msgs = case sDocs of
[] -> return Nothing
sDoc : _ -> do putStrLn sDoc; return Nothing
where
sDocs = [ showSDoc flags msg | msg <- pprErrMsgBagWithLoc $ srcErrorMessages msgs ]
#elif defined (GHC_9_2)
catchErrors $ do
let opts = getOptions flags
(stringToStringBuffer str) filepath
(flags, _, _) <- parseDynamicFilePragma flags opts
return $ Just flags
where
catchErrors :: IO (Maybe DynFlags) -> IO (Maybe DynFlags)
catchErrors act = handleGhcException reportGhcException
(handleSourceError reportSourceErr act)
reportGhcException e = do
print e; return Nothing
reportSourceErr msgs = case sDocs of
[] -> return Nothing
sDoc : _ -> do putStrLn sDoc; return Nothing
where
sDocs = [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLoc $ srcErrorMessages msgs ]
#elif defined (GHC_9_4)
catchErrors $ do
let (_, opts) = getOptions (initParserOpts flags)
(stringToStringBuffer str) filepath
(flags, _, _) <- parseDynamicFilePragma flags opts
return $ Just flags
where
catchErrors :: IO (Maybe DynFlags) -> IO (Maybe DynFlags)
catchErrors act = handleGhcException reportGhcException
(handleSourceError reportSourceErr act)
reportGhcException e = do print e; return Nothing
reportSourceErr msgs = case sDocs of
[] -> return Nothing
sDoc : _ -> do putStrLn sDoc; return Nothing
where
sDocs = [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLoc . getMessages $ srcErrorMessages msgs ]
#elif defined (GHC_9_6)
catchErrors $ do
let (_, opts) = getOptions (initParserOpts flags)
(stringToStringBuffer str) filepath
(flags, _, _) <- parseDynamicFilePragma flags opts
return $ Just flags
where
catchErrors :: IO (Maybe DynFlags) -> IO (Maybe DynFlags)
catchErrors act = handleGhcException reportGhcException
(handleSourceError reportSourceErr act)
reportGhcException e = do print e; return Nothing
reportSourceErr msgs = case sDocs of
[] -> return Nothing
sDoc : _ -> do putStrLn sDoc; return Nothing
where
sDocs = [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLocDefault . getMessages $ srcErrorMessages msgs ]
#elif (defined (GHC_9_8) || defined (GHC_9_10) || defined (GHC_9_12))
catchErrors $ do
let (_, opts) = getOptions (initParserOpts flags)
(stringToStringBuffer str) filepath
(flags, _, _) <- parseDynamicFilePragma flags opts
return $ Just flags
where
catchErrors :: IO (Maybe DynFlags) -> IO (Maybe DynFlags)
catchErrors act = handleGhcException reportGhcException
(handleSourceError reportSourceErr act)
reportGhcException e = do print e; return Nothing
reportSourceErr msgs = case sDocs of
[] -> return Nothing
sDoc : _ -> do putStrLn sDoc; return Nothing
where
sDocs = [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLocDefault . getMessages $ srcErrorMessages msgs ]
#else
{- defined (GHC_9_14) -}
catchErrors $ do
let (_, opts) = getOptions (initParserOpts flags)
(supportedLanguagePragmas flags)
(stringToStringBuffer str) filepath
(flags, _, _) <- parseDynamicFilePragma flags opts
return $ Just flags
where
catchErrors :: IO (Maybe DynFlags) -> IO (Maybe DynFlags)
catchErrors act = handleGhcException reportGhcException
(handleSourceError reportSourceErr act)
reportGhcException e = do print e; return Nothing
reportSourceErr msgs = case sDocs of
[] -> return Nothing
sDoc : _ -> do putStrLn sDoc; return Nothing
where
sDocs = [ showSDoc flags msg | msg <- pprMsgEnvelopeBagWithLocDefault . getMessages $ srcErrorMessages msgs ]
#endif
idNot :: RdrName
idNot = mkVarUnqual (fsLit "not")
isNegated :: HsExpr GhcPs -> Bool
#if defined (GHC_8_8) || defined (GHC_8_10) || defined (GHC_9_0) || defined (GHC_9_2)
isNegated (HsApp _ (L _ (HsVar _ (L _ id))) _) = id == idNot
isNegated (HsPar _ (L _ e)) = isNegated e
isNegated _ = False
#elif defined (GHC_9_4) || defined (GHC_9_6) || defined (GHC_9_8)
isNegated (HsApp _ (L _ (HsVar _ (L _ id))) _) = id == idNot
isNegated (HsPar _ _ (L _ e) _ ) = isNegated e
isNegated _ = False
#else
{- defined (GHC_9_10) || defined (GHC_9_12) || defined (GHC_9_14) -}
isNegated (HsApp _ (L _ (HsVar _ (L _ id))) _) = id == idNot
isNegated (HsPar _ (L _ e)) = isNegated e
isNegated _ = False
#endif
#if defined (GHC_8_8) || defined (GHC_8_10) || defined (GHC_9_0)
analyzeExpr :: DynFlags -> Located (HsExpr GhcPs) -> IO ()
analyzeExpr flags (L loc expr) = do
case expr of
HsApp _ (L _ (HsVar _ (L _ id))) (L _ e)
| id == idNot, isNegated e ->
putStrLn (showSDoc flags (ppr loc)
++ " : lint : double negation "
++ "`" ++ showSDoc flags (ppr expr) ++ "'")
_ -> return ()
#else
{- defined (GHC_9_2) || defined (GHC_9_4) || defined (GHC_9_6) || defined (GHC_9_8) || defined (GHC_9_10) || defined (GHC_9_12) || defined (GHC_9_14) -}
analyzeExpr :: DynFlags -> LocatedA (HsExpr GhcPs) -> IO ()
analyzeExpr flags (L loc expr) = do
case expr of
HsApp _ (L _ (HsVar _ (L _ id))) (L _ e)
| id == idNot, isNegated e ->
putStrLn (showSDoc flags (ppr (locA loc))
++ " : lint : double negation "
++ "`" ++ showSDoc flags (ppr expr) ++ "'")
_ -> return ()
#endif
#if defined (GHC_8_8) || defined (GHC_8_10)
analyzeModule :: DynFlags -> Located (HsModule GhcPs) -> ApiAnns -> IO ()
analyzeModule flags (L _ modu) _ = sequence_ [analyzeExpr flags e | e <- universeBi modu]
#elif defined (GHC_9_0)
analyzeModule :: DynFlags -> Located HsModule -> ApiAnns -> IO ()
analyzeModule flags (L _ modu) _ = sequence_ [analyzeExpr flags e | e <- universeBi modu]
#elif defined (GHC_9_2) || defined (GHC_9_4)
analyzeModule :: DynFlags -> Located HsModule -> IO ()
analyzeModule flags (L _ modu) = sequence_ [analyzeExpr flags e | e <- universeBi modu]
#else
{- defined (GHC_9_6) || defined (GHC_9_8) || defined (GHC_9_10 ) || defined (GHC_9_12) || defined (GHC_9_14) -}
analyzeModule :: DynFlags -> Located (HsModule GhcPs) -> IO ()
analyzeModule flags (L _ modu) = sequence_ [analyzeExpr flags e | e <- universeBi modu]
#endif
#if defined (GHC_8_8)
main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
s <- readFile' file
flags <- parsePragmasIntoDynFlags (defaultDynFlags fakeSettings fakeLlvmConfig) file s
whenJust flags $ \flags ->
case parse file (flags `gopt_set` Opt_KeepRawTokenStream) s of
PFailed _ loc err -> report flags $ unitBag $ mkPlainErrMsg flags loc err
POk s m -> do
let (wrns, errs) = getMessages s flags
report flags wrns
report flags errs
when (null errs) $
analyzeModule flags m $ harvestAnns s
_ -> fail "Exactly one file argument required"
where
report :: DynFlags -> Bag ErrMsg -> IO ()
report flags msgs =
sequence_
[ putStrLn $ showSDoc flags msg
| msg <- pprErrMsgBagWithLoc msgs
]
harvestAnns :: PState -> (Map.Map ApiAnnKey [SrcSpan], Map.Map SrcSpan [Located AnnotationComment])
harvestAnns pst =
( Map.fromListWith (++) $ annotations pst
, Map.fromList ((noSrcSpan, comment_q pst) : annotations_comments pst)
)
#elif defined (GHC_8_10)
main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
s <- readFile' file
flags <- parsePragmasIntoDynFlags (defaultDynFlags fakeSettings fakeLlvmConfig) file s
whenJust flags $ \flags ->
case parse file (flags `gopt_set` Opt_KeepRawTokenStream) s of
PFailed s -> report flags $ snd (getMessages s flags)
POk s m -> do
let (wrns, errs) = getMessages s flags
report flags wrns
report flags errs
when (null errs) $
analyzeModule flags m $ harvestAnns s
_ -> fail "Exactly one file argument required"
where
report :: DynFlags -> Bag.Bag ErrMsg -> IO ()
report flags msgs =
sequence_
[ putStrLn $ showSDoc flags msg
| msg <- pprErrMsgBagWithLoc msgs
]
harvestAnns :: PState -> (Map.Map ApiAnnKey [SrcSpan], Map.Map SrcSpan [Located AnnotationComment])
harvestAnns pst =
( Map.fromListWith (++) $ annotations pst
, Map.fromList ((noSrcSpan, comment_q pst) : annotations_comments pst)
)
#elif defined (GHC_9_0)
main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
s <- readFile' file
flags <- parsePragmasIntoDynFlags (defaultDynFlags fakeSettings fakeLlvmConfig) file s
whenJust flags $ \flags ->
case parse file (flags `gopt_set` Opt_KeepRawTokenStream) s of
PFailed s -> report flags $ snd (getMessages s flags)
POk s m -> do
let (wrns, errs) = getMessages s flags
report flags wrns
report flags errs
when (null errs) $
analyzeModule flags m $ harvestAnns s
_ -> fail "Exactly one file argument required"
where
report :: DynFlags -> GHC.Data.Bag.Bag ErrMsg -> IO ()
report flags msgs =
sequence_
[ putStrLn $ showSDoc flags msg
| msg <- pprErrMsgBagWithLoc msgs
]
harvestAnns :: PState -> ApiAnns
harvestAnns pst = ApiAnns {
apiAnnItems = Map.fromListWith (++) $ annotations pst
, apiAnnEofPos = Nothing
, apiAnnComments = Map.fromListWith (++) $ annotations_comments pst
, apiAnnRogueComments = comment_q pst
}
#elif defined (GHC_9_2)
main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
s <- readFile' file
flags <- parsePragmasIntoDynFlags (defaultDynFlags fakeSettings fakeLlvmConfig) file s
whenJust flags $ \flags ->
case parse file (flags `gopt_set` Opt_KeepRawTokenStream) s of
PFailed s -> report flags $ fmap pprError (snd (getMessages s))
POk s m -> do
let (wrns, errs) = getMessages s
report flags $ fmap pprWarning wrns
report flags $ fmap pprError errs
when (null errs) $ analyzeModule flags m
_ -> fail "Exactly one file argument required"
where
report :: DynFlags -> GHC.Data.Bag.Bag (MsgEnvelope DecoratedSDoc) -> IO ()
report flags msgs =
sequence_
[ putStrLn $ showSDoc flags msg
| msg <- pprMsgEnvelopeBagWithLoc msgs
]
#elif defined (GHC_9_4)
main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
s <- readFile' file
flags <- parsePragmasIntoDynFlags (defaultDynFlags fakeSettings fakeLlvmConfig) file s
whenJust flags $ \flags ->
case parse file (flags `gopt_set` Opt_KeepRawTokenStream)s of
PFailed s -> report flags $ GhcPsMessage <$> snd (getPsMessages s)
POk s m -> do
let (wrns, errs) = getPsMessages s
report flags $ fmap GhcPsMessage wrns
report flags $ fmap GhcPsMessage errs
when (null errs) $ analyzeModule flags m
_ -> fail "Exactly one file argument required"
where
report :: DynFlags -> Messages GhcMessage -> IO ()
report flags msgs = do
logger <- initLogger
let opts = initDiagOpts flags
printMessages logger opts msgs
#else
{- defined (GHC_9_6) || defined (GHC_9_8) || defined (GHC_9_10) || defined (GHC_9_12) || defined (GHC_9_14) -}
main :: IO ()
main = do
args <- getArgs
case args of
[file] -> do
s <- readFile' file
flags <- parsePragmasIntoDynFlags (defaultDynFlags fakeSettings) file s
whenJust flags $ \flags ->
case parse file (flags `gopt_set` Opt_KeepRawTokenStream)s of
PFailed s -> report flags $ GhcPsMessage <$> snd (getPsMessages s)
POk s m -> do
let (wrns, errs) = getPsMessages s
report flags $ fmap GhcPsMessage wrns
report flags $ fmap GhcPsMessage errs
when (null errs) $ analyzeModule flags m
_ -> fail "Exactly one file argument required"
where
report :: DynFlags -> Messages GhcMessage -> IO ()
report flags msgs = do
let opts = initDiagOpts flags
print_config = initPrintConfig flags
logger <- initLogger
printMessages logger print_config opts msgs
#endif
#if defined (GHC_8_8)
fakeLlvmConfig :: (LlvmTargets, LlvmPasses)
fakeLlvmConfig = ([], [])
#elif defined (GHC_8_10) || defined (GHC_9_0) || defined (GHC_9_2) || defined (GHC_9_4)
fakeLlvmConfig :: LlvmConfig
fakeLlvmConfig = LlvmConfig [] []
#else
{- defined (GHC_9_6) || defined (GHC_9_8) || defined (GHC_9_10 ) || defined (GHC_9_12) || defined (GHC_9_14) -}
#endif
fakeSettings :: Settings
fakeSettings = Settings {
#if defined (GHC_8_8)
sTargetPlatform=platform
, sPlatformConstants=platformConstants
, sProjectVersion=cProjectVersion
, sProgramName="ghc"
, sOpt_P_fingerprint=fingerprint0
, sTmpDir="."
}
where
platform = Platform {
platformWordSize=8
, platformOS=OSUnknown
, platformUnregisterised=True
}
platformConstants = PlatformConstants {
pc_DYNAMIC_BY_DEFAULT=False
, pc_WORD_SIZE=8
, pc_STD_HDR_SIZE=1
, pc_TAG_BITS=3
, pc_BLOCKS_PER_MBLOCK=252
, pc_BLOCK_SIZE=4096
, pc_MIN_PAYLOAD_SIZE=1
, pc_MAX_Real_Vanilla_REG=6
, pc_MAX_Vanilla_REG=10
, pc_MAX_Real_Long_REG=0
}
#elif defined (GHC_8_10)
sGhcNameVersion=ghcNameVersion
, sFileSettings=fileSettings
, sTargetPlatform=platform
, sPlatformMisc=platformMisc
, sToolSettings=toolSettings
, sPlatformConstants=platformConstants
}
where
fileSettings = FileSettings {
}
toolSettings = ToolSettings {
toolSettings_opt_P_fingerprint=fingerprint0
}
platformMisc = PlatformMisc {
platformMisc_integerLibraryType=IntegerSimple
}
ghcNameVersion = GhcNameVersion{
ghcNameVersion_programName="ghc"
, ghcNameVersion_projectVersion=cProjectVersion
}
platform = Platform{
platformWordSize=PW8
, platformMini=PlatformMini {platformMini_arch=ArchUnknown, platformMini_os=OSUnknown}
, platformUnregisterised=True
}
platformConstants = PlatformConstants {
pc_DYNAMIC_BY_DEFAULT=False
, pc_WORD_SIZE=8
, pc_STD_HDR_SIZE=1
, pc_TAG_BITS=3
, pc_BLOCKS_PER_MBLOCK=252
, pc_BLOCK_SIZE=4096
, pc_MIN_PAYLOAD_SIZE=1
, pc_MAX_Real_Vanilla_REG=6
, pc_MAX_Vanilla_REG=10
, pc_MAX_Real_Long_REG=0
}
#elif defined (GHC_9_0)
sGhcNameVersion=ghcNameVersion
, sFileSettings=fileSettings
, sTargetPlatform=platform
, sPlatformMisc=platformMisc
, sToolSettings=toolSettings
, sPlatformConstants=platformConstants
}
where
fileSettings = FileSettings {
}
toolSettings = ToolSettings {
toolSettings_opt_P_fingerprint=fingerprint0
}
platformMisc=PlatformMisc {
}
ghcNameVersion = GhcNameVersion {
ghcNameVersion_programName="ghc"
, ghcNameVersion_projectVersion=cProjectVersion
}
platform = Platform {
platformByteOrder=LittleEndian
, platformHasGnuNonexecStack=True
, platformHasIdentDirective=False
, platformHasSubsectionsViaSymbols=False
, platformIsCrossCompiling=False
, platformLeadingUnderscore=False
, platformTablesNextToCode=False
, platformWordSize=PW8
, platformMini=PlatformMini {
platformMini_arch=ArchUnknown
, platformMini_os=OSUnknown
}
, platformUnregisterised=True
}
platformConstants = PlatformConstants {
pc_DYNAMIC_BY_DEFAULT=False
, pc_WORD_SIZE=8
, pc_STD_HDR_SIZE=1
, pc_TAG_BITS=3
, pc_BLOCKS_PER_MBLOCK=252
, pc_BLOCK_SIZE=4096
, pc_MIN_PAYLOAD_SIZE=1
, pc_MAX_Real_Vanilla_REG=6
, pc_MAX_Vanilla_REG=10
, pc_MAX_Real_Long_REG=0
}
#elif defined (GHC_9_2)
sGhcNameVersion=ghcNameVersion
, sFileSettings=fileSettings
, sTargetPlatform=platform
, sPlatformMisc=platformMisc
, sToolSettings=toolSettings
}
where
fileSettings = FileSettings {
}
toolSettings = ToolSettings {
toolSettings_opt_P_fingerprint=fingerprint0
}
platformMisc = PlatformMisc {
}
ghcNameVersion = GhcNameVersion {
ghcNameVersion_programName="ghc"
, ghcNameVersion_projectVersion=cProjectVersion
}
platform=genericPlatform
#elif (defined (GHC_9_4) || defined (GHC_9_6) || defined (GHC_9_8) || defined (GHC_9_10) || defined (GHC_9_12))
sGhcNameVersion=ghcNameVersion
, sFileSettings=fileSettings
, sTargetPlatform=platform
, sPlatformMisc=platformMisc
, sToolSettings=toolSettings
}
where
fileSettings = FileSettings {
}
toolSettings = ToolSettings {
toolSettings_opt_P_fingerprint=fingerprint0
}
platformMisc = PlatformMisc {
}
ghcNameVersion = GhcNameVersion{
ghcNameVersion_programName="ghc"
, ghcNameVersion_projectVersion=cProjectVersion
}
platform=genericPlatform
#else
{- defined (GHC_9_14) -}
sGhcNameVersion=ghcNameVersion
, sFileSettings=fileSettings
, sTargetPlatform=platform
, sPlatformMisc=platformMisc
, sToolSettings=toolSettings
, sUnitSettings=unitSettings
}
where
unitSettings = UnitSettings {
unitSettings_baseUnitId = stringToUnitId "base"
}
fileSettings = FileSettings {
}
toolSettings = ToolSettings {
toolSettings_opt_P_fingerprint=fingerprint0
}
platformMisc = PlatformMisc {
}
ghcNameVersion = GhcNameVersion{
ghcNameVersion_programName="ghc"
, ghcNameVersion_projectVersion=cProjectVersion
}
platform=genericPlatform
#endif