[Mesa-dev] [PATCH 10/11] gallium: do not wrap header inclusion in extern "C"

Jose Fonseca jfonseca at vmware.com
Tue Nov 24 12:16:23 PST 2015


On 24/11/15 18:24, Emil Velikov wrote:
> On 24 November 2015 at 17:08, Jose Fonseca <jfonseca at vmware.com> wrote:
>> On 24/11/15 16:29, Emil Velikov wrote:
>>>
>>> From: Emil Velikov <emil.velikov at collabora.com>
>>>
>>> Add one missing extern C guard within include/pipe/p_video_enums.h, and
>>> remove the wrapping throughout gallium.
>>>
>>> On Haiku one could even use the gallium debug_printf() although
>>> that's another topic.
>>>
>>> Cc: Jose Fonseca <jfonseca at vmware.com>
>>> Cc: Brian Paul <brianp at vmware.com>
>>> Cc: Alexander von Gluck IV <kallisti5 at unixzen.com>
>>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>>> ---
>>>    src/gallium/auxiliary/tgsi/tgsi_sanity.h | 4 ++--
>>>    src/gallium/auxiliary/tgsi/tgsi_text.h   | 4 ++--
>>>    src/gallium/auxiliary/util/dbghelp.h     | 7 +++----
>>>    src/gallium/auxiliary/util/u_debug.h     | 8 +++++---
>>>    src/gallium/auxiliary/util/u_draw_quad.h | 3 +--
>>>    src/gallium/auxiliary/util/u_helpers.h   | 4 ++--
>>>    src/gallium/auxiliary/util/u_video.h     | 8 ++++----
>>>    src/gallium/include/pipe/p_format.h      | 4 ++--
>>>    src/gallium/include/pipe/p_video_codec.h | 4 ++--
>>>    src/gallium/include/pipe/p_video_enums.h | 8 ++++++++
>>>    10 files changed, 31 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.h
>>> b/src/gallium/auxiliary/tgsi/tgsi_sanity.h
>>> index 1ff7874..b78d1ab 100644
>>> --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.h
>>> +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.h
>>> @@ -28,12 +28,12 @@
>>>    #ifndef TGSI_SANITY_H
>>>    #define TGSI_SANITY_H
>>>
>>> +#include "pipe/p_compiler.h"
>>> +
>>>    #if defined __cplusplus
>>>    extern "C" {
>>>    #endif
>>>
>>> -#include "pipe/p_compiler.h"
>>> -
>>>    struct tgsi_token;
>>>
>>>    /* Check the given token stream for errors and common mistakes.
>>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.h
>>> b/src/gallium/auxiliary/tgsi/tgsi_text.h
>>> index 6a306e6..a345657 100644
>>> --- a/src/gallium/auxiliary/tgsi/tgsi_text.h
>>> +++ b/src/gallium/auxiliary/tgsi/tgsi_text.h
>>> @@ -28,12 +28,12 @@
>>>    #ifndef TGSI_TEXT_H
>>>    #define TGSI_TEXT_H
>>>
>>> +#include "pipe/p_compiler.h"
>>> +
>>>    #if defined __cplusplus
>>>    extern "C" {
>>>    #endif
>>>
>>> -#include "pipe/p_compiler.h"
>>> -
>>>    struct tgsi_token;
>>>
>>>    boolean
>>> diff --git a/src/gallium/auxiliary/util/dbghelp.h
>>> b/src/gallium/auxiliary/util/dbghelp.h
>>> index bc7c53c..b78e634 100644
>>> --- a/src/gallium/auxiliary/util/dbghelp.h
>>> +++ b/src/gallium/auxiliary/util/dbghelp.h
>>> @@ -6,6 +6,9 @@
>>>    #ifndef _DBGHELP_
>>>    #define _DBGHELP_
>>>
>>> +#include <pshpack4.h>
>>> +#include <poppack.h>
>>
>>
>> The poppack.h has to be moved to after
>>
>>     #ifdef __cplusplus
>>     }
>>     #endif
>>
>> These push/pop pack headers, have special pragmas that change the packing of
>> structures declared between them.
>>
> Seems that this patch adds new packing for enums and structs like
> IMAGEHLP_SYMBOL_TYPE_INFO and TI_FINDCHILDREN_PARAMS. I take it that,
> unlike the already packed ones there are used only internally, and the
> new behaviour won't be an issue ?

You're right: these includes should be left where they were.

These are really special -- they are guaranteed to not have any any C decls:

$ cat /usr/i686-w64-mingw32/include/pshpack4.h
/**
  * This file has no copyright assigned and is placed in the Public Domain.
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this 
package.
  */
#if !(defined(lint) || defined(RC_INVOKED))
#pragma pack(push,4)
#endif
$ cat /usr/i686-w64-mingw32/include/poppack.h
/**
  * This file has no copyright assigned and is placed in the Public Domain.
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this 
package.
  */
#if !(defined(lint) || defined(RC_INVOKED))
#pragma pack(pop)
#endif



Jose



More information about the mesa-dev mailing list