www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22622] New: C file before D file on the command line causes

https://issues.dlang.org/show_bug.cgi?id=22622

          Issue ID: 22622
           Summary: C file before D file on the command line causes build
                    errors from core.stdc.stdio
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser airmail.cc

---
% echo '// empty' >empty.c
% echo 'import core.stdc.stdio; void main(){}' >main.d
% dmd empty.c main.d
---

in english:
1. create an empty C file (or one with any contents that compiles)
2. create a D file that imports `core.stdc.stdio`
3. run dmd with the C file before the D file on the command line

output:

---
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1256): Error:
function `core.stdc.stdio.vfprintf` `pragma(printf)` functions must be
`extern(C) int vfprintf([parameters...], const(char)*, va_list)`
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1259): Error:
function `core.stdc.stdio.vfscanf` `pragma(scanf)` functions must be `extern(C)
int vfscanf([parameters...], const(char)*, va_list)`
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1262): Error:
function `core.stdc.stdio.vsprintf` `pragma(printf)` functions must be
`extern(C) int vsprintf([parameters...], const(char)*, va_list)`
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1265): Error:
function `core.stdc.stdio.vsscanf` `pragma(scanf)` functions must be `extern(C)
int vsscanf([parameters...], const(char)*, va_list)`
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1268): Error:
function `core.stdc.stdio.vprintf` `pragma(printf)` functions must be
`extern(C) int vprintf([parameters...], const(char)*, va_list)`
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1271): Error:
function `core.stdc.stdio.vscanf` `pragma(scanf)` functions must be `extern(C)
int vscanf([parameters...], const(char)*, va_list)`
/opt/dmd2/linux/bin64/../../src/druntime/import/core/stdc/stdio.d(1485): Error:
function `core.stdc.stdio.vsnprintf` `pragma(printf)` functions must be
`extern(C) int vsnprintf([parameters...], const(char)*, va_list)`
---

this is new in v2.098.1, it worked without errors in v2.098.0 and it affects
current master (e2c591103a28ddb68d4a11de74c6ceed976e3068)

i ran "digger bisect" (good="master   v2.098.0", bad="master") and it returned
this merge commit: https://github.com/dlang/dmd/pull/13444

--
Dec 22 2021