[Mesa-dev] [PATCH] glx: Don't enclose includes inside `extern "C" { }`.

Brian Paul brianp at vmware.com
Tue Apr 26 18:58:42 UTC 2016


On 04/26/2016 12:55 PM, Jose Fonseca wrote:
> Ran `make check` inside src/glx to verify everything compiles and links
> correctly.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=95158
> ---
>   src/glx/dri2_priv.h                                      | 8 ++++++++
>   src/glx/glx_error.h                                      | 8 ++++++++
>   src/glx/glxclient.h                                      | 9 +++++++++
>   src/glx/glxextensions.h                                  | 8 ++++++++
>   src/glx/tests/clientinfo_unittest.cpp                    | 2 --
>   src/glx/tests/create_context_unittest.cpp                | 2 --
>   src/glx/tests/fake_glx_screen.h                          | 2 --
>   src/glx/tests/query_renderer_implementation_unittest.cpp | 2 --
>   src/glx/tests/query_renderer_unittest.cpp                | 2 --
>   9 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/src/glx/dri2_priv.h b/src/glx/dri2_priv.h
> index e81b1bf..8a64072 100644
> --- a/src/glx/dri2_priv.h
> +++ b/src/glx/dri2_priv.h
> @@ -30,6 +30,10 @@
>    *   Kristian Høgsberg (krh at redhat.com)
>    */
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>   struct dri2_screen {
>      struct glx_screen base;
>
> @@ -74,3 +78,7 @@ _X_HIDDEN int
>   dri2_interop_export_object(struct glx_context *ctx,
>                              const mesa_glinterop_export_in *in,
>                              mesa_glinterop_export_out *out);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> diff --git a/src/glx/glx_error.h b/src/glx/glx_error.h
> index eaf6b81..5d39926 100644
> --- a/src/glx/glx_error.h
> +++ b/src/glx/glx_error.h
> @@ -31,9 +31,17 @@
>   #include <X11/Xlib.h>
>   #include <xcb/xcb.h>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>   void __glXSendError(Display * dpy, int_fast8_t errorCode,
>   		    uint_fast32_t resourceID, uint_fast16_t minorCode,
>   		    bool coreX11error);
>
>   _X_HIDDEN void __glXSendErrorForXcb(Display * dpy,
>   				    const xcb_generic_error_t *err);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
> index 7a24928..141e46a 100644
> --- a/src/glx/glxclient.h
> +++ b/src/glx/glxclient.h
> @@ -57,6 +57,11 @@
>   #include "glxextensions.h"
>
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +
>   #define GLX_MAJOR_VERSION 1       /* current version numbers */
>   #define GLX_MINOR_VERSION 4
>
> @@ -824,4 +829,8 @@ indirect_create_context_attribs(struct glx_screen *base,
>                                   const uint32_t *attribs,
>                                   unsigned *error);
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>   #endif /* !__GLX_client_h__ */
> diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
> index 906b3fc..743ed97 100644
> --- a/src/glx/glxextensions.h
> +++ b/src/glx/glxextensions.h
> @@ -31,6 +31,10 @@
>   #ifndef GLX_GLXEXTENSIONS_H
>   #define GLX_GLXEXTENSIONS_H
>
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
>   enum
>   {
>      ARB_create_context_bit = 0,
> @@ -303,4 +307,8 @@ typedef void (*PFNGLXDISABLEEXTENSIONPROC) (const char *name);
>   # endif /* __GNUC__ */
>   #endif /* GLX_NO_STATIC_EXTENSION_FUNCTIONS */
>
> +#ifdef __cplusplus
> +}
> +#endif
> +
>   #endif /* GLX_GLXEXTENSIONS_H */
> diff --git a/src/glx/tests/clientinfo_unittest.cpp b/src/glx/tests/clientinfo_unittest.cpp
> index b56c94b..320e8fc 100644
> --- a/src/glx/tests/clientinfo_unittest.cpp
> +++ b/src/glx/tests/clientinfo_unittest.cpp
> @@ -23,9 +23,7 @@
>   #include <gtest/gtest.h>
>   #include <string.h>
>
> -extern "C" {
>   #include "glxclient.h"
> -}
>
>   #include <xcb/glx.h>
>
> diff --git a/src/glx/tests/create_context_unittest.cpp b/src/glx/tests/create_context_unittest.cpp
> index 819b0b2..a259058 100644
> --- a/src/glx/tests/create_context_unittest.cpp
> +++ b/src/glx/tests/create_context_unittest.cpp
> @@ -23,10 +23,8 @@
>   #include <gtest/gtest.h>
>   #include <string.h>
>
> -extern "C" {
>   #include "glxclient.h"
>   #include "glx_error.h"
> -}
>
>   #include <xcb/glx.h>
>   #include "mock_xdisplay.h"
> diff --git a/src/glx/tests/fake_glx_screen.h b/src/glx/tests/fake_glx_screen.h
> index 0249e79..39b250f 100644
> --- a/src/glx/tests/fake_glx_screen.h
> +++ b/src/glx/tests/fake_glx_screen.h
> @@ -20,9 +20,7 @@
>    * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>    * DEALINGS IN THE SOFTWARE.
>    */
> -extern "C" {
>   #include "glxclient.h"
> -};
>
>   class fake_glx_screen : public glx_screen {
>   public:
> diff --git a/src/glx/tests/query_renderer_implementation_unittest.cpp b/src/glx/tests/query_renderer_implementation_unittest.cpp
> index 7f8f301..c3f5cc7 100644
> --- a/src/glx/tests/query_renderer_implementation_unittest.cpp
> +++ b/src/glx/tests/query_renderer_implementation_unittest.cpp
> @@ -26,13 +26,11 @@
>
>   #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
>
> -extern "C" {
>   #include "glxclient.h"
>   #include "glx_error.h"
>   #include "dri2.h"
>   #include "dri_interface.h"
>   #include "dri2_priv.h"
> -}
>
>   struct attribute_test_vector {
>      const char *glx_string;
> diff --git a/src/glx/tests/query_renderer_unittest.cpp b/src/glx/tests/query_renderer_unittest.cpp
> index 2f3c4ef..dc88cc9 100644
> --- a/src/glx/tests/query_renderer_unittest.cpp
> +++ b/src/glx/tests/query_renderer_unittest.cpp
> @@ -24,10 +24,8 @@
>   #include <signal.h>
>   #include <setjmp.h>
>
> -extern "C" {
>   #include "glxclient.h"
>   #include "glx_error.h"
> -}
>
>   extern bool GetGLXScreenConfigs_called;
>   extern struct glx_screen *psc;
>

LGTM.  Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list