From a584e846d435070e67aff904fb79cfc9a6d7d05e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 15 Feb 2006 15:51:01 +0000 Subject: Fix a few warnings: - nested comments (use #if 0 / #endif instead) - missing default clause in switch statements - use of possibly undefined variables --- src/mesa/shader/slang/library/slang_shader_syn.h | 2 +- src/mesa/shader/slang/slang_assemble.c | 11 ++++++++--- src/mesa/shader/slang/slang_assemble_assignment.c | 2 ++ src/mesa/shader/slang/slang_assemble_constructor.c | 17 +++++++++++------ src/mesa/shader/slang/slang_assemble_typeinfo.c | 9 +++++++++ src/mesa/shader/slang/slang_compile.c | 14 ++++++++------ 6 files changed, 39 insertions(+), 16 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/library/slang_shader_syn.h b/src/mesa/shader/slang/library/slang_shader_syn.h index 6100400fef0..3f13b2583a3 100644 --- a/src/mesa/shader/slang/library/slang_shader_syn.h +++ b/src/mesa/shader/slang/library/slang_shader_syn.h @@ -749,4 +749,4 @@ " '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n" "err_identifier\n" " id_character_first .and .loop id_character_next;\n" -"" \ No newline at end of file +"" diff --git a/src/mesa/shader/slang/slang_assemble.c b/src/mesa/shader/slang/slang_assemble.c index 698b3bf747b..30a80b7f3de 100644 --- a/src/mesa/shader/slang/slang_assemble.c +++ b/src/mesa/shader/slang/slang_assemble.c @@ -474,6 +474,9 @@ static int dereference_aggregate (slang_assembly_file *file, const slang_storage case slang_stor_float: ty = slang_asm_float_deref; break; + default: + _mesa_problem(NULL, "Unexpected arr->type in dereference_aggregate"); + ty = slang_asm_none; } if (!PUSH (file, ty)) return 0; @@ -936,15 +939,17 @@ static int handle_field (slang_assembly_typeinfo *tia, slang_assembly_typeinfo * { if (reference) { - /*if (tia->swz.num_components == 1) +#if 0 + if (tia->swz.num_components == 1) { /* simple case - adjust the vector's address to point to the selected component */ - /* if (!PLAB (file, slang_asm_addr_push, tia->swz.swizzle[0] * 4)) + if (!PLAB (file, slang_asm_addr_push, tia->swz.swizzle[0] * 4)) return 0; if (!PUSH (file, slang_asm_addr_add)) return 0; } - else*/ + else +#endif { /* two or more vector components are being referenced - the so-called write mask * must be passed to the upper operations and applied when assigning value diff --git a/src/mesa/shader/slang/slang_assemble_assignment.c b/src/mesa/shader/slang/slang_assemble_assignment.c index afecf08a491..ca857fad2fc 100644 --- a/src/mesa/shader/slang/slang_assemble_assignment.c +++ b/src/mesa/shader/slang/slang_assemble_assignment.c @@ -106,6 +106,8 @@ static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggr ty = slang_asm_float_copy; break; default: + _mesa_problem(NULL, "Unexpected arr->type in assign_aggregate"); + ty = slang_asm_none; break; } if (!slang_assembly_file_push_label2 (file, ty, dst_addr_loc, dst_offset)) diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c index aa2e0195388..8d910f3c749 100644 --- a/src/mesa/shader/slang/slang_assemble_constructor.c +++ b/src/mesa/shader/slang/slang_assemble_constructor.c @@ -143,7 +143,7 @@ void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left, } /* _slang_assemble_constructor() */ -/* +#if 0 static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat, unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info) @@ -178,10 +178,10 @@ static int constructor_aggregate (slang_assembly_file *file, const slang_storage if (arr1->type != arr2->type) { /* TODO: convert (generic) from arr1 to arr2 */ -/* } + } (*index)++; /* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */ -/* } + } result = 1; end: @@ -192,8 +192,12 @@ end1: slang_assembly_typeinfo_destruct (&ti); return result; } +#endif + /* XXX: general swizzle! */ -/*int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, + +#if 0 +int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op, slang_assembly_flow_control *flow, slang_assembly_name_space *space, slang_assembly_local_info *info, struct slang_machine_ *pmach) { @@ -223,11 +227,11 @@ end1: index = 0; for (i = 0; i < op->num_children; i++) { -/* if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow, + if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow, space, info))) goto end; /* TODO: watch the index, if it reaches the size, raise an error */ -/* } + } result = 1; end: @@ -238,6 +242,7 @@ end1: slang_assembly_typeinfo_destruct (&ti); return result; } +#endif /* _slang_assemble_constructor_from_swizzle() */ diff --git a/src/mesa/shader/slang/slang_assemble_typeinfo.c b/src/mesa/shader/slang/slang_assemble_typeinfo.c index 778ba04ced8..830597e9c2e 100644 --- a/src/mesa/shader/slang/slang_assemble_typeinfo.c +++ b/src/mesa/shader/slang/slang_assemble_typeinfo.c @@ -329,6 +329,9 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa case slang_spec_bool: ti->spec.type = slang_spec_bvec2; break; + default: + _mesa_problem(NULL, "unexepected base in _slang_typeof_operation"); + ti->spec.type = slang_spec_void; } break; case 3: @@ -343,6 +346,9 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa case slang_spec_bool: ti->spec.type = slang_spec_bvec3; break; + default: + _mesa_problem(NULL, "unexepected base in _slang_typeof_operation"); + ti->spec.type = slang_spec_void; } break; case 4: @@ -357,6 +363,9 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa case slang_spec_bool: ti->spec.type = slang_spec_bvec4; break; + default: + _mesa_problem(NULL, "unexepected base in _slang_typeof_operation"); + ti->spec.type = slang_spec_void; } break; default: diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index eb02ccc1991..02850ebf129 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1649,12 +1649,13 @@ static int parse_init_declarator (slang_parse_ctx *C, slang_output_ctx *O, return 0; } if (!parse_expression (C, O, var->initializer)) - return 0; + return 0; /* TODO: execute the initializer */ break; -/* case VARIABLE_ARRAY_UNKNOWN: +#if 0 + case VARIABLE_ARRAY_UNKNOWN: /* unsized array - mark it as array and copy the specifier to the array element */ -/* var->type.specifier.type = slang_spec_array; + var->type.specifier.type = slang_spec_array; var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof ( slang_type_specifier)); if (var->type.specifier._array == NULL) @@ -1665,9 +1666,10 @@ static int parse_init_declarator (slang_parse_ctx *C, slang_output_ctx *O, slang_type_specifier_construct (var->type.specifier._array); if (!slang_type_specifier_copy (var->type.specifier._array, &type->specifier)) return 0; - break;*/ - case VARIABLE_ARRAY_EXPLICIT: - /* sized array - mark it as array, copy the specifier to the array element and + break; +#endif + case VARIABLE_ARRAY_EXPLICIT: + /* sized array - mark it as array, copy the specifier to the array element and * parse the expression */ var->type.specifier.type = slang_spec_array; var->type.specifier._array = (slang_type_specifier *) slang_alloc_malloc (sizeof ( -- cgit v1.2.3