[Mesa-dev] [PATCH 01/11] mesa: put extern "C" in header files
Brian Paul
brianp at vmware.com
Tue Dec 16 06:49:47 PST 2014
On 12/16/2014 04:57 AM, Jose Fonseca wrote:
> On 16/12/14 00:20, Brian Paul wrote:
>> ---
>> src/mesa/main/enums.h | 11 +++++++++++
>> src/mesa/main/samplerobj.h | 9 +++++++++
>> src/mesa/main/texenvprogram.h | 11 +++++++++++
>> src/mesa/main/texobj.h | 10 ++++++++++
>> 4 files changed, 41 insertions(+)
>>
>> diff --git a/src/mesa/main/enums.h b/src/mesa/main/enums.h
>> index 36c053d..66bdd53 100644
>> --- a/src/mesa/main/enums.h
>> +++ b/src/mesa/main/enums.h
>> @@ -37,6 +37,11 @@
>> #define _ENUMS_H_
>>
>>
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +
>> extern const char *_mesa_lookup_enum_by_nr( int nr );
>>
>> /* Get the name of an enum given that it is a primitive type. Avoids
>> @@ -44,4 +49,10 @@ extern const char *_mesa_lookup_enum_by_nr( int nr );
>> */
>> const char *_mesa_lookup_prim_by_nr( unsigned nr );
>>
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +
>> #endif
>> diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h
>> index 7d80b38..1bb3193 100644
>> --- a/src/mesa/main/samplerobj.h
>> +++ b/src/mesa/main/samplerobj.h
>> @@ -27,6 +27,11 @@
>> #ifndef SAMPLEROBJ_H
>> #define SAMPLEROBJ_H
>>
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +
>> struct dd_function_table;
>>
>> static inline struct gl_sampler_object *
>> @@ -103,4 +108,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler,
>> GLenum pname, GLint *params);
>> void GLAPIENTRY
>> _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint
>> *params);
>>
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> #endif /* SAMPLEROBJ_H */
>> diff --git a/src/mesa/main/texenvprogram.h
>> b/src/mesa/main/texenvprogram.h
>> index 15ab31a..11439f1 100644
>> --- a/src/mesa/main/texenvprogram.h
>> +++ b/src/mesa/main/texenvprogram.h
>> @@ -27,9 +27,20 @@
>> #define TEXENVPROGRAM_H
>>
>>
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +
>> struct gl_context;
>>
>> extern struct gl_shader_program *
>> _mesa_get_fixed_func_fragment_program(struct gl_context *ctx);
>>
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +
>> #endif
>> diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
>> index b1b7a30..efcd766 100644
>> --- a/src/mesa/main/texobj.h
>> +++ b/src/mesa/main/texobj.h
>> @@ -38,6 +38,11 @@
>> #include "samplerobj.h"
>>
>>
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +
>> /**
>> * \name Internal functions
>> */
>> @@ -212,4 +217,9 @@ _mesa_InvalidateTexImage(GLuint texture, GLint
>> level);
>> /*@}*/
>>
>>
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +
>> #endif
>>
>
> Thanks for doing this, Brian. I was about to do it myself.
>
>
> Series is Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
>
>
> Is it now possible to add my "no_extern_c.h" commit without introducing
> errors?
Probably not. Doing so works with my llvmpipe/svga builds but I haven't
touched the i965 code (and other drivers) which still have extern "C"
around #includes.
git grep 'extern "C" {' | grep cpp
shows quite a few instances of this remaining.
-Brian
More information about the mesa-dev
mailing list