Fix a few warnings:
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 15 Feb 2006 15:51:01 +0000 (15:51 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 15 Feb 2006 15:51:01 +0000 (15:51 +0000)
 - 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
src/mesa/shader/slang/slang_assemble.c
src/mesa/shader/slang/slang_assemble_assignment.c
src/mesa/shader/slang/slang_assemble_constructor.c
src/mesa/shader/slang/slang_assemble_typeinfo.c
src/mesa/shader/slang/slang_compile.c

index 6100400..3f13b25 100644 (file)
 " '\\'' .or '<' .or ',' .or '>' .or '.' .or '/' .or '?' .or err_identifier;\n"\r
 "err_identifier\n"\r
 " id_character_first .and .loop id_character_next;\n"\r
-""
\ No newline at end of file
+""\r
index 698b3bf..30a80b7 100644 (file)
@@ -474,6 +474,9 @@ static int dereference_aggregate (slang_assembly_file *file, const slang_storage
                                case slang_stor_float:\r
                                        ty = slang_asm_float_deref;\r
                                        break;\r
+                               default:\r
+                                       _mesa_problem(NULL, "Unexpected arr->type in dereference_aggregate");\r
+                                       ty = slang_asm_none;\r
                                }\r
                                if (!PUSH (file, ty))\r
                                        return 0;\r
@@ -936,15 +939,17 @@ static int handle_field (slang_assembly_typeinfo *tia, slang_assembly_typeinfo *
        {\r
                if (reference)\r
                {\r
-                       /*if (tia->swz.num_components == 1)\r
+#if 0\r
+                       if (tia->swz.num_components == 1)\r
                        {\r
                                /* simple case - adjust the vector's address to point to the selected component */\r
-                       /*      if (!PLAB (file, slang_asm_addr_push, tia->swz.swizzle[0] * 4))\r
+                               if (!PLAB (file, slang_asm_addr_push, tia->swz.swizzle[0] * 4))\r
                                        return 0;\r
                                if (!PUSH (file, slang_asm_addr_add))\r
                                        return 0;\r
                        }\r
-                       else*/\r
+                       else\r
+#endif\r
                        {\r
                                /* two or more vector components are being referenced - the so-called write mask\r
                                 * must be passed to the upper operations and applied when assigning value\r
index afecf08..ca857fa 100644 (file)
@@ -106,6 +106,8 @@ static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggr
                                        ty = slang_asm_float_copy;\r
                                        break;\r
                                default:\r
+                                       _mesa_problem(NULL, "Unexpected arr->type in assign_aggregate");\r
+                                       ty = slang_asm_none;\r
                                        break;\r
                                }\r
                                if (!slang_assembly_file_push_label2 (file, ty, dst_addr_loc, dst_offset))\r
index aa2e019..8d910f3 100644 (file)
@@ -143,7 +143,7 @@ void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left,
 }\r
 \r
 /* _slang_assemble_constructor() */\r
-/*\r
+#if 0\r
 static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat,\r
        unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow,\r
        slang_assembly_name_space *space, slang_assembly_local_info *info)\r
@@ -178,10 +178,10 @@ static int constructor_aggregate (slang_assembly_file *file, const slang_storage
                if (arr1->type != arr2->type)\r
                {\r
                        /* TODO: convert (generic) from arr1 to arr2 */\r
-/*             }\r
+               }\r
                (*index)++;\r
                /* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */\r
-/*     }\r
+       }\r
 \r
        result = 1;\r
 end:\r
@@ -192,8 +192,12 @@ end1:
        slang_assembly_typeinfo_destruct (&ti);\r
        return result;\r
 }\r
+#endif\r
+\r
 /* XXX: general swizzle! */\r
-/*int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,\r
+\r
+#if 0\r
+int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,\r
        slang_assembly_flow_control *flow, slang_assembly_name_space *space,\r
        slang_assembly_local_info *info, struct slang_machine_ *pmach)\r
 {\r
@@ -223,11 +227,11 @@ end1:
        index = 0;\r
        for (i = 0; i < op->num_children; i++)\r
        {\r
-/*             if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow,\r
+               if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow,\r
                        space, info)))\r
                        goto end;\r
                /* TODO: watch the index, if it reaches the size, raise an error */\r
-/*     }\r
+       }\r
 \r
        result = 1;\r
 end:\r
@@ -238,6 +242,7 @@ end1:
        slang_assembly_typeinfo_destruct (&ti);\r
        return result;\r
 }\r
+#endif\r
 \r
 /* _slang_assemble_constructor_from_swizzle() */\r
 \r
index 778ba04..830597e 100644 (file)
@@ -329,6 +329,9 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa
                                        case slang_spec_bool:\r
                                                ti->spec.type = slang_spec_bvec2;\r
                                                break;\r
+                                       default:\r
+                                               _mesa_problem(NULL, "unexepected base in _slang_typeof_operation");\r
+                                               ti->spec.type = slang_spec_void;\r
                                        }\r
                                        break;\r
                                case 3:\r
@@ -343,6 +346,9 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa
                                        case slang_spec_bool:\r
                                                ti->spec.type = slang_spec_bvec3;\r
                                                break;\r
+                                       default:\r
+                                               _mesa_problem(NULL, "unexepected base in _slang_typeof_operation");\r
+                                               ti->spec.type = slang_spec_void;\r
                                        }\r
                                        break;\r
                                case 4:\r
@@ -357,6 +363,9 @@ int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *spa
                                        case slang_spec_bool:\r
                                                ti->spec.type = slang_spec_bvec4;\r
                                                break;\r
+                                       default:\r
+                                               _mesa_problem(NULL, "unexepected base in _slang_typeof_operation");\r
+                                               ti->spec.type = slang_spec_void;\r
                                        }\r
                                        break;\r
                                default:\r
index eb02ccc..02850eb 100644 (file)
@@ -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;\r
+                       return 0;
                /* TODO: execute the initializer */
                break;
-/*     case VARIABLE_ARRAY_UNKNOWN:\r
+#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:\r
-               /* sized array - mark it as array, copy the specifier to the array element and\r
+               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 (