PDA

View Full Version : glcorearb.h contains invalid code in C++



socantre
10-02-2014, 08:42 AM
In C++ it is illegal to include standard library headers inside an extern "C" context:


[using.headers]p3: "A translation unit shall include a header only outside of any external declaration or definition, and shall include the header lexically before the first reference in that translation unit to any of the entities declared in that header. No diagnostic is required."

Normally this error is not reported by the compiler and may not cause any other problems, and so it sneaks into codebases. However, with the clang compiler's support for modules being far enough along I tried flipping this compiler feature on for a small project, and under this mode the compiler does catch this error. I got these diagnostics:



glcorearb.h:616:1: error: import of C++ module 'Darwin.C.stddef' appears within extern "C" language linkage specification
#include <stddef.h>
^
glcorearb.h:5:1: note: extern "C" language linkage specification begins here
extern "C" {
^
glcorearb.h:1517:1: error: import of C++ module 'Darwin.C.inttypes' appears within extern "C" language linkage specification
#include <inttypes.h>
^
glcorearb.h:5:1: note: extern "C" language linkage specification begins here
extern "C" {
^


So my question is really, where can I report this error so that the official header, which platform vendors are not supposed to modify, can be fixed to comply with the C++ spec?

You can find further discussion of the issue and modules on the compiler mailing list thread:

lists.cs.uiuc.edu/pipermail/cfe-dev/2014-October/039394.html

(I'm not allowed to post links, so you'll just have to copy/paste)

carsten neumann
10-03-2014, 04:06 AM
Sounds like a case for the khronos bugzilla (https://www.khronos.org/bugzilla/), product "OpenGL" component "Registry" (?).

socantre
10-03-2014, 12:10 PM
Thanks. Here's the bug I filed: https://www.khronos.org/bugzilla/show_bug.cgi?id=1236