glsl: Cleanly fail when a function has an unknown return type.
authorEric Anholt <eric@anholt.net>
Mon, 23 Aug 2010 20:26:52 +0000 (13:26 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 23 Aug 2010 20:27:36 +0000 (13:27 -0700)
Bug #29608.

src/glsl/ast_to_hir.cpp

index 8e4c3299aa68758756a66f8137bf704d98aad59d..7ac24b06fe78120ddcd9167fe69e134a322aade2 100644 (file)
@@ -2138,7 +2138,13 @@ ast_function::hir(exec_list *instructions,
    const glsl_type *return_type =
       this->return_type->specifier->glsl_type(& return_type_name, state);
 
-   assert(return_type != NULL);
+   if (!return_type) {
+      YYLTYPE loc = this->get_location();
+      _mesa_glsl_error(&loc, state,
+                      "function `%s' has undeclared return type `%s'",
+                      name, return_type_name);
+      return_type = glsl_type::error_type;
+   }
 
    /* From page 56 (page 62 of the PDF) of the GLSL 1.30 spec:
     * "No qualifier is allowed on the return type of a function."