Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jun 2022 15:48:13 +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-X8ZdxaHjdp@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 #4 from Dimitry Andric <dim@FreeBSD.org> ---
(In reply to Micha=C5=82 G=C3=B3rny from comment #3)
Well libc++'s <cstdio> simply includes <stdio.h>, so whatever applies to the
latter must also apply to the former, I think?

On e.g. macOS, stdio.h is simpler with respect to __stdoutp and friends:

#include <_stdio.h>

__BEGIN_DECLS
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
__END_DECLS

On Linux with glibc, there are no tricks with __, they just declare:

/* Standard streams.  */
extern FILE *stdin;             /* Standard input stream.  */
extern FILE *stdout;            /* Standard output stream.  */
extern FILE *stderr;            /* Standard error output stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin
#define stdout stdout
#define stderr stderr

but there are various other defines that use _need_this and _need_that.

As far as I understand the modules system, this looks like one of the as-of=
-yet
unsolved problems in modules in general? I.e. should all system headers be
rewritten to "support" -fmodules? I don't think that is going to happen on =
many
operating systems..

--=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-X8ZdxaHjdp>