Skip ModuleInfo generation for C files (incl. *.i)

Fixes dmd-testsuite's compilable/testcomplex.i.
This commit is contained in:
Martin Kinkelin 2023-07-16 18:36:11 +02:00
parent 30bc9c65c8
commit 49bb2ac590
3 changed files with 8 additions and 3 deletions

View file

@ -433,9 +433,11 @@ void codegenModule(IRState *irs, Module *m) {
// Skip emission of all the additional module metadata if: // Skip emission of all the additional module metadata if:
// a) the -betterC switch is on, // a) the -betterC switch is on,
// b) requested explicitly by the user via pragma(LDC_no_moduleinfo), or if // b) requested explicitly by the user via pragma(LDC_no_moduleinfo),
// c) there's no ModuleInfo declaration. // c) there's no ModuleInfo declaration, or if
if (global.params.useModuleInfo && !m->noModuleInfo && Module::moduleinfo) { // d) the module is a C file.
if (global.params.useModuleInfo && !m->noModuleInfo && Module::moduleinfo &&
m->filetype != FileType::c) {
// generate ModuleInfo // generate ModuleInfo
registerModuleInfo(m); registerModuleInfo(m);
} }

View file

@ -1,3 +1,5 @@
// REQUIRED_ARGS: -defaultlib=
# 1 "runnable/extra-files/cstuff3.c" # 1 "runnable/extra-files/cstuff3.c"
# 1 "<built-in>" # 1 "<built-in>"
# 1 "<command-line>" # 1 "<command-line>"

View file

@ -1,4 +1,5 @@
/* EXTRA_SOURCES: imports/imp23014.i /* EXTRA_SOURCES: imports/imp23014.i
* REQUIRED_ARGS: -defaultlib=
*/ */
static _Thread_local int tmp; static _Thread_local int tmp;