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 6100400fef0f776f9fedb4de36b2e84a368dbd78..3f13b2583a3caa48e7ba38a3b344f4b13b08cba9 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 698b3bf747b2372827db23ac9313346bf6873842..30a80b7f3de3515f99632ddb27477d59772d8353 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 afecf08a491ed747cf479a8cb2770143bdb3a397..ca857fad2fc9f7f041e0fa2524c7cc4150b8adf9 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 aa2e01953888cabd65e198f99cb1edb94922e713..8d910f3c7495f4a98cd867ef8c18e1431498f0c7 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 778ba04ced8be7d2ec1843dc1697357c15ce7e78..830597e9c2e9a376cec6e8b44eac7f9c42f5b62c 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 eb02ccc19917d2c74ebbb02ec01468a18635b300..02850ebf12904f30bdaafc1b68a196c86b26d7b3 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 (