summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/arbfragparse.c1
-rw-r--r--src/mesa/shader/arbprogparse.c20
-rw-r--r--src/mesa/shader/arbvertparse.c1
-rw-r--r--src/mesa/shader/grammar.c62
-rw-r--r--src/mesa/shader/nvfragprog.h1
-rw-r--r--src/mesa/shader/nvvertexec.c8
-rw-r--r--src/mesa/shader/nvvertparse.c1
-rw-r--r--src/mesa/shader/program.c2
8 files changed, 55 insertions, 41 deletions
diff --git a/src/mesa/shader/arbfragparse.c b/src/mesa/shader/arbfragparse.c
index 7192156463..a0fc9dd5bb 100644
--- a/src/mesa/shader/arbfragparse.c
+++ b/src/mesa/shader/arbfragparse.c
@@ -186,6 +186,7 @@ _mesa_parse_arb_fragment_program(GLcontext * ctx, GLenum target,
{
GLuint a, retval;
struct arb_program ap;
+ (void) target;
/* set the program target before parsing */
ap.Base.Target = GL_FRAGMENT_PROGRAM_ARB;
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 8e8051267d..9d78027f63 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -42,6 +42,10 @@
#include "arbprogparse.h"
#include "grammar_mesa.h"
+#if !defined(__GNUC__) && !defined(__extension__)
+# define __extension__
+#endif
+
/* TODO:
* Fragment Program Stuff:
* -----------------------------------------------------
@@ -129,7 +133,7 @@ typedef GLubyte *production;
/**
* This is the text describing the rules to parse the grammar
*/
-static char arb_grammar_text[] =
+__extension__ static char arb_grammar_text[] =
#include "arbprogram_syn.h"
;
@@ -591,6 +595,7 @@ parse_string (GLubyte ** inst, struct var_cache **vc_head,
{
GLubyte *i = *inst;
struct var_cache *va = NULL;
+ (void) Program;
*inst += _mesa_strlen ((char *) i) + 1;
@@ -614,7 +619,8 @@ static char *
parse_string_without_adding (GLubyte ** inst, struct arb_program *Program)
{
GLubyte *i = *inst;
-
+ (void) Program;
+
*inst += _mesa_strlen ((char *) i) + 1;
return (char *) i;
@@ -788,6 +794,7 @@ static GLuint
parse_color_type (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program,
GLint * color)
{
+ (void) ctx; (void) Program;
*color = *(*inst)++ != COLOR_PRIMARY;
return 0;
}
@@ -828,7 +835,7 @@ parse_texcoord_num (GLcontext * ctx, GLubyte ** inst,
{
GLint i = parse_integer (inst, Program);
- if ((i < 0) || (i >= ctx->Const.MaxTextureUnits)) {
+ if ((i < 0) || (i >= (int)ctx->Const.MaxTextureUnits)) {
_mesa_set_program_error (ctx, Program->Position,
"Invalid texture unit index");
_mesa_error (ctx, GL_INVALID_OPERATION, "Invalid texture unit index");
@@ -1890,7 +1897,7 @@ parse_param (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
/* Test array length here! */
if (specified_length) {
- if (specified_length != param_var->param_binding_length) {
+ if (specified_length != (int)param_var->param_binding_length) {
_mesa_set_program_error (ctx, Program->Position,
"Declared parameter array lenght does not match parameter list");
_mesa_error (ctx, GL_INVALID_OPERATION,
@@ -2282,6 +2289,7 @@ parse_address_reg (GLcontext * ctx, GLubyte ** inst,
{
struct var_cache *dst;
GLuint result;
+ (void) Index;
dst = parse_string (inst, vc_head, Program, &result);
Program->Position = parse_position (inst);
@@ -2492,7 +2500,7 @@ parse_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head,
offset = parse_integer (inst, Program);
if ((offset < 0)
- || (offset >= src->param_binding_length)) {
+ || (offset >= (int)src->param_binding_length)) {
_mesa_set_program_error (ctx, Program->Position,
"Index out of range");
_mesa_error (ctx, GL_INVALID_OPERATION,
@@ -3686,7 +3694,7 @@ parse_arb_program (GLcontext * ctx, GLubyte * inst, struct var_cache **vc_head,
}
/* XXX temporary */
-static char core_grammar_text[] =
+__extension__ static char core_grammar_text[] =
#include "grammar_syn.h"
;
diff --git a/src/mesa/shader/arbvertparse.c b/src/mesa/shader/arbvertparse.c
index cfad87b5b1..d0e776b47c 100644
--- a/src/mesa/shader/arbvertparse.c
+++ b/src/mesa/shader/arbvertparse.c
@@ -175,6 +175,7 @@ _mesa_parse_arb_vertex_program(GLcontext * ctx, GLenum target,
{
GLuint retval;
struct arb_program ap;
+ (void) target;
/* set the program target before parsing */
ap.Base.Target = GL_VERTEX_PROGRAM_ARB;
diff --git a/src/mesa/shader/grammar.c b/src/mesa/shader/grammar.c
index af824f3384..fa2e96901d 100644
--- a/src/mesa/shader/grammar.c
+++ b/src/mesa/shader/grammar.c
@@ -284,7 +284,7 @@ static void clear_last_error ()
/* free error parameter - if error_param is a "???" don't free it - it's static */
if (error_param != unknown)
- mem_free ((void **) &error_param);
+ mem_free ((void **) (void *) &error_param);
else
error_param = NULL;
@@ -297,7 +297,7 @@ static void set_last_error (const byte *msg, byte *param, int pos)
/* error message can only be set only once */
if (error_message != NULL)
{
- mem_free ((void **) &param);
+ mem_free ((void **) (void *) &param);
return;
}
@@ -1230,7 +1230,7 @@ static int get_identifier (const byte **text, byte **id)
{
if (string_grow (&p, &len, *t++))
{
- mem_free ((void **) &p);
+ mem_free ((void **) (void *) &p);
return 1;
}
}
@@ -1379,7 +1379,7 @@ static int get_string (const byte **text, byte **str)
if (string_grow (&p, &len, c))
{
- mem_free ((void **) &p);
+ mem_free ((void **) (void *) &p);
return 1;
}
}
@@ -1424,7 +1424,7 @@ static int get_emtcode (const byte **text, map_byte **ma)
}
m->data = (byte) c[0];
- mem_free ((void **) &c);
+ mem_free ((void **) (void *) &c);
}
else
{
@@ -1502,11 +1502,11 @@ static int get_error (const byte **text, error **er, map_str *maps)
if (!str_equal ((byte *) "error", temp))
{
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
return 0;
}
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
error_create (er);
if (*er == NULL)
@@ -1532,12 +1532,12 @@ static int get_error (const byte **text, error **er, map_str *maps)
if (map_str_find (&maps, temp, &(**er).m_text))
{
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
error_destroy (er);
return 1;
}
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
}
/* try to extract "token" from "...$token$..." */
@@ -1558,7 +1558,7 @@ static int get_error (const byte **text, error **er, map_str *maps)
{
if (string_grow (&processed, &len, '$'))
{
- mem_free ((void **) &processed);
+ mem_free ((void **) (void *) &processed);
error_destroy (er);
return 1;
}
@@ -1569,7 +1569,7 @@ static int get_error (const byte **text, error **er, map_str *maps)
{
if (string_grow (&processed, &len, (**er).m_text[i]))
{
- mem_free ((void **) &processed);
+ mem_free ((void **) (void *) &processed);
error_destroy (er);
return 1;
}
@@ -1580,7 +1580,7 @@ static int get_error (const byte **text, error **er, map_str *maps)
{
if (string_grow (&processed, &len, '$'))
{
- mem_free ((void **) &processed);
+ mem_free ((void **) (void *) &processed);
error_destroy (er);
return 1;
}
@@ -1591,7 +1591,7 @@ static int get_error (const byte **text, error **er, map_str *maps)
if (string_grow (&(**er).m_token_name, &tlen, '\0'))
{
- mem_free ((void **) &processed);
+ mem_free ((void **) (void *) &processed);
error_destroy (er);
return 1;
}
@@ -1603,7 +1603,7 @@ static int get_error (const byte **text, error **er, map_str *maps)
{
if (string_grow (&(**er).m_token_name, &tlen, (**er).m_text[i]))
{
- mem_free ((void **) &processed);
+ mem_free ((void **) (void *) &processed);
error_destroy (er);
return 1;
}
@@ -1652,11 +1652,11 @@ static int get_emits (const byte **text, emit **em, map_byte *mapb)
dest = ed_regbyte;
else
{
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
return 0;
}
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
emit_create (&e);
if (e == NULL)
@@ -1706,7 +1706,7 @@ static int get_emits (const byte **text, emit **em, map_byte *mapb)
}
e->m_byte = (byte) temp[0];
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
e->m_emit_type = et_byte;
}
@@ -1720,12 +1720,12 @@ static int get_emits (const byte **text, emit **em, map_byte *mapb)
if (map_byte_find (&mapb, temp, &e->m_byte))
{
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
emit_destroy (&e);
return 1;
}
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
e->m_emit_type = et_byte;
}
@@ -1819,7 +1819,7 @@ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb
t = u;
}
- mem_free ((void **) &keyword);
+ mem_free ((void **) (void *) &keyword);
}
if (*t == '\'')
@@ -1843,7 +1843,7 @@ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb
if (get_string (&t, &temp2))
{
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
spec_destroy (&s);
return 1;
}
@@ -1853,7 +1853,7 @@ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb
s->m_byte[0] = *temp;
s->m_byte[1] = *temp2;
- mem_free ((void **) &temp2);
+ mem_free ((void **) (void *) &temp2);
}
else
{
@@ -1861,7 +1861,7 @@ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb
*s->m_byte = *temp;
}
- mem_free ((void **) &temp);
+ mem_free ((void **) (void *) &temp);
}
else if (*t == '"')
{
@@ -1908,7 +1908,7 @@ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb
{
if (get_identifier (&t, &s->m_string))
{
- mem_free ((void **) &keyword);
+ mem_free ((void **) (void *) &keyword);
spec_destroy (&s);
return 1;
}
@@ -1917,7 +1917,7 @@ static int get_spec (const byte **text, spec **sp, map_str *maps, map_byte *mapb
s->m_spec_type = st_identifier_loop;
}
- mem_free ((void **) &keyword);
+ mem_free ((void **) (void *) &keyword);
}
else
{
@@ -1993,7 +1993,7 @@ static int get_rule (const byte **text, rule **ru, map_str *maps, map_byte *mapb
r->m_oper = op_or;
}
- mem_free ((void **) &op);
+ mem_free ((void **) (void *) &op);
if (get_spec (&t, &sp, maps, mapb))
{
@@ -2550,7 +2550,7 @@ grammar grammar_load_from_text (const byte *text)
{
map_byte *ma = NULL;
- mem_free ((void **) &symbol);
+ mem_free ((void **) (void *) &symbol);
if (get_emtcode (&text, &ma))
{
@@ -2565,7 +2565,7 @@ grammar grammar_load_from_text (const byte *text)
{
map_byte *ma = NULL;
- mem_free ((void **) &symbol);
+ mem_free ((void **) (void *) &symbol);
if (get_regbyte (&text, &ma))
{
@@ -2580,7 +2580,7 @@ grammar grammar_load_from_text (const byte *text)
{
map_str *ma = NULL;
- mem_free ((void **) &symbol);
+ mem_free ((void **) (void *) &symbol);
if (get_errtext (&text, &ma))
{
@@ -2593,7 +2593,7 @@ grammar grammar_load_from_text (const byte *text)
/* .string */
else if (is_dot && str_equal (symbol, (byte *) "string"))
{
- mem_free ((void **) &symbol);
+ mem_free ((void **) (void *) &symbol);
if (g->di->m_string != NULL)
{
@@ -2760,7 +2760,7 @@ void grammar_get_last_error (byte *text, unsigned int size, int *pos)
*text = '\0';
#define APPEND_CHARACTER(x) if (dots_made == 0) {\
- if (len < size - 1) {\
+ if (len < (int)size - 1) {\
text[len++] = (x); text[len] = '\0';\
} else {\
int i;\
diff --git a/src/mesa/shader/nvfragprog.h b/src/mesa/shader/nvfragprog.h
index ae26a7b574..8f02f22877 100644
--- a/src/mesa/shader/nvfragprog.h
+++ b/src/mesa/shader/nvfragprog.h
@@ -62,6 +62,7 @@
/* Fragment program instruction opcodes */
enum fp_opcode {
+ FP_OPCODE_INVALID = -1, /* Force signed enum */
FP_OPCODE_ABS = 1000, /* ARB_f_p only */
FP_OPCODE_ADD,
FP_OPCODE_CMP, /* ARB_f_p only */
diff --git a/src/mesa/shader/nvvertexec.c b/src/mesa/shader/nvvertexec.c
index f92396c955..e10cb1ac48 100644
--- a/src/mesa/shader/nvvertexec.c
+++ b/src/mesa/shader/nvvertexec.c
@@ -358,8 +358,8 @@ store_vector4( const struct vp_dst_register *dest,
* Set x to positive or negative infinity.
*/
#if defined(USE_IEEE) || defined(_WIN32)
-#define SET_POS_INFINITY(x) ( *((GLuint *) &x) = 0x7F800000 )
-#define SET_NEG_INFINITY(x) ( *((GLuint *) &x) = 0xFF800000 )
+#define SET_POS_INFINITY(x) ( *((GLuint *) (void *)&x) = 0x7F800000 )
+#define SET_NEG_INFINITY(x) ( *((GLuint *) (void *)&x) = 0xFF800000 )
#elif defined(VMS)
#define SET_POS_INFINITY(x) x = __MAXFLOAT
#define SET_NEG_INFINITY(x) x = -__MAXFLOAT
@@ -368,7 +368,7 @@ store_vector4( const struct vp_dst_register *dest,
#define SET_NEG_INFINITY(x) x = (GLfloat) -HUGE_VAL
#endif
-#define SET_FLOAT_BITS(x, bits) ((fi_type *) &(x))->i = bits
+#define SET_FLOAT_BITS(x, bits) ((fi_type *) (void *) &(x))->i = bits
/**
@@ -467,7 +467,7 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program)
GLint ii = (GLint) floor_t0;
ii = (ii < 23) + 0x3f800000;
SET_FLOAT_BITS(q[0], ii);
- q[0] = *((GLfloat *) &ii);
+ q[0] = *((GLfloat *) (void *)&ii);
#else
q[0] = (GLfloat) pow(2.0, floor_t0);
#endif
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index aa6ea2ef0b..7e8e749d8c 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -1023,6 +1023,7 @@ static GLboolean
Parse_OptionSequence(struct parse_state *parseState,
struct vp_instruction program[])
{
+ (void) program;
while (1) {
if (!Parse_String(parseState, "OPTION"))
return GL_TRUE; /* ok, not an OPTION statement */
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index daec9252ff..c451fede92 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -167,6 +167,7 @@ static struct program * _mesa_init_program_struct( GLcontext *ctx,
struct program *prog,
GLenum target, GLuint id)
{
+ (void) ctx;
if (prog) {
prog->Id = id;
prog->Target = target;
@@ -239,6 +240,7 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
void
_mesa_delete_program(GLcontext *ctx, struct program *prog)
{
+ (void) ctx;
ASSERT(prog);
if (prog->String)