[Git][ghc/ghc][master] clarify Note [Preproccesing invocations]
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Apr 1 00:04:36 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
efab3649 by brandon s allbery kf8nh at 2024-03-31T20:04:01-04:00
clarify Note [Preproccesing invocations]
- - - - -
1 changed file:
- compiler/GHC/SysTools/Cpp.hs
Changes:
=====================================
compiler/GHC/SysTools/Cpp.hs
=====================================
@@ -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
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/efab3649b685d92b1856a62532b343ef70777612
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/efab3649b685d92b1856a62532b343ef70777612
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240331/4946d68c/attachment-0001.html>
More information about the ghc-commits
mailing list