Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reinier Maas
GHC
Commits
efab3649
Commit
efab3649
authored
11 months ago
by
Brandon S. Allbery
Committed by
Marge Bot
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
clarify Note [Preproccesing invocations]
parent
00d3ecf0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/GHC/SysTools/Cpp.hs
+16
-1
16 additions, 1 deletion
compiler/GHC/SysTools/Cpp.hs
with
16 additions
and
1 deletion
compiler/GHC/SysTools/Cpp.hs
+
16
−
1
View file @
efab3649
...
...
@@ -63,7 +63,22 @@ underlying program (the C compiler), the set of flags passed determines the
behaviour of the preprocessor, and Cpp and HsCpp behave differently.
Specifically, we rely on "traditional" (pre-standard) preprocessing semantics
(which most compilers expose via the `-traditional` flag) when preprocessing
Haskell source. This avoids, e.g., the preprocessor removing C-style comments.
Haskell source. This avoids the following situations:
* Removal of C-style comments, which are not comments in Haskell but valid
operators;
* Errors due to an ANSI C preprocessor lexing the source and failing on
names with single quotes (TH quotes, ticked promoted constructors,
names with primes in them).
Both of those cases may be subtle: gcc and clang permit C++-style //
comments in C code, and Data.Array and Data.Vector both export a //
operator whose type is such that a removed "comment" may leave code that
typechecks but does the wrong thing. Another example is that, since ANSI
C permits long character constants, an expression involving multiple
functions with primes in their names may not expand macros properly when
they occur between the primed functions.
-}
-- | Run either the Haskell preprocessor or the C preprocessor, as per the
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment