[Mesa-dev] [PATCH] swr: fix windows build break

Ilia Mirkin imirkin at alum.mit.edu
Wed Jan 4 17:40:16 UTC 2017


The header file should, instead, have an extern "C" in it. Header
files should be safe to include in C++ code, most have extern "C"
guards, but some get missed.

Cheers,

  -ilia

On Wed, Jan 4, 2017 at 12:41 PM, George Kyriazis
<george.kyriazis at intel.com> wrote:
> Explicitly declare lp_native_vector_width inside an extern "C",
> since we cannot include the correct header file inside extern "C".
> ---
>  src/gallium/drivers/swr/swr_screen.cpp | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index a9905d7..f858f68 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -21,6 +21,19 @@
>   * IN THE SOFTWARE.
>   ***************************************************************************/
>
> +/*
> + * extern block below has to be before any #includes.
> + * Windows decorates global variables, and the first extern wins,
> + * so the first declaration of lp_native_vector_width has to be
> + * the correct one. The right approach, of course, is to include
> + * the correct .h files, however that doesn't work since
> + * header files eventually include system header files,
> + * which do not work inside extern "C".
> + */
> +extern "C" {
> +   extern unsigned lp_native_vector_width;
> +}
> +
>  #include "swr_context.h"
>  #include "swr_public.h"
>  #include "swr_screen.h"
> @@ -39,9 +52,6 @@
>
>  #include "state_tracker/sw_winsys.h"
>
> -extern "C" {
> -#include "gallivm/lp_bld_limits.h"
> -}
>
>  #include "jit_api.h"
>
> --
> 2.10.0.windows.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list