[Git][ghc/ghc][wip/remove-legacy-define-in-foreign-stub] compiler: remove unused CPP code in foreign stub
Cheng Shao pushed to branch wip/remove-legacy-define-in-foreign-stub at Glasgow Haskell Compiler / GHC
Commits:
05e25647 by Cheng Shao at 2025-12-10T12:27:13+01:00
compiler: remove unused CPP code in foreign stub
This patch removes unused CPP code in the generated foreign stub:
- `#define IN_STG_CODE 0` is not needed, since `Rts.h` already
includes this definition
- The `if defined(__cplusplus)` code paths are not needed in the `.c`
file, since we don't generate C++ stubs and don't include C++
headers in our stubs. But it still needs to be present in the `.h`
header since it might be later included into C++ source files.
- - - - -
1 changed file:
- compiler/GHC/Driver/CodeOutput.hs
Changes:
=====================================
compiler/GHC/Driver/CodeOutput.hs
=====================================
@@ -329,15 +329,8 @@ outputForeignStubs logger tmpfs dflags unit_state mod location stubs
stub_c_file_exists
<- outputForeignStubs_help stub_c stub_c_output_w
- ("#define IN_STG_CODE 0\n" ++
- "#include
participants (1)
-
Cheng Shao (@TerrorJack)