[Mesa-dev] [PATCH 3/6] glsl: Merge candidates are: message to the previous line.

2013-11-23 Thread Kenneth Graunke
Previously, when we hit a no matching function error, it looked like:

0:0(0): error: no matching function for call to `cos()'
0:0(0): error: candidates are: float sin(float)
0:0(0): error:vec2 sin(vec2)
0:0(0): error:vec3 sin(vec3)
0:0(0): error:vec4 sin(vec4)

Now it looks like:

0:0(0): error: no matching function for call to `cos()'; candidates are:
0:0(0): error:float sin(float)
0:0(0): error:vec2 sin(vec2)
0:0(0): error:vec3 sin(vec3)
0:0(0): error:vec4 sin(vec4)

This is not really any worse and removes the need for the prefix variable.
It will also help with the next commit's refactoring.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/glsl/ast_function.cpp | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 82456ad..6def25a 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -432,11 +432,11 @@ no_matching_function_error(const char *name,
   _mesa_glsl_parse_state *state)
 {
char *str = prototype_string(NULL, name, actual_parameters);
-   _mesa_glsl_error(loc, state, no matching function for call to `%s', str);
+   _mesa_glsl_error(loc, state,
+no matching function for call to `%s'; candidates are:,
+str);
ralloc_free(str);
 
-   const char *prefix = candidates are: ;
-
for (int i = -1; i  (int) state-num_builtins_to_link; i++) {
   glsl_symbol_table *syms = i = 0 ? state-builtins_to_link[i]-symbols
   : state-symbols;
@@ -451,10 +451,8 @@ no_matching_function_error(const char *name,
 continue;
 
 str = prototype_string(sig-return_type, f-name, sig-parameters);
-_mesa_glsl_error(loc, state, %s%s, prefix, str);
+_mesa_glsl_error(loc, state,%s, str);
 ralloc_free(str);
-
-prefix = ;
   }
}
 }
-- 
1.8.4.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/6] glsl: Merge candidates are: message to the previous line.

2013-11-23 Thread Chris Forbes
One would hope that it doesn't actually offer overloads of sin() when
you tried to call cos()?

Actual change looks good;

Reviewed-by: Chris Forbes chr...@ijw.co.nz

On Sun, Nov 24, 2013 at 10:43 AM, Kenneth Graunke kenn...@whitecape.org wrote:
 Previously, when we hit a no matching function error, it looked like:

 0:0(0): error: no matching function for call to `cos()'
 0:0(0): error: candidates are: float sin(float)
 0:0(0): error:vec2 sin(vec2)
 0:0(0): error:vec3 sin(vec3)
 0:0(0): error:vec4 sin(vec4)

 Now it looks like:

 0:0(0): error: no matching function for call to `cos()'; candidates are:
 0:0(0): error:float sin(float)
 0:0(0): error:vec2 sin(vec2)
 0:0(0): error:vec3 sin(vec3)
 0:0(0): error:vec4 sin(vec4)

 This is not really any worse and removes the need for the prefix variable.
 It will also help with the next commit's refactoring.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/glsl/ast_function.cpp | 10 --
  1 file changed, 4 insertions(+), 6 deletions(-)

 diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
 index 82456ad..6def25a 100644
 --- a/src/glsl/ast_function.cpp
 +++ b/src/glsl/ast_function.cpp
 @@ -432,11 +432,11 @@ no_matching_function_error(const char *name,
_mesa_glsl_parse_state *state)
  {
 char *str = prototype_string(NULL, name, actual_parameters);
 -   _mesa_glsl_error(loc, state, no matching function for call to `%s', 
 str);
 +   _mesa_glsl_error(loc, state,
 +no matching function for call to `%s'; candidates are:,
 +str);
 ralloc_free(str);

 -   const char *prefix = candidates are: ;
 -
 for (int i = -1; i  (int) state-num_builtins_to_link; i++) {
glsl_symbol_table *syms = i = 0 ? state-builtins_to_link[i]-symbols
: state-symbols;
 @@ -451,10 +451,8 @@ no_matching_function_error(const char *name,
  continue;

  str = prototype_string(sig-return_type, f-name, sig-parameters);
 -_mesa_glsl_error(loc, state, %s%s, prefix, str);
 +_mesa_glsl_error(loc, state,%s, str);
  ralloc_free(str);
 -
 -prefix = ;
}
 }
  }
 --
 1.8.4.4

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev