[Mesa-dev] [PATCH] include: Add helper header to help trap includes inside extern C.

kallisti5 kallisti5 at unixzen.com
Wed May 13 07:51:56 PDT 2015


On 2014-12-11 16:14, Jose Fonseca wrote:
> From: José Fonseca <jfonseca at vmware.com>
> 
> This is just to help repro and fixing these issues with any C++ 
> compiler --
> 
> commiting this will of course wait until all issues are addressed.
> 
> 
> $ scons src/glsl/
> scons: Reading SConscript files ...
> Checking for GCC ...  yes
> Checking for Clang ...  no
> Checking for X11 (x11 xext xdamage xfixes glproto >= 1.4.13)... yes
> Checking for XCB (x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8)... yes
> Checking for XF86VIDMODE (xxf86vm)... yes
> Checking for DRM (libdrm >= 2.4.38)... yes
> Checking for UDEV (libudev >= 151)... yes
> warning: LLVM disabled: not building llvmpipe
> scons: done reading SConscript files.
> scons: Building targets ...
> scons: building associated VariantDir targets: 
> build/linux-x86_64-debug/glsl
>   Compiling src/glsl/ast_array_index.cpp ...
>   Compiling src/glsl/ast_expr.cpp ...
>   Compiling src/glsl/ast_function.cpp ...
>   Compiling src/glsl/ast_to_hir.cpp ...
>   Compiling src/glsl/ast_type.cpp ...
>   Compiling src/glsl/builtin_functions.cpp ...
> In file included from include/c99_compat.h:28:0,
>                  from src/mapi/u_compiler.h:4,
>                  from src/mapi/u_thread.h:47,
>                  from src/mapi/glapi/glapi.h:47,
>                  from src/mesa/main/mtypes.h:42,
>                  from src/mesa/main/errors.h:47,
>                  from src/mesa/main/imports.h:41,
>                  from src/mesa/main/core.h:44,
>                  from src/glsl/builtin_functions.cpp:58:
> include/no_extern_c.h:48:1: error: template with C linkage
>  template<class T> class _IncludeInsideExternCNotPortable;
>  ^

Good morning,

This change breaks all of the Haiku code as we use a *lot* of C++ code 
inside
of Mesa (well, all the OS interfaces are C++ that wrap the Mesa C)

/Builds/mesa> find . -name "*.cpp" | grep haiku
./src/egl/drivers/haiku/egl_haiku.cpp
./src/gallium/targets/haiku-softpipe/GalliumContext.cpp
./src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
./src/mesa/drivers/haiku/swrast/SoftwareRast.cpp


Example:
   Compiling src/util/u_atomic_test.c ...
In file included from include/c99_compat.h:28:0,
                  from include/c11/threads.h:38,
                  from src/mesa/main/mtypes.h:39,
                  from src/mesa/main/errors.h:42,
                  from src/mesa/main/imports.h:44,
                  from src/mesa/main/context.h:52,
                  from src/mesa/drivers/haiku/swrast/SoftwareRast.h:20,
                  from src/mesa/drivers/haiku/swrast/SoftwareRast.cpp:14:
include/no_extern_c.h:47:1: error: template with C linkage
  template<class T> class _IncludeInsideExternCNotPortable;
  ^
In file included from include/c99_compat.h:28:0,
                  from src/gallium/include/pipe/p_compiler.h:32,
                  from src/gallium/auxiliary/util/u_math.h:42,
                  from src/mesa/main/macros.h:35,
                  from src/mesa/main/colormac.h:37,
                  from src/mesa/drivers/haiku/swrast/SoftwareRast.cpp:28:
include/no_extern_c.h:47:1: error: template with C linkage
  template<class T> class _IncludeInsideExternCNotPortable;

Any alternative fix ideas besides me adding a if !defined(__HAIKU__) to 
include/no_extern_c.h?

  -- Alex


More information about the mesa-dev mailing list