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

Emil Velikov emil.l.velikov at gmail.com
Tue Nov 24 08:29:27 PST 2015


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>
+
 #ifdef _WIN64
 #ifndef _IMAGEHLP64
 #define _IMAGEHLP64
@@ -897,8 +900,6 @@ extern "C" {
 #define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK
 #define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL
 
-#include <pshpack4.h>
-
 #define MINIDUMP_SIGNATURE ('PMDM')
 #define MINIDUMP_VERSION (42899)
   typedef DWORD RVA;
@@ -1257,8 +1258,6 @@ extern "C" {
   BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
   BOOL WINAPI MiniDumpReadDumpStream(PVOID BaseOfDump,ULONG StreamNumber,PMINIDUMP_DIRECTORY *Dir,PVOID *StreamPointer,ULONG *StreamSize);
 
-#include <poppack.h>
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index aaf223c..9319425 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -39,6 +39,11 @@
 #define U_DEBUG_H_
 
 
+#if defined(PIPE_OS_HAIKU)
+/* Haiku provides debug_printf in libroot with OS.h */
+#include <OS.h>
+#endif
+
 #include "os/os_misc.h"
 
 #include "pipe/p_format.h"
@@ -94,9 +99,6 @@ debug_printf(const char *format, ...)
    (void) format; /* silence warning */
 #endif
 }
-#else /* is Haiku */
-/* Haiku provides debug_printf in libroot with OS.h */
-#include <OS.h>
 #endif
 
 
diff --git a/src/gallium/auxiliary/util/u_draw_quad.h b/src/gallium/auxiliary/util/u_draw_quad.h
index b298ef2..6553d5d 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.h
+++ b/src/gallium/auxiliary/util/u_draw_quad.h
@@ -32,6 +32,7 @@
 #include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 
+#include "util/u_draw.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,8 +41,6 @@ extern "C" {
 struct pipe_resource;
 struct cso_context;
 
-#include "util/u_draw.h"
-
 extern void 
 util_draw_vertex_buffer(struct pipe_context *pipe, struct cso_context *cso,
                         struct pipe_resource *vbuf, uint vbuf_slot,
diff --git a/src/gallium/auxiliary/util/u_helpers.h b/src/gallium/auxiliary/util/u_helpers.h
index f25f280..a9a53e4 100644
--- a/src/gallium/auxiliary/util/u_helpers.h
+++ b/src/gallium/auxiliary/util/u_helpers.h
@@ -28,12 +28,12 @@
 #ifndef U_HELPERS_H
 #define U_HELPERS_H
 
+#include "pipe/p_state.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "pipe/p_state.h"
-
 void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
                                   uint32_t *enabled_buffers,
                                   const struct pipe_vertex_buffer *src,
diff --git a/src/gallium/auxiliary/util/u_video.h b/src/gallium/auxiliary/util/u_video.h
index ddc0021..9196afc 100644
--- a/src/gallium/auxiliary/util/u_video.h
+++ b/src/gallium/auxiliary/util/u_video.h
@@ -28,10 +28,6 @@
 #ifndef U_VIDEO_H
 #define U_VIDEO_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "pipe/p_defines.h"
 #include "pipe/p_video_enums.h"
 
@@ -40,6 +36,10 @@ extern "C" {
 #include "util/u_debug.h"
 #include "util/u_math.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 static inline enum pipe_video_format
 u_reduce_video_profile(enum pipe_video_profile profile)
 {
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index d9c9f9b..820002c 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -29,12 +29,12 @@
 #ifndef PIPE_FORMAT_H
 #define PIPE_FORMAT_H
 
+#include "p_config.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "p_config.h"
-
 /**
  * Formats for textures, surfaces and vertex data
  */
diff --git a/src/gallium/include/pipe/p_video_codec.h b/src/gallium/include/pipe/p_video_codec.h
index 196d00b..b5575ab 100644
--- a/src/gallium/include/pipe/p_video_codec.h
+++ b/src/gallium/include/pipe/p_video_codec.h
@@ -28,12 +28,12 @@
 #ifndef PIPE_VIDEO_CONTEXT_H
 #define PIPE_VIDEO_CONTEXT_H
 
+#include "pipe/p_video_state.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "pipe/p_video_state.h"
-
 struct pipe_screen;
 struct pipe_surface;
 struct pipe_macroblock;
diff --git a/src/gallium/include/pipe/p_video_enums.h b/src/gallium/include/pipe/p_video_enums.h
index 9a20146..aff7842 100644
--- a/src/gallium/include/pipe/p_video_enums.h
+++ b/src/gallium/include/pipe/p_video_enums.h
@@ -28,6 +28,10 @@
 #ifndef PIPE_VIDEO_ENUMS_H
 #define PIPE_VIDEO_ENUMS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum pipe_video_format
 {
    PIPE_VIDEO_FORMAT_UNKNOWN = 0,
@@ -87,4 +91,8 @@ enum pipe_video_entrypoint
    PIPE_VIDEO_ENTRYPOINT_ENCODE
 };
 
+#if defined(__cplusplus)
+}
+#endif
+
 #endif /* PIPE_VIDEO_ENUMS_H */
-- 
2.6.2



More information about the mesa-dev mailing list