From 8e8f8ff1b25a4cfd332d9e7c86d3d56cdff98d6a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 20 Jun 2014 19:17:28 -0700 Subject: [PATCH] glsl/glcpp: Fix off-by-one error in column in first-line error messages For the first line we were initializing the column to 1, but for all subsequent lines we were initializing the column to 0. The column number is advanced for each token read before any error message is printed. So the 0 value is the correct initialization, (so that the first column is reported as column 1). With this extremely minor change, many of the .expected files are updated such that error messages for the first line now have the correct column number in them. Reviewed-by: Jordan Justen --- src/glsl/glcpp/glcpp-lex.l | 2 +- src/glsl/glcpp/tests/077-else-without-if.c.expected | 2 +- src/glsl/glcpp/tests/078-elif-without-if.c.expected | 2 +- src/glsl/glcpp/tests/079-endif-without-if.c.expected | 2 +- src/glsl/glcpp/tests/083-unterminated-if.c.expected | 2 +- src/glsl/glcpp/tests/086-reserved-macro-names.c.expected | 2 +- src/glsl/glcpp/tests/090-hash-error.c.expected | 2 +- src/glsl/glcpp/tests/093-divide-by-zero.c.expected | 2 +- src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected | 2 +- .../glcpp/tests/108-no-space-after-hash-version.c.expected | 2 +- src/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected | 2 +- src/glsl/glcpp/tests/120-undef-builtin.c.expected | 2 +- src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected | 2 +- src/glsl/glcpp/tests/126-garbage-after-directive.c.expected | 2 +- src/glsl/glcpp/tests/129-define-non-identifier.c.expected | 4 ++-- .../glcpp/tests/132-eof-without-newline-define.c.expected | 4 ++-- .../glcpp/tests/133-eof-without-newline-comment.c.expected | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index 3e533ceda4e..798ff4c1a7b 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -57,7 +57,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); #define YY_USER_INIT \ do { \ yylineno = 1; \ - yycolumn = 1; \ + yycolumn = 0; \ yylloc->source = 0; \ } while(0) diff --git a/src/glsl/glcpp/tests/077-else-without-if.c.expected b/src/glsl/glcpp/tests/077-else-without-if.c.expected index 64e6d1ac93e..69f34047033 100644 --- a/src/glsl/glcpp/tests/077-else-without-if.c.expected +++ b/src/glsl/glcpp/tests/077-else-without-if.c.expected @@ -1,3 +1,3 @@ -0:1(2): preprocessor error: #else without #if +0:1(1): preprocessor error: #else without #if diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c.expected b/src/glsl/glcpp/tests/078-elif-without-if.c.expected index f3530ed2c07..b8e40ecc09b 100644 --- a/src/glsl/glcpp/tests/078-elif-without-if.c.expected +++ b/src/glsl/glcpp/tests/078-elif-without-if.c.expected @@ -1,3 +1,3 @@ -0:1(2): preprocessor error: #elif without #if +0:1(1): preprocessor error: #elif without #if diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c.expected b/src/glsl/glcpp/tests/079-endif-without-if.c.expected index ad21d4c9579..7ae579dd25e 100644 --- a/src/glsl/glcpp/tests/079-endif-without-if.c.expected +++ b/src/glsl/glcpp/tests/079-endif-without-if.c.expected @@ -1,3 +1,3 @@ -0:1(2): preprocessor error: #endif without #if +0:1(1): preprocessor error: #endif without #if diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c.expected b/src/glsl/glcpp/tests/083-unterminated-if.c.expected index b03f9ccf95f..4659ab6fe67 100644 --- a/src/glsl/glcpp/tests/083-unterminated-if.c.expected +++ b/src/glsl/glcpp/tests/083-unterminated-if.c.expected @@ -1,4 +1,4 @@ -0:1(7): preprocessor error: Unterminated #if +0:1(6): preprocessor error: Unterminated #if diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected index f0b1373d760..38b089daec3 100644 --- a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected @@ -1,4 +1,4 @@ -0:1(10): preprocessor warning: Macro names containing "__" are reserved for use by the implementation. +0:1(9): preprocessor warning: Macro names containing "__" are reserved for use by the implementation. 0:2(9): preprocessor error: Macro names starting with "GL_" are reserved. diff --git a/src/glsl/glcpp/tests/090-hash-error.c.expected b/src/glsl/glcpp/tests/090-hash-error.c.expected index b9b226bb4e1..32954f7380e 100644 --- a/src/glsl/glcpp/tests/090-hash-error.c.expected +++ b/src/glsl/glcpp/tests/090-hash-error.c.expected @@ -1,2 +1,2 @@ -0:1(2): preprocessor error: #error human error +0:1(1): preprocessor error: #error human error diff --git a/src/glsl/glcpp/tests/093-divide-by-zero.c.expected b/src/glsl/glcpp/tests/093-divide-by-zero.c.expected index 9adae3f9d55..a858870b794 100644 --- a/src/glsl/glcpp/tests/093-divide-by-zero.c.expected +++ b/src/glsl/glcpp/tests/093-divide-by-zero.c.expected @@ -1,3 +1,3 @@ -0:1(13): preprocessor error: division by 0 in preprocessor directive +0:1(12): preprocessor error: division by 0 in preprocessor directive diff --git a/src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected b/src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected index f9f5f1976f7..b053b399775 100644 --- a/src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected +++ b/src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected @@ -1,4 +1,4 @@ 0:2(7): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE -0:1(7): preprocessor error: Unterminated #if +0:1(6): preprocessor error: Unterminated #if diff --git a/src/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected b/src/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected index 748bfe19b36..462166c9801 100644 --- a/src/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected +++ b/src/glsl/glcpp/tests/108-no-space-after-hash-version.c.expected @@ -1 +1 @@ -0:1(3): preprocessor error: Invalid tokens after # +0:1(2): preprocessor error: Invalid tokens after # diff --git a/src/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected b/src/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected index 748bfe19b36..462166c9801 100644 --- a/src/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected +++ b/src/glsl/glcpp/tests/109-no-space-after-hash-line.c.expected @@ -1 +1 @@ -0:1(3): preprocessor error: Invalid tokens after # +0:1(2): preprocessor error: Invalid tokens after # diff --git a/src/glsl/glcpp/tests/120-undef-builtin.c.expected b/src/glsl/glcpp/tests/120-undef-builtin.c.expected index 339ea4fc617..cdb9c29adfb 100644 --- a/src/glsl/glcpp/tests/120-undef-builtin.c.expected +++ b/src/glsl/glcpp/tests/120-undef-builtin.c.expected @@ -1,4 +1,4 @@ -0:1(2): preprocessor error: Built-in (pre-defined) macro names can not be undefined. +0:1(1): preprocessor error: Built-in (pre-defined) macro names can not be undefined. 0:2(1): preprocessor error: Built-in (pre-defined) macro names can not be undefined. 0:3(1): preprocessor error: Built-in (pre-defined) macro names can not be undefined. diff --git a/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected b/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected index f9f5f1976f7..b053b399775 100644 --- a/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected +++ b/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected @@ -1,4 +1,4 @@ 0:2(7): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE -0:1(7): preprocessor error: Unterminated #if +0:1(6): preprocessor error: Unterminated #if diff --git a/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected b/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected index 283963db5cf..82a06f8a3b3 100644 --- a/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected +++ b/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected @@ -1,4 +1,4 @@ -0:1(15): preprocessor error: extra tokens at end of directive +0:1(14): preprocessor error: extra tokens at end of directive 0:4(14): preprocessor error: extra tokens at end of directive diff --git a/src/glsl/glcpp/tests/129-define-non-identifier.c.expected b/src/glsl/glcpp/tests/129-define-non-identifier.c.expected index b460357fe20..fd0b41347fa 100644 --- a/src/glsl/glcpp/tests/129-define-non-identifier.c.expected +++ b/src/glsl/glcpp/tests/129-define-non-identifier.c.expected @@ -1,2 +1,2 @@ -0:1(10): preprocessor error: #define followed by a non-identifier: 123 -0:1(10): preprocessor error: syntax error, unexpected INTEGER_STRING, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER +0:1(9): preprocessor error: #define followed by a non-identifier: 123 +0:1(9): preprocessor error: syntax error, unexpected INTEGER_STRING, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER diff --git a/src/glsl/glcpp/tests/132-eof-without-newline-define.c.expected b/src/glsl/glcpp/tests/132-eof-without-newline-define.c.expected index a3ace0f3966..57dee695714 100644 --- a/src/glsl/glcpp/tests/132-eof-without-newline-define.c.expected +++ b/src/glsl/glcpp/tests/132-eof-without-newline-define.c.expected @@ -1,2 +1,2 @@ -0:1(2): preprocessor error: #define without macro name -0:1(2): preprocessor error: syntax error, unexpected NEWLINE, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER +0:1(1): preprocessor error: #define without macro name +0:1(1): preprocessor error: syntax error, unexpected NEWLINE, expecting FUNC_IDENTIFIER or OBJ_IDENTIFIER diff --git a/src/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected b/src/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected index 506eb561756..d186f48761f 100644 --- a/src/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected +++ b/src/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected @@ -1,2 +1,2 @@ -0:1(52): preprocessor error: Unterminated comment +0:1(51): preprocessor error: Unterminated comment This file ends with no newline within a comment -- 2.30.2