-
35826d8b
by Matthew Pickering at 2025-06-08T22:00:41+01:00
Hadrian: Add option to generate .hie files for stage1 libraries
The +hie_files flavour transformer can be enabled to produce hie files
for stage1 libraries. The hie files are produced in the
"extra-compilation-artifacts" folder and copied into the resulting
bindist.
At the moment the hie files are not produced for the release flavour,
they add about 170M to the final bindist.
Towards #16901
-
e2467dbd
by Ryan Hendrickson at 2025-06-09T13:07:05-04:00
Fix various failures to -fprint-unicode-syntax
-
1d99d3e4
by maralorn at 2025-06-12T03:47:39-04:00
Add necessary flag for js linking
-
974d5734
by maralorn at 2025-06-12T03:47:39-04:00
Don’t use additional linker flags to detect presence of -fno-pie in configure.ac
This mirrors the behavior of ghc-toolchain
-
1e9eb118
by Andrew Lelechenko at 2025-06-12T03:48:21-04:00
Add HasCallStack to Control.Monad.Fail.fail
CLC proposal https://github.com/haskell/core-libraries-committee/issues/327
2% compile-time allocations increase in T3064, likely because `fail`
is now marginally more expensive to compile.
Metric Increase:
T3064
-
6d12060f
by meooow25 at 2025-06-12T14:26:07-04:00
Bump containers submodule to 0.8
Also
* Disable -Wunused-imports for containers
* Allow containers-0.8 for in-tree packages
* Bump some submodules so that they allow containers-0.8. These are not
at any particular versions.
* Remove unused deps containers and split from ucd2haskell
* Fix tests affected by the new containers and hpc-bin
-
537bd233
by Peng Fan at 2025-06-12T14:27:02-04:00
NCG/LA64: Optimize code generation and reduce build-directory size.
1. makeFarBranches: Prioritize fewer instruction sequences.
2. Prefer instructions with immediate numbers to reduce register moves,
e.g. andi,ori,xori,addi.
3. Ppr: Remove unnecessary judgments.
4. genJump: Avoid "ld+jr" as much as possible.
5. BCOND and BCOND1: Implement conditional jumps with two jump ranges,
with limited choice of the shortest.
6. Implement FSQRT, CLT, CTZ.
7. Remove unnecessary code.
-
19f20861
by Simon Peyton Jones at 2025-06-13T09:51:11-04:00
Improve redundant constraints for instance decls
Addresses #25992, which showed that the default methods
of an instance decl could make GHC fail to report redundant
constraints.
Figuring out how to do this led me to refactor the computation
of redundant constraints. See the entirely rewritten
Note [Tracking redundant constraints]
in GHC.Tc.Solver.Solve
-
1d02798e
by Matthew Pickering at 2025-06-13T09:51:54-04:00
Refactor the treatment of nested Template Haskell splices
* The difference between a normal splice, a quasiquoter and implicit
splice caused by lifting is stored in the AST after renaming.
* Information that the renamer learns about splices is stored in the
relevant splice extension points (XUntypedSpliceExpr, XQuasiQuote).
* Normal splices and quasi quotes record the flavour of splice
(exp/pat/dec etc)
* Implicit lifting stores information about why the lift was attempted,
so if it fails, that can be reported to the user.
* After renaming, the decision taken to attempt to implicitly lift a
variable is stored in the `XXUntypedSplice` extension field in the
`HsImplicitLiftSplice` constructor.
* Since all the information is stored in the AST, in `HsUntypedSplice`,
the type of `PendingRnSplice` now just stores a `HsUntypedSplice`.
* Error messages since the original program can be easily
printed, this is noticeable in the case of implicit lifting.
* The user-written syntax is directly type-checked. Before, some
desugaring took place in the
* Fixes .hie files to work better with nested splices (nested splices
are not indexed)
* The location of the quoter in a quasiquote is now located, so error
messages will precisely point to it (and again, it is indexed by hie
files)
In the future, the typechecked AST should also retain information about
the splices and the specific desugaring being left to the desugarer.
Also, `runRnSplice` should call `tcUntypedSplice`, otherwise the
typechecking logic is duplicated (see the `QQError` and `QQTopError`
tests for a difference caused by this).
-
f93798ba
by Cheng Shao at 2025-06-13T09:52:35-04:00
libffi: update to 3.5.1
Bumps libffi submodule.
-
4c469768
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
GHC-CPP: first rough proof of concept
Processes
#define FOO
#ifdef FOO
x = 1
#endif
Into
[ITcppIgnored [L loc ITcppDefine]
,ITcppIgnored [L loc ITcppIfdef]
,ITvarid "x"
,ITequal
,ITinteger (IL {il_text = SourceText "1", il_neg = False, il_value = 1})
,ITcppIgnored [L loc ITcppEndif]
,ITeof]
In time, ITcppIgnored will be pushed into a comment
-
94d52516
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Tidy up before re-visiting the continuation mechanic
-
db9f58c9
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Switch preprocessor to continuation passing style
Proof of concept, needs tidying up
-
8452c145
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Small cleanup
-
c6681522
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Get rid of some cruft
-
be02e288
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Starting to integrate.
Need to get the pragma recognised and set
-
65c23e60
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Make cppTokens extend to end of line, and process CPP comments
-
93508504
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Remove unused ITcppDefined
-
067d7ca8
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Allow spaces between # and keyword for preprocessor directive
-
a4545a17
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Process CPP continuation lines
They are emited as separate ITcppContinue tokens.
Perhaps the processing should be more like a comment, and keep on
going to the end.
BUT, the last line needs to be slurped as a whole.
-
321dc532
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Accumulate CPP continuations, process when ready
Can be simplified further, we only need one CPP token
-
31c636bb
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Simplify Lexer interface. Only ITcpp
We transfer directive lines through it, then parse them from scratch
in the preprocessor.
-
42f55a97
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Deal with directive on last line, with no trailing \n
-
37a58edf
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Start parsing and processing the directives
-
d8c030dd
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Prepare for processing include files
-
fff86bf5
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Move PpState into PreProcess
And initParserState, initPragState too
-
b38f1dcb
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Process nested include files
Also move PpState out of Lexer.x, so it is easy to evolve it in a ghci
session, loading utils/check-cpp/Main.hs
-
6edae67e
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Split into separate files
-
b4a1c51a
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Starting on expression parser.
But it hangs. Time for Text.Parsec.Expr
-
466c4bbc
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Start integrating the ghc-cpp work
From https://github.com/alanz/ghc-cpp
-
54a33893
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
WIP
-
1ff0299c
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Fixup after rebase
-
091ccba3
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
WIP
-
e209e8a8
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Fixup after rebase, including all tests pass
-
15fc3813
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Change pragma usage to GHC_CPP from GhcCPP
-
7e9ab2d5
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Some comments
-
0f0afba2
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Reformat
-
4612b446
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Delete unused file
-
b8d1ded0
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Rename module Parse to ParsePP
-
7e0b984c
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Clarify naming in the parser
-
1142339c
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
WIP. Switching to alex/happy to be able to work in-tree
Since Parsec is not available
-
64485aeb
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Layering is now correct
- GHC lexer, emits CPP tokens
- accumulated in Preprocessor state
- Lexed by CPP lexer, CPP command extracted, tokens concated with
spaces (to get rid of token pasting via comments)
- if directive lexed and parsed by CPP lexer/parser, and evaluated
-
56e890df
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
First example working
Loading Example1.hs into ghci, getting the right results
```
{-# LANGUAGE GHC_CPP #-}
module Example1 where
y = 3
x =
"hello"
"bye now"
foo = putStrLn x
```
-
35571286
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
Rebase, and all tests pass except whitespace for generated parser
-
cd41e5e9
by Alan Zimmerman at 2025-06-14T09:55:42+01:00
More plumbing. Ready for testing tomorrow.
-
f546d56f
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Proress. Renamed module State from Types
And at first blush it seems to handle preprocessor scopes properly.
-
5c881727
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Insert basic GHC version macros into parser
__GLASGOW_HASKELL__
__GLASGOW_HASKELL_FULL_VERSION__
__GLASGOW_HASKELL_PATCHLEVEL1__
__GLASGOW_HASKELL_PATCHLEVEL2__
-
47d9fe5d
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Re-sync check-cpp for easy ghci work
-
307f1776
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Get rid of warnings
-
806d7a86
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Rework macro processing, in check-cpp
Macros kept at the top level, looked up via name, multiple arity
versions per name can be stored
-
7c4b6c1a
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
WIP. Can crack arguments for #define
Next step it to crack out args in an expansion
-
23184007
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
WIP on arg parsing.
-
464c61c1
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Progress. Still screwing up nested parens.
-
4f597fe8
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Seems to work, but has redundant code
-
4a95075a
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Remove redundant code
-
0991f54c
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Reformat
-
a0ed933e
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Expand args, single pass
Still need to repeat until fixpoint
-
1d065a9f
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Fixed point expansion
-
7973aa27
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Sync the playground to compiler
-
b7544bed
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Working on dumping the GHC_CPP result
But We need to keep the BufSpan in a comment
-
4e6aea58
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Keep BufSpan in queued comments in GHC.Parser.Lexer
-
046eef5a
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Getting close to being able to print the combined tokens
showing what is in and what is out
-
251ce408
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
First implementation of dumpGhcCpp.
Example output
First dumps all macros in the state, then the source, showing which
lines are in and which are out
------------------------------
- |#define FOO(A,B) A + B
- |#define FOO(A,B,C) A + B + C
- |#if FOO(1,FOO(3,4)) == 8
- |-- a comment
|x = 1
- |#else
- |x = 5
- |#endif
-
a04a6309
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Clean up a bit
-
9a57ae29
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Add -ddump-ghc-cpp option and a test based on it
-
abc294d4
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Restore Lexer.x rules, we need them for continuation lines
-
8f49326d
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Lexer.x: trying to sort out the span for continuations
- We need to match on \n at the end of the line
- We cannot simply back up for it
-
839a8f8a
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Inserts predefined macros. But does not dump properly
Because the cpp tokens have a trailing newline
-
c0abd96c
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Remove unnecessary LExer rules
We *need* the ones that explicitly match to the end of the line.
-
eaa655e0
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Generate correct span for ITcpp
Dump now works, except we do not render trailing `\` for continuation
lines. This is good enough for use in test output.
-
c3c8bdd9
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Reduce duplication in lexer
-
096e7337
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Tweaks
-
65963487
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Insert min_version predefined macros into state
The mechanism now works. Still need to flesh out the full set.
-
eb6d7b59
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Trying my alternative pragma syntax.
It works, but dumpGhcCpp is broken, I suspect from the ITcpp token
span update.
-
2e55b7cb
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Pragma extraction now works, with both CPP and GHC_CPP
For the following
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 913
{-# LANGUAGE GHC_CPP #-}
#endif
We will enable GHC_CPP only
-
3eb8b23a
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Remove some tracing
-
eced033c
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Fix test exes for changes
-
1c28d9fd
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
For GHC_CPP tests, normalise config-time-based macros
-
96f65347
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
WIP
-
2bfc662a
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
WIP again. What is wrong?
-
9cb0adf5
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Revert to dynflags for normal not pragma lexing
-
93dd5bec
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Working on getting check-exact to work properly
-
15e4b545
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Passes CppCommentPlacement test
-
0692562f
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Starting on exact printing with GHC_CPP
While overriding normal CPP
-
d8d49e42
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Correctly store CPP ignored tokens as comments
By populating the lexeme string in it, based on the bufpos
-
590c3120
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
WIP
-
f0726190
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Simplifying
-
7783f950
by Alan Zimmerman at 2025-06-14T09:55:43+01:00
Update the active state logic
-
a2690aca
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Work the new logic into the mainline code
-
611235f1
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Process `defined` operator
-
a1c5b380
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Manage lexer state while skipping tokens
There is very intricate layout-related state used when lexing. If a
CPP directive blanks out some tokens, store this state when the
blanking starts, and restore it when they are no longer being blanked.
-
ab4578bc
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Track the last token buffer index, for ITCppIgnored
We need to attach the source being skipped in an ITCppIgnored token.
We cannot simply use its BufSpan as an index into the underlying
StringBuffer as it counts unicode chars, not bytes.
So we update the lexer state to store the starting StringBuffer
location for the last token, and use the already-stored length to
extract the correct portion of the StringBuffer being parsed.
-
6104c6cd
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Process the ! operator in GHC_CPP expressions
-
63d74b11
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Predefine a constant when GHC_CPP is being used.
-
997cac00
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
WIP
-
70d3bbf3
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Skip lines directly in the lexer when required
-
81dfffbe
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Properly manage location when accepting tokens again
-
0da22464
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Seems to be working now, for Example9
-
5c3ad292
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Remove tracing
-
b507e7d0
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Fix parsing '*' in block comments
Instead of replacing them with '-'
-
2505f769
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Keep the trailing backslash in a ITcpp token
-
4756cef7
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Deal with only enabling one section of a group.
A group is an instance of a conditional introduced by
#if/#ifdef/#ifndef,
and ending at the final #endif, including intermediate #elsif sections
-
38b9960d
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Replace remaining identifiers with 0 when evaluating
As per the spec
-
de14ee97
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Snapshot before rebase
-
34a6b83e
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Skip non-processed lines starting with #
-
c452e5a3
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Export generateMacros so we can use it in ghc-exactprint
-
21f3185b
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Fix rebase
-
ff0864f0
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Expose initParserStateWithMacrosString
-
f8b5a1ff
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Fix buggy lexer cppSkip
It was skipping all lines, not just ones prefixed by #
-
638b98b2
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Fix evaluation of && to use the correct operator
-
ee94a6d0
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Deal with closing #-} at the start of a line
-
536a0848
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Add the MIN_VERSION_GLASGOW_HASKELL predefined macro
-
dae6a1b8
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Include MIN_VERSION_GLASGOW_HASKELL in GhcCpp01.stderr
-
7b35c213
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Use a strict map for macro defines
-
f440fa87
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Process TIdentifierLParen
Which only matters at the start of #define
-
5fad2fd7
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Do not provide TIdentifierLParen paren twice
-
67f74250
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Handle whitespace between identifier and '(' for directive only
-
efb87e66
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Expose some Lexer bitmap manipulation helpers
-
f1d37735
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Deal with line pragmas as tokens
Blows up for dumpGhcCpp though
-
43631633
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Allow strings delimited by a single quote too
-
598e6413
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Allow leading whitespace on cpp directives
As per https://timsong-cpp.github.io/cppwp/n4140/cpp#1
-
5ed12e21
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Implement GHC_CPP undef
-
c594922e
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Sort out expansion of no-arg macros, in a context with args
And make the expansion bottom out, in the case of recursion
-
7d5bec3c
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Fix GhcCpp01 test
The LINE pragma stuff works in ghc-exactprint when specifically
setting flag to emit ITline_pragma tokens
-
e71742fb
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Process comments in CPP directives
-
35005ddf
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Correctly lex pragmas with finel #-} on a newline
-
3c37dd74
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Do not process CPP-style comments
-
35a13235
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Allow cpp-style comments when GHC_CPP enabled
-
18e9be87
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Return other pragmas as cpp ignored when GHC_CPP active
-
48ed6cd4
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Fix exactprinting default decl
-
f1e043cd
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Reorganise getOptionsFromFile for use in ghc-exactprint
We want to be able to inject predefined macro definitions into the
parser preprocessor state for when we do a hackage roundtrip.
-
6d2efd77
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Tweak testing
-
9a8ae7bd
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Only allow unknown cpp pragmas with # in left margin
-
69d3b736
by Alan Zimmerman at 2025-06-14T09:55:44+01:00
Require # against left margin for all GHC_CPP directives
-
d7dd65cf
by Alan Zimmerman at 2025-06-14T09:55:45+01:00
Fix CPP directives appearing in pragmas
And add a test for error reporting for missing `#if`
-
d70d9990
by Alan Zimmerman at 2025-06-14T09:55:45+01:00
Starting to report GHC_CPP errors using GHC machinery
-
686d8176
by Alan Zimmerman at 2025-06-14T09:55:45+01:00
More GHC_CPP diagnostic results
-
b1466814
by Alan Zimmerman at 2025-06-14T09:55:45+01:00
WIP on converting error calls to GHC diagnostics in GHC_CPP
-
ab80737b
by Alan Zimmerman at 2025-06-14T09:55:45+01:00
Working on CPP diagnostic reporting
-
9c98015e
by Alan Zimmerman at 2025-06-14T13:26:20+01:00
Tweak some tests/lint warnings
-
0d01124b
by Alan Zimmerman at 2025-06-14T15:21:13+01:00
More error reporting in Macro