Date: Sat, 18 Jun 2022 15:09:41 +0000 From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 264730] clang++ -fmodules fails when using stdout from cstdio: error: declaration of '__stdoutp' must be imported from module 'std.iosfwd' before it is required Message-ID: <bug-264730-29464-nr1I3LboR1@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-264730-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-264730-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264730 --- Comment #3 from Micha=C5=82 G=C3=B3rny <mgorny@gentoo.org> --- Well, it wasn't my choice, really ;-). Apparently use of gmodules was enab= led in LLDB's test suite on FreeBSD when the relevant tests were added =E2=80= =94 i.e. in 2016. Unless I'm missing something, we've been doing some testing with them since then. I'm guessing there were some recent changes to clang or libc++ that made them more strict. Ah, sorry, I don't think the 'wchar.h' part is actually the problem =E2=80= =94 I think it just blames the wrong header. The underlying problem is that the stdout/stderr/stdin macros aren't visible from <cstdio>. I know very little about modules myself but FWICS the purpose here is to av= oid relying on indirect includes. I think textual header breaks that, i.e. the following test program should fail: ``` #include <cstdio> int main() { FILE *f; } ``` With the original header variant, it fails as expected (just blames the wro= ng header): ``` $ clang++ -fmodules test.cxx=20 test.cxx:4:3: error: missing '#include <wchar.h>'; 'FILE' must be declared before it is used FILE *f; ^ /usr/include/wchar.h:109:24: note: declaration here is not visible typedef struct __sFILE FILE; ^ 1 error generated. ``` Changing `header` to `textual header` makes it build, so I think that goes against the intent. I suppose there must be a better way of solving stdout/stderr/stdin problem. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-264730-29464-nr1I3LboR1>