diff options
author | Michal Krol <[email protected]> | 2009-09-04 15:16:21 +0200 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-09-07 10:12:07 +0200 |
commit | 4aa3222df315e3b36c73374e9000a6607c3b995c (patch) | |
tree | 6f8fd9d68f913fa9f15e954c7263580ccc164ddc /src/glsl/pp/sl_pp_version.c | |
parent | 0d9c5eafeb35fdd2e5009ba0b397d1acdfbd3205 (diff) |
glsl: Correctly handle line numbering.
Diffstat (limited to 'src/glsl/pp/sl_pp_version.c')
-rw-r--r-- | src/glsl/pp/sl_pp_version.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/glsl/pp/sl_pp_version.c b/src/glsl/pp/sl_pp_version.c index 89c3cfa1a5b..80f7e971016 100644 --- a/src/glsl/pp/sl_pp_version.c +++ b/src/glsl/pp/sl_pp_version.c @@ -60,6 +60,7 @@ sl_pp_version(struct sl_pp_context *context, unsigned int *tokens_eaten) { unsigned int i = 0; + unsigned int line = context->line; /* Default values if `#version' is not present. */ *version = 110; @@ -77,8 +78,10 @@ sl_pp_version(struct sl_pp_context *context, /* Skip whitespace and newlines and seek for hash. */ while (!found_hash) { switch (input[i].token) { - case SL_PP_WHITESPACE: case SL_PP_NEWLINE: + line++; + /* pass thru */ + case SL_PP_WHITESPACE: i++; break; @@ -156,9 +159,12 @@ sl_pp_version(struct sl_pp_context *context, break; case SL_PP_NEWLINE: + line++; + /* pass thru */ case SL_PP_EOF: i++; *tokens_eaten = i; + context->line = line; found_end = 1; break; |