Alan Zimmerman pushed to branch wip/az/ghc-cpp at Glasgow Haskell Compiler / GHC
Commits:
b08c08ae by soulomoon at 2025-05-28T01:57:23+08:00
Refactor handling of imported COMPLETE pragmas
from the HPT
Previously, we imported COMPLETE pragmas from all modules in the Home
Package Table (HPT) during type checking. However, since !13675, there
may be non-below modules in the HPT from the dependency tree that we do
not want to import COMPLETE pragmas from. This refactor changes the way
we handle COMPLETE pragmas from the HPT to only import them from modules
that are "below" the current module in the HPT.
- Add hugCompleteSigsBelow to filter COMPLETE pragmas from "below"
modules in the HPT, mirroring hugRulesBelow.
- Move responsibility for calling hugCompleteSigsBelow to tcRnImports,
storing the result in the new tcg_complete_match_env field of TcGblEnv.
- Update getCompleteMatchesTcM to use tcg_complete_match_env.
This refactor only affects how COMPLETE pragmas are imported from the
HPT, imports from external packages are unchanged.
- - - - -
16014bf8 by Hécate Kleidukos at 2025-05-28T20:09:34-04:00
Expose all of Backtraces' internals for ghc-internal
Closes #26049
- - - - -
a0adc30d by Ryan Hendrickson at 2025-05-30T14:12:52-04:00
haddock: Fix links to type operators
- - - - -
7b64697c by Mario Blažević at 2025-05-30T14:13:41-04:00
Introduce parenBreakableList and use it in ppHsContext
- - - - -
5f213bff by fendor at 2025-06-02T09:16:24+02:00
Make GHCi commands compatible with multiple home units
=== Design
We enable all GHCi features that were previously guarded by the `inMulti`
option.
GHCi supported multiple home units up to a certain degree for quite a while now.
The supported feature set was limited, due to a design impasse:
One of the home units must be "active", e.g., there must be one `HomeUnit`
whose `UnitId` is "active" which is returned when calling
```haskell
do
hscActiveUnitId <$> getSession
```
This makes sense in a GHC session, since you are always compiling a particular
Module, but it makes less intuitive sense in an interactive session.
Given an expression to evaluate, we can't easily tell in which "context" the expression
should be parsed, typechecked and evaluated.
That's why initially, most of GHCi features, except for `:reload`ing were disabled
if the GHCi session had more than one `HomeUnitEnv`.
We lift this restriction, enabling all features of GHCi for the multiple home unit case.
To do this, we fundamentally change the `HomeUnitEnv` graph to be multiple home unit first.
Instead of differentiating the case were we have a single home unit and multiple,
we now always set up a multiple home unit session that scales seamlessly to an arbitrary
amount of home units.
We introduce two new `HomeUnitEnv`s that are always added to the `HomeUnitGraph`.
They are:
The "interactive-ghci", called the `interactiveGhciUnit`, contains the same
`DynFlags` that are used by the `InteractiveContext` for interactive evaluation
of expressions.
This `HomeUnitEnv` is only used on the prompt of GHCi, so we may refer to it as
"interactive-prompt" unit.
See Note [Relation between the `InteractiveContext` and `interactiveGhciUnitId`]
for discussing its role.
And the "interactive-session"", called `interactiveSessionUnit` or
`interactiveSessionUnitId`, which is used for loading Scripts into
GHCi that are not `Target`s of any home unit, via `:load` or `:add`.
Both of these "interactive" home units depend on all other `HomeUnitEnv`s that
are passed as arguments on the cli.
Additionally, the "interactive-ghci" unit depends on `interactive-session`.
We always evaluate expressions in the context of the
"interactive-ghci" session.
Since "interactive-ghci" depends on all home units, we can import any `Module`
from the other home units with ease.
As we have a clear `HomeUnitGraph` hierarchy, we can set `interactiveGhciUnitId`
as the active home unit for the full duration of the GHCi session.
In GHCi, we always set `interactiveGhciUnitId` to be the currently active home unit.
=== Implementation Details
Given this design idea, the implementation is relatively straight
forward.
The core insight is that a `ModuleName` is not sufficient to identify a
`Module` in the `HomeUnitGraph`. Thus, large parts of the PR is simply
about refactoring usages of `ModuleName` to prefer `Module`, which has a
`Unit` attached and is unique over the `HomeUnitGraph`.
Consequentially, most usages of `lookupHPT` are likely to be incorrect and have
been replaced by `lookupHugByModule` which is keyed by a `Module`.
In `GHCi/UI.hs`, we make sure there is only one location where we are
actually translating `ModuleName` to a `Module`:
* `lookupQualifiedModuleName`
If a `ModuleName` is ambiguous, we detect this and report it to the
user.
To avoid repeated lookups of `ModuleName`s, we store the `Module` in the
`InteractiveImport`, which additionally simplifies the interface
loading.
A subtle detail is that the `DynFlags` of the `InteractiveContext` are
now stored both in the `HomeUnitGraph` and in the `InteractiveContext`.
In UI.hs, there are multiple code paths where we are careful to update
the `DynFlags` in both locations.
Most importantly in `addToProgramDynFlags`.
---
There is one metric increase in this commit:
-------------------------
Metric Increase:
T4029
-------------------------
It is an increase from 14.4 MB to 16.1 MB (+11.8%) which sounds like a
pretty big regression at first.
However, we argue this increase is solely caused by using more data
structures for managing multiple home units in the GHCi session.
In particular, due to the design decision of using three home units, the
base memory usage increases... but by how much?
A big contributor is the `UnitState`, of which we have three now, which
on its own 260 KB per instance. That makes an additional memory usage of
520 KB, already explaining a third of the overall memory usage increase.
Then we store more elements in the `HomeUnitGraph`, we have more
`HomeUnitEnv` entries, etc...
While we didn't chase down each byte, we looked at the memory usage over time
for both `-hi` and `-hT` profiles and can say with confidence while the memory
usage increased slightly, we did not introduce any space leak, as
the graph looks almost identical as the memory usage graph of GHC HEAD.
---
Adds testcases for GHCi multiple home units session
* Test truly multiple home unit sessions, testing reload logic and code evaluation.
* Test that GHCi commands such as `:all-types`, `:browse`, etc., work
* Object code reloading for home modules
* GHCi debugger multiple home units session
- - - - -
de603d01 by fendor at 2025-06-02T09:16:24+02:00
Update "loading compiled code" GHCi documentation
To use object code in GHCi, the module needs to be compiled for use in
GHCi. To do that, users need to compile their modules with:
* `-dynamic`
* `-this-unit-id interactive-session`
Otherwise, the interface files will not match.
- - - - -
b255a8ca by Vladislav Zavialov at 2025-06-02T16:00:12-04:00
docs: Fix code example for NoListTuplePuns
Without the fix, the example produces an error:
Test.hs:11:3: error: [GHC-45219]
• Data constructor ‘Tuple’ returns type ‘Tuple2 a b’
instead of an instance of its parent type ‘Tuple a’
• In the definition of data constructor ‘Tuple’
In the data type declaration for ‘Tuple’
Fortunately, a one line change makes it compile.
- - - - -
6558467c by Ryan Hendrickson at 2025-06-06T05:46:58-04:00
haddock: Parse math even after ordinary characters
Fixes a bug where math sections were not recognized if preceded by a
character that isn't special (like space or a markup character).
- - - - -
265d0024 by ARATA Mizuki at 2025-06-06T05:47:48-04:00
AArch64 NCG: Fix sub-word arithmetic right shift
As noted in Note [Signed arithmetic on AArch64], we should zero-extend sub-word values.
Fixes #26061
- - - - -
05e9be18 by Simon Hengel at 2025-06-06T05:48:35-04:00
Allow Unicode in "message" and "hints" with -fdiagnostics-as-json
(fixes #26075)
- - - - -
bfa6b70f by ARATA Mizuki at 2025-06-06T05:49:24-04:00
x86 NCG: Fix code generation of bswap64 on i386
Co-authored-by: sheaf
Fix #25601
- - - - -
2218e794 by Alan Zimmerman at 2025-06-06T19:47:31+02: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
- - - - -
29b11db7 by Alan Zimmerman at 2025-06-06T19:47:31+02:00
Tidy up before re-visiting the continuation mechanic
- - - - -
4b63c8f6 by Alan Zimmerman at 2025-06-06T19:47:31+02:00
Switch preprocessor to continuation passing style
Proof of concept, needs tidying up
- - - - -
09f504e1 by Alan Zimmerman at 2025-06-06T19:47:31+02:00
Small cleanup
- - - - -
33c240a3 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Get rid of some cruft
- - - - -
e882984d by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Starting to integrate.
Need to get the pragma recognised and set
- - - - -
c297b50d by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Make cppTokens extend to end of line, and process CPP comments
- - - - -
965eb4da by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Remove unused ITcppDefined
- - - - -
6b6454ed by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Allow spaces between # and keyword for preprocessor directive
- - - - -
21baf782 by Alan Zimmerman at 2025-06-06T19:47:32+02: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.
- - - - -
dec26a94 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Accumulate CPP continuations, process when ready
Can be simplified further, we only need one CPP token
- - - - -
f227e9e5 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Simplify Lexer interface. Only ITcpp
We transfer directive lines through it, then parse them from scratch
in the preprocessor.
- - - - -
d227523a by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Deal with directive on last line, with no trailing \n
- - - - -
20a0e262 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Start parsing and processing the directives
- - - - -
305303d7 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Prepare for processing include files
- - - - -
34a6ca46 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Move PpState into PreProcess
And initParserState, initPragState too
- - - - -
83a19f3f by Alan Zimmerman at 2025-06-06T19:47:32+02: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
- - - - -
b4062d73 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Split into separate files
- - - - -
a39060c4 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Starting on expression parser.
But it hangs. Time for Text.Parsec.Expr
- - - - -
8b402043 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Start integrating the ghc-cpp work
From https://github.com/alanz/ghc-cpp
- - - - -
5fac39d5 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
WIP
- - - - -
0bfb24b5 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Fixup after rebase
- - - - -
dafd4175 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
WIP
- - - - -
a68007a9 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Fixup after rebase, including all tests pass
- - - - -
9a54171d by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Change pragma usage to GHC_CPP from GhcCPP
- - - - -
0ff19e7e by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Some comments
- - - - -
d9f7d801 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Reformat
- - - - -
ff9f25da by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Delete unused file
- - - - -
688f3da2 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Rename module Parse to ParsePP
- - - - -
577c317c by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Clarify naming in the parser
- - - - -
5548fc9b by Alan Zimmerman at 2025-06-06T19:47:32+02:00
WIP. Switching to alex/happy to be able to work in-tree
Since Parsec is not available
- - - - -
b969952e by Alan Zimmerman at 2025-06-06T19:47:32+02: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
- - - - -
f980cdf1 by Alan Zimmerman at 2025-06-06T19:47:32+02: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
```
- - - - -
bf562976 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Rebase, and all tests pass except whitespace for generated parser
- - - - -
bdba7f80 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
More plumbing. Ready for testing tomorrow.
- - - - -
ee9ce4a1 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Proress. Renamed module State from Types
And at first blush it seems to handle preprocessor scopes properly.
- - - - -
406259a6 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Insert basic GHC version macros into parser
__GLASGOW_HASKELL__
__GLASGOW_HASKELL_FULL_VERSION__
__GLASGOW_HASKELL_PATCHLEVEL1__
__GLASGOW_HASKELL_PATCHLEVEL2__
- - - - -
0169fd8c by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Re-sync check-cpp for easy ghci work
- - - - -
acd8d279 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Get rid of warnings
- - - - -
125713f3 by Alan Zimmerman at 2025-06-06T19:47:32+02: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
- - - - -
7135e951 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
WIP. Can crack arguments for #define
Next step it to crack out args in an expansion
- - - - -
5928aacf by Alan Zimmerman at 2025-06-06T19:47:32+02:00
WIP on arg parsing.
- - - - -
3d361824 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Progress. Still screwing up nested parens.
- - - - -
0fea421c by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Seems to work, but has redundant code
- - - - -
f55b3e34 by Alan Zimmerman at 2025-06-06T19:47:32+02:00
Remove redundant code
- - - - -
238e2474 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Reformat
- - - - -
870c5ad0 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Expand args, single pass
Still need to repeat until fixpoint
- - - - -
75e7cf3d by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Fixed point expansion
- - - - -
ed71e9a3 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Sync the playground to compiler
- - - - -
085c91ab by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Working on dumping the GHC_CPP result
But We need to keep the BufSpan in a comment
- - - - -
fe8cefbd by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Keep BufSpan in queued comments in GHC.Parser.Lexer
- - - - -
d99e6f23 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Getting close to being able to print the combined tokens
showing what is in and what is out
- - - - -
f5ef1d2e by Alan Zimmerman at 2025-06-06T19:47:33+02: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
- - - - -
f5953909 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Clean up a bit
- - - - -
4afaa838 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Add -ddump-ghc-cpp option and a test based on it
- - - - -
aed652b1 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Restore Lexer.x rules, we need them for continuation lines
- - - - -
fe56c457 by Alan Zimmerman at 2025-06-06T19:47:33+02: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
- - - - -
a11af951 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Inserts predefined macros. But does not dump properly
Because the cpp tokens have a trailing newline
- - - - -
b2823c2b by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Remove unnecessary LExer rules
We *need* the ones that explicitly match to the end of the line.
- - - - -
24a7a3f2 by Alan Zimmerman at 2025-06-06T19:47:33+02: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.
- - - - -
862fd330 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Reduce duplication in lexer
- - - - -
67c2710d by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Tweaks
- - - - -
8794f19a by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Insert min_version predefined macros into state
The mechanism now works. Still need to flesh out the full set.
- - - - -
3c0463d6 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Trying my alternative pragma syntax.
It works, but dumpGhcCpp is broken, I suspect from the ITcpp token
span update.
- - - - -
925a181c by Alan Zimmerman at 2025-06-06T19:47:33+02: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
- - - - -
7e5fe6b8 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Remove some tracing
- - - - -
b5c50545 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Fix test exes for changes
- - - - -
fdeb0a5d by Alan Zimmerman at 2025-06-06T19:47:33+02:00
For GHC_CPP tests, normalise config-time-based macros
- - - - -
cec6f7b6 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
WIP
- - - - -
2ff2bfef by Alan Zimmerman at 2025-06-06T19:47:33+02:00
WIP again. What is wrong?
- - - - -
e997a82d by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Revert to dynflags for normal not pragma lexing
- - - - -
0d258582 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Working on getting check-exact to work properly
- - - - -
0cbcab20 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Passes CppCommentPlacement test
- - - - -
61a36733 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Starting on exact printing with GHC_CPP
While overriding normal CPP
- - - - -
ad29699f by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Correctly store CPP ignored tokens as comments
By populating the lexeme string in it, based on the bufpos
- - - - -
e7b6f490 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
WIP
- - - - -
7f5e63bd by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Simplifying
- - - - -
2f290b5f by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Update the active state logic
- - - - -
770c4e7f by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Work the new logic into the mainline code
- - - - -
10a36cfa by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Process `defined` operator
- - - - -
4e86dcd2 by Alan Zimmerman at 2025-06-06T19:47:33+02: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.
- - - - -
2b060f4c by Alan Zimmerman at 2025-06-06T19:47:33+02: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.
- - - - -
cbeddbb7 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Process the ! operator in GHC_CPP expressions
- - - - -
62a1cdf2 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Predefine a constant when GHC_CPP is being used.
- - - - -
3788af92 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
WIP
- - - - -
35947829 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Skip lines directly in the lexer when required
- - - - -
4140fe25 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Properly manage location when accepting tokens again
- - - - -
625faa70 by Alan Zimmerman at 2025-06-06T19:47:33+02:00
Seems to be working now, for Example9
- - - - -
5493b718 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Remove tracing
- - - - -
585d58a0 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Fix parsing '*' in block comments
Instead of replacing them with '-'
- - - - -
d3bc7129 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Keep the trailing backslash in a ITcpp token
- - - - -
b9a8319e by Alan Zimmerman at 2025-06-06T19:47:34+02: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
- - - - -
b16bb111 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Replace remaining identifiers with 0 when evaluating
As per the spec
- - - - -
d5c8e1fd by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Snapshot before rebase
- - - - -
cf346aed by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Skip non-processed lines starting with #
- - - - -
9841f18f by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Export generateMacros so we can use it in ghc-exactprint
- - - - -
d6f2ac26 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Fix rebase
- - - - -
266c602c by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Expose initParserStateWithMacrosString
- - - - -
d8e89f7c by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Fix buggy lexer cppSkip
It was skipping all lines, not just ones prefixed by #
- - - - -
5336f478 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Fix evaluation of && to use the correct operator
- - - - -
daefc20c by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Deal with closing #-} at the start of a line
- - - - -
a093485b by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Add the MIN_VERSION_GLASGOW_HASKELL predefined macro
- - - - -
e3b47bc8 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Include MIN_VERSION_GLASGOW_HASKELL in GhcCpp01.stderr
- - - - -
35843de0 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Use a strict map for macro defines
- - - - -
e7a70908 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Process TIdentifierLParen
Which only matters at the start of #define
- - - - -
b36f9349 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Do not provide TIdentifierLParen paren twice
- - - - -
f7b1b482 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Handle whitespace between identifier and '(' for directive only
- - - - -
4ec41015 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Expose some Lexer bitmap manipulation helpers
- - - - -
cd0ee35a by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Deal with line pragmas as tokens
Blows up for dumpGhcCpp though
- - - - -
e4337ea8 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Allow strings delimited by a single quote too
- - - - -
799d8303 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Allow leading whitespace on cpp directives
As per https://timsong-cpp.github.io/cppwp/n4140/cpp#1
- - - - -
29f0bcea by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Implement GHC_CPP undef
- - - - -
35e03bcd by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Sort out expansion of no-arg macros, in a context with args
And make the expansion bottom out, in the case of recursion
- - - - -
05d9569a by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Fix GhcCpp01 test
The LINE pragma stuff works in ghc-exactprint when specifically
setting flag to emit ITline_pragma tokens
- - - - -
a8976147 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Process comments in CPP directives
- - - - -
2e43ba7c by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Correctly lex pragmas with finel #-} on a newline
- - - - -
80b08679 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Do not process CPP-style comments
- - - - -
89fb4245 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Allow cpp-style comments when GHC_CPP enabled
- - - - -
ba293f4f by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Return other pragmas as cpp ignored when GHC_CPP active
- - - - -
65d7cdc8 by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Fix exactprinting default decl
- - - - -
12c64052 by Alan Zimmerman at 2025-06-06T19:47:34+02: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.
- - - - -
245e3d2e by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Tweak testing
- - - - -
4df7fd2c by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Only allow unknown cpp pragmas with # in left margin
- - - - -
1b5e73fc by Alan Zimmerman at 2025-06-06T19:47:34+02:00
Require # against left margin for all GHC_CPP directives
- - - - -
709f50fe by Alan Zimmerman at 2025-06-07T17:17:32+02:00
Fix CPP directives appearing in pragmas
And add a test for error reporting for missing `#if`
- - - - -
242 changed files:
- compiler/GHC.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Parser/Monad.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Config/Parser.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Parser.hs-boot
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/HaddockLex.x
- compiler/GHC/Parser/Header.hs
- compiler/GHC/Parser/Lexer.x
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- + compiler/GHC/Parser/PreProcess.hs
- + compiler/GHC/Parser/PreProcess/Eval.hs
- + compiler/GHC/Parser/PreProcess/Lexer.x
- + compiler/GHC/Parser/PreProcess/Macro.hs
- + compiler/GHC/Parser/PreProcess/ParsePP.hs
- + compiler/GHC/Parser/PreProcess/Parser.y
- + compiler/GHC/Parser/PreProcess/ParserM.hs
- + compiler/GHC/Parser/PreProcess/State.hs
- compiler/GHC/Parser/Utils.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Runtime/Context.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Name/Ppr.hs
- compiler/GHC/Unit/Env.hs
- compiler/GHC/Unit/Home/Graph.hs
- compiler/GHC/Unit/Types.hs
- compiler/ghc.cabal.in
- docs/users_guide/debugging.rst
- docs/users_guide/exts/data_kinds.rst
- docs/users_guide/ghci.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Exception.hs
- ghc/GHCi/UI/Info.hs
- ghc/GHCi/UI/Monad.hs
- ghc/Main.hs
- hadrian/src/Rules/SourceDist.hs
- hadrian/stack.yaml.lock
- libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
- libraries/ghc-internal/src/GHC/Internal/LanguageExtensions.hs
- testsuite/driver/testlib.py
- + testsuite/tests/cmm/should_run/T25601.hs
- + testsuite/tests/cmm/should_run/T25601.stdout
- + testsuite/tests/cmm/should_run/T25601a.cmm
- testsuite/tests/cmm/should_run/all.T
- + testsuite/tests/codeGen/should_run/T26061.hs
- + testsuite/tests/codeGen/should_run/T26061.stdout
- testsuite/tests/codeGen/should_run/all.T
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/driver/T4437.hs
- testsuite/tests/driver/T8526/T8526.stdout
- testsuite/tests/driver/fat-iface/fat014.stdout
- testsuite/tests/driver/json.stderr
- testsuite/tests/driver/json_warn.stderr
- testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr
- testsuite/tests/ghc-api/T11579.hs
- testsuite/tests/ghc-api/T6145.hs
- testsuite/tests/ghc-api/annotations-literals/literals.hs
- testsuite/tests/ghc-api/annotations-literals/parsed.hs
- testsuite/tests/ghc-api/apirecomp001/myghc.hs
- testsuite/tests/ghc-api/fixed-nodes/T1.hs
- + testsuite/tests/ghc-cpp/GhcCpp01.hs
- + testsuite/tests/ghc-cpp/GhcCpp01.stderr
- + testsuite/tests/ghc-cpp/GhcCpp02.hs
- + testsuite/tests/ghc-cpp/all.T
- + testsuite/tests/ghci.debugger/scripts/break031/Makefile
- + testsuite/tests/ghci.debugger/scripts/break031/a/A.hs
- + testsuite/tests/ghci.debugger/scripts/break031/all.T
- + testsuite/tests/ghci.debugger/scripts/break031/b/B.hs
- + testsuite/tests/ghci.debugger/scripts/break031/break031a.script
- + testsuite/tests/ghci.debugger/scripts/break031/break031a.stdout
- + testsuite/tests/ghci.debugger/scripts/break031/break031b.script
- + testsuite/tests/ghci.debugger/scripts/break031/break031b.stderr
- + testsuite/tests/ghci.debugger/scripts/break031/break031b.stdout
- + testsuite/tests/ghci.debugger/scripts/break031/unitA
- + testsuite/tests/ghci.debugger/scripts/break031/unitB
- testsuite/tests/ghci/linking/dyn/T3372.hs
- + testsuite/tests/ghci/prog-mhu001/Makefile
- + testsuite/tests/ghci/prog-mhu001/all.T
- + testsuite/tests/ghci/prog-mhu001/e/E.hs
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001a.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001a.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001b.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001b.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001c.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001c.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001d.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001d.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001e.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001e.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001f.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001f.stdout
- + testsuite/tests/ghci/prog-mhu001/unitE
- + testsuite/tests/ghci/prog-mhu001/unitE-main-is
- + testsuite/tests/ghci/prog-mhu002/Makefile
- + testsuite/tests/ghci/prog-mhu002/a/A.hs
- + testsuite/tests/ghci/prog-mhu002/all.T
- + testsuite/tests/ghci/prog-mhu002/b/B.hs
- + testsuite/tests/ghci/prog-mhu002/c/C.hs
- + testsuite/tests/ghci/prog-mhu002/d/Main.hs
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002a.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002a.stderr
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002a.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002b.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002b.stderr
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002b.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002c.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002c.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002d.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002d.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002e.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002e.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002f.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002f.stdout
- + testsuite/tests/ghci/prog-mhu002/unitA
- + testsuite/tests/ghci/prog-mhu002/unitB
- + testsuite/tests/ghci/prog-mhu002/unitC
- + testsuite/tests/ghci/prog-mhu002/unitD
- + testsuite/tests/ghci/prog-mhu003/Makefile
- + testsuite/tests/ghci/prog-mhu003/a/A.hs
- + testsuite/tests/ghci/prog-mhu003/all.T
- + testsuite/tests/ghci/prog-mhu003/b/Foo.hs
- + testsuite/tests/ghci/prog-mhu003/c/C.hs
- + testsuite/tests/ghci/prog-mhu003/d/Foo.hs
- + testsuite/tests/ghci/prog-mhu003/prog-mhu003.script
- + testsuite/tests/ghci/prog-mhu003/prog-mhu003.stderr
- + testsuite/tests/ghci/prog-mhu003/prog-mhu003.stdout
- + testsuite/tests/ghci/prog-mhu003/unitA
- + testsuite/tests/ghci/prog-mhu003/unitB
- + testsuite/tests/ghci/prog-mhu003/unitC
- + testsuite/tests/ghci/prog-mhu003/unitD
- + testsuite/tests/ghci/prog-mhu004/Makefile
- + testsuite/tests/ghci/prog-mhu004/a/Foo.hs
- + testsuite/tests/ghci/prog-mhu004/all.T
- + testsuite/tests/ghci/prog-mhu004/b/Foo.hs
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004a.script
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004a.stderr
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004a.stdout
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004b.script
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004b.stdout
- + testsuite/tests/ghci/prog-mhu004/unitA
- + testsuite/tests/ghci/prog-mhu004/unitB
- testsuite/tests/ghci/prog010/ghci.prog010.script
- testsuite/tests/ghci/prog018/prog018.stdout
- + testsuite/tests/ghci/prog020/A.hs
- + testsuite/tests/ghci/prog020/B.hs
- + testsuite/tests/ghci/prog020/Makefile
- + testsuite/tests/ghci/prog020/all.T
- + testsuite/tests/ghci/prog020/ghci.prog020.script
- + testsuite/tests/ghci/prog020/ghci.prog020.stderr
- + testsuite/tests/ghci/prog020/ghci.prog020.stdout
- testsuite/tests/ghci/scripts/T13869.stdout
- testsuite/tests/ghci/scripts/T13997.stdout
- testsuite/tests/ghci/scripts/T17669.stdout
- testsuite/tests/ghci/scripts/T18330.stdout
- testsuite/tests/ghci/scripts/T1914.stdout
- testsuite/tests/ghci/scripts/T20217.stdout
- testsuite/tests/ghci/scripts/T20587.stdout
- testsuite/tests/ghci/scripts/T21110.stderr
- testsuite/tests/ghci/scripts/T6105.stdout
- testsuite/tests/ghci/scripts/T8042.stdout
- testsuite/tests/ghci/scripts/T8042recomp.stdout
- testsuite/tests/ghci/scripts/ghci024.stdout
- testsuite/tests/ghci/scripts/ghci024.stdout-mingw32
- testsuite/tests/ghci/scripts/ghci058.script
- testsuite/tests/ghci/should_run/TopEnvIface.stdout
- testsuite/tests/interface-stability/template-haskell-exports.stdout
- + testsuite/tests/printer/CppCommentPlacement.hs
- testsuite/tests/quasiquotation/T7918.hs
- + utils/check-cpp/.ghci
- + utils/check-cpp/.gitignore
- + utils/check-cpp/Eval.hs
- + utils/check-cpp/Example1.hs
- + utils/check-cpp/Example10.hs
- + utils/check-cpp/Example11.hs
- + utils/check-cpp/Example12.hs
- + utils/check-cpp/Example13.hs
- + utils/check-cpp/Example2.hs
- + utils/check-cpp/Example3.hs
- + utils/check-cpp/Example4.hs
- + utils/check-cpp/Example5.hs
- + utils/check-cpp/Example6.hs
- + utils/check-cpp/Example7.hs
- + utils/check-cpp/Example8.hs
- + utils/check-cpp/Example9.hs
- + utils/check-cpp/Lexer.x
- + utils/check-cpp/Macro.hs
- + utils/check-cpp/Main.hs
- + utils/check-cpp/ParsePP.hs
- + utils/check-cpp/ParseSimulate.hs
- + utils/check-cpp/Parser.y
- + utils/check-cpp/ParserM.hs
- + utils/check-cpp/PreProcess.hs
- + utils/check-cpp/README.md
- + utils/check-cpp/State.hs
- + utils/check-cpp/run.sh
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Parsers.hs
- utils/check-exact/Preprocess.hs
- utils/check-exact/Utils.hs
- utils/haddock/haddock-api/resources/html/Linuwial.std-theme/linuwial.css
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/haddock-library/src/Documentation/Haddock/Parser.hs
- utils/haddock/haddock-library/test/Documentation/Haddock/ParserSpec.hs
- utils/haddock/html-test/ref/Bug1004.html
- utils/haddock/html-test/ref/Bug548.html
- utils/haddock/html-test/ref/Bug973.html
- utils/haddock/html-test/ref/Hash.html
- utils/haddock/html-test/ref/ImplicitParams.html
- utils/haddock/html-test/ref/Instances.html
- utils/haddock/html-test/ref/PatternSyns.html
- utils/haddock/html-test/ref/TypeOperators.html
- utils/haddock/html-test/src/TypeOperators.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/32bc5dfbbd32bcf249ffebe01ac7e74...
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/32bc5dfbbd32bcf249ffebe01ac7e74...
You're receiving this email because of your account on gitlab.haskell.org.