[Mesa-dev] [PATCH:mesa 2/4] Avoid fighting with Solaris headers over isnormal()

Alan Coopersmith alan.coopersmith at oracle.com
Tue Feb 17 13:41:23 PST 2015


On 02/17/15 10:21 AM, Emil Velikov wrote:
> Hi Alan,
>
> On 16/02/15 02:41, Alan Coopersmith wrote:
>> When compiling in C99 or C++11 modes, Solaris defines isnormal() as
>> a macro via <math.h>, which causes the function definition to become
>> too mangled to compile.
>>
> Is this series sufficient to get mesa working again with Solaris ?

No.  There are still two problems in src/glsl/nir/nir.h:

1) #pragma once needs to be replaced with a traditional header guard.
    Since gcc listed #pragma once as deprecated, the Solaris Studio
    compiler team decided it wasn't worth supporting, and this header
    causes failures if it's included twice.  (None of the other #pragma
    once headers seem to cause problems in the build.)

@@ -25,6 +25,9 @@
   *
   */

+#ifndef __NIR_H__
+#define __NIR_H__
+
  #pragma once

  #include "util/hash_table.h"
@@ -1566,3 +1569,4 @@ bool nir_opt_remove_phis(nir_shader *shader);
  #ifdef __cplusplus
  } /* extern "C" */
  #endif
+#endif

2) Studio C++ does not allow structs to contain arrays with no dimensions.
    I was able to hack around it by setting the array to zero size and
    adding the the -features=zla flag to enable zero-length arrays:

@@ -640,7 +643,7 @@ typedef struct nir_alu_instr {
     nir_instr instr;
     nir_op op;
     nir_alu_dest dest;
-   nir_alu_src src[];
+   nir_alu_src src[0];
  } nir_alu_instr;

  /* is this source channel used? */
@@ -789,7 +792,7 @@ typedef struct {

     nir_deref_var *variables[2];

-   nir_src src[];
+   nir_src src[0];
  } nir_intrinsic_instr;

  /**

Also, I'm building with a very limited configuration and haven't checked the
rest:  --without-gallium-drivers --disable-dri --disable-dri3

And I have to use CPPFLAGS=" -D__unix__" to make the #ifdefs work in
include/EGL/eglplatform.h, but it looked like Khronos needs to fix that,
not Mesa.

> Afaics there is a similar redefinition of isnormal in
> src/glsl/nir/nir_constant_expressions.py.

I have no idea what that's used for or if that's used in our builds.

> The series looks like stable material imho. If you're planning to push
> these yourself please add
>
> Cc: "10.5" <mesa-stable at lists.freedesktop.org>
> Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

Thanks


-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the mesa-dev mailing list