In vbcull.c and cull_tmp.h files I've replaced some instances of
"const" with "CONST".  CONST is a preprocessor symbol which is
either defined to be "const" or nothing, depending on the compiler.
It's a convention I've used in Mesa for quite a while in order to
eliminate excessive warnings with some compilers.

Actually, I don't fully understand the problem.  Here's a snippet
which illustrates it:


void func1(const float a[])
{
        (void) a;
}

void func2(const float a[][2])
{
        (void) a;
}

void caller(void)
{
        float v1[100];
        float v2[100][2];
        func1(v1);
        func2(v2);         /* line 22 */
}

Using the IRIX MIPSPro 7.2 C compiler I get this warning:

% cc -n32 -c const.c
"const.c", line 22: warning(1164): argument of type "float (*)[2]" is
          incompatible with parameter of type "const float (*)[2]"
        func2(v2);
              ^

func1 takes a 1-D const array.  The call to it works fine.
func2 takes a 2-D const array.  The call to it generates a warning.

I don't understand this.

Other compilers like gcc and VC++ and MIPSPro C++ don't complain.

Anyway, in Mesa I try to be const-correct everywhere but hated seeing
these warnings (and there are lots of them) so as a work-around I
use the CONST macro.


I recommend that when you compile Mesa on your development systems
that you enable the maximum compiler warnings.  It helps ensure good
code quality.  Unfortunately, it sometimes causes little headaches
like this.

-Brian

----------------------------------------------------------------------
Brian Paul        Avid Technology / Softimage      [EMAIL PROTECTED]

Reply via email to