This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/24998] New: #includes included inside extern C {} regions
- From: "nathan at acm dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 14 Sep 2019 16:17:55 +0000
- Subject: [Bug stdio/24998] New: #includes included inside extern C {} regions
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=24998
Bug ID: 24998
Summary: #includes included inside extern C {} regions
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: stdio
Assignee: unassigned at sourceware dot org
Reporter: nathan at acm dot org
Target Milestone: ---
This is not just stdio, but where I fell over it. stdio.h contains (near the
start):
__BEGIN_DECLS // extern C {
#define __need_size_t
#define __need_NULL
#include <stddef.h>
....
The stddef.h has its own extern C protection for C++ inclusion, so doesn't need
to be there. At the moment that is harmless.
However C++20 will have modules, which includes the following 2 exciting
features:
1) header-units
2) include translation
#1 is a mechanism by which header-files can be compiled to a header-unit (there
are some restrictions on what's acceptable). There's no reason why the C
headers could not be processed this way.
#2 turns #include directives into imports of header-units (via an
implementation-defined mechanism). Imports are intended to be a top-level
construct, and cannot occur inside an extern "C" region.
So, <stddef.h> could be a header-unit, the #include could be translated to a
header unit, and then we find the interesting case that it's inside an extern C
region.
This is syntactically disallowed. I do permit it as an extension, but there's
another problem, in that I need to record somewhere in the header-unit that it
only provides c-linkage entities. I'd rather not do that :)
I can add a warning to G++ such that it tells you when a #include is inside an
extern "C" region, which will help locate the troublesome includes. See gcc
BZ 91770
--
You are receiving this mail because:
You are on the CC list for the bug.