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

Dylan Baker dylan at pnwbakers.com
Fri Nov 24 00:38:10 UTC 2017


Quoting Emil Velikov (2017-11-23 11:04:34)
> 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

I think that I put the wrong commit message on this (or another change has made
this commit message non-sense). Essentially what I was seeing was one of the
headers included had:

#ifdef __cplusplus
template ...
#endif

Which obviously doesn't work inside an extern "C".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171123/e12035cf/attachment.sig>


More information about the mesa-dev mailing list