[Git][ghc/ghc][master] 2 commits: Add the cmm_cpp_is_gcc predicate to the testsuite

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue May 7 18:41:24 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
4d59abf2 by Arsen Arsenović at 2024-05-07T14:40:24-04:00
Add the cmm_cpp_is_gcc predicate to the testsuite

A future C-- test called T24474-cmm-override-g0 relies on the
GCC-specific behaviour of -g3 implying -dD, which, in turn, leads to it
emitting #defines past the preprocessing stage.  Clang, at least, does
not do this, so the test would fail if ran on Clang.

As the behaviour here being tested is ``-optCmmP-g3'' undoing effects of
the workaround we apply as a fix for bug #24474, and the workaround was
for GCC-specific behaviour, the test needs to be marked as fragile on
other compilers.

- - - - -
25b0b404 by Arsen Arsenović at 2024-05-07T14:40:24-04:00
Split out the C-- preprocessor, and make it pass -g0

Previously, C-- was processed with the C preprocessor program.  This
means that it inherited flags passed via -optc.  A flag that is somewhat
often passed through -optc is -g.  At certain -g levels (>=2), GCC
starts emitting defines *after* preprocessing, for the purposes of
debug info generation.  This is not useful for the C-- compiler, and, in
fact, causes lexer errors.  We can suppress this effect (safely, if
supported) via -g0.

As a workaround, in older versions of GCC (<=10), GCC only emitted
defines if a certain set of -g*3 flags was passed.  Newer versions check
the debug level.  For the former, we filter out those -g*3 flags and,
for the latter, we specify -g0 on top of that.

As a compatible and effective solution, this change adds a C--
preprocessor distinct from the C compiler and preprocessor, but that
keeps its flags.  The command line produced for C-- preprocessing now
looks like:

  $pgmCmmP $optCs_without_g3 $g0_if_supported $optCmmP

Closes: https://gitlab.haskell.org/ghc/ghc/-/issues/24474

- - - - -


30 changed files:

- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Recomp/Flags.hs
- compiler/GHC/Settings.hs
- compiler/GHC/Settings/IO.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/SysTools/Tasks.hs
- configure.ac
- distrib/configure.ac.in
- docs/users_guide/phases.rst
- hadrian/bindist/Makefile
- hadrian/bindist/config.mk.in
- hadrian/cfg/default.host.target.in
- hadrian/cfg/default.target.in
- hadrian/src/Rules/Generate.hs
- + m4/fp_cmm_cpp_cmd_with_args.m4
- m4/fp_settings.m4
- m4/fp_setup_windows_toolchain.m4
- m4/ghc_toolchain.m4
- m4/prep_target_file.m4
- testsuite/config/ghc
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- + testsuite/tests/cmm/should_compile/T24474-cmm-gets-c-opts.cmm
- + testsuite/tests/cmm/should_compile/T24474-cmm-opt-order.cmm
- + testsuite/tests/cmm/should_compile/T24474.cmm
- testsuite/tests/cmm/should_compile/all.T
- + testsuite/tests/cmm/should_fail/T24474-cmm-override-g0.cmm
- + testsuite/tests/cmm/should_fail/T24474-cmm-override-g0.stderr
- + testsuite/tests/cmm/should_fail/all.T


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3b51995c158fe19d48839b92cf1ff78ce7825ce4...25b0b40467d0a12601497117c0ad14e1fcab0b74

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3b51995c158fe19d48839b92cf1ff78ce7825ce4...25b0b40467d0a12601497117c0ad14e1fcab0b74
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/20240507/84b63d63/attachment.html>


More information about the ghc-commits mailing list