[Mesa-dev] [PATCH 3/8] glapi/check_table: Remove 'extern "C"' block

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 23 19:04:34 UTC 2017


On 20 November 2017 at 23:12, Dylan Baker <dylan at pnwbakers.com> wrote:
> This doesn't actually accomplish what it's meant to do, as extern C
> doesn't undefine __cplusplus, so the included headers define a template
> (because __cplusplus is defined), but then that code is in an 'extern
> "C"' block, and explosion.
>
The commit does sound a bit off, admittedly I don't fully grok what
you're trying to say.

The extern "C" { } construct annotates anything within as if it were a
normal C code. Thus functions will have the C linkage (otherwise
they'll have the C++ mangling) and structs are using the C rules.
So if you have a C++ header further down the chain it will be
considered as C and hell will break loose.

This patch is correct, just sent a fix for glapitable.h, while glapi.h
was handled with d38839a498b38b745f5bdf6b96fbafa2792670be.

As-is "struct _glapi_table" will be interpret as C++ one, which may
not have the same guarantees about sizeof and pointer arithmetic that
we're using in the test.

Hope the above provides some inspiration towards a better commit message.

Thanks
Emil


More information about the mesa-dev mailing list