History log of /external/mesa3d/src/glsl/glcpp/glcpp-parse.y
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a3f5601465086bfcda4e68c3c55a284dd84879c6 06-Nov-2012 Matt Turner <mattst88@gmail.com> glcpp: Reject garbage after #else and #endif tokens

Previously we were accepting garbage after #else and #endif tokens when
the previous preprocessor conditional evaluated to false (eg, #if 0).

When the preprocessor hits a false conditional, it switches the lexer
into the SKIP state, in which it ignores non-control tokens. The parser
pops the SKIP state off the stack when it reaches the associated #elif,
#else, or #endif. Unfortunately, that meant that it only left the SKIP
state after the lexing the entire line containing the #token and thus
would accept garbage after the #token.

To fix this we use a mid-rule, which is executed immediately after the
#token is parsed.

NOTE: This is a candidate for the stable branch
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56442
Fixes: preprocess17_frag.test from oglconform
Reviewed-by: Carl Worth <cworth@cworth.org> (glcpp-parse.y)
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 060e69679925f171cfcc2a5f84fab1d833a7e804)
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
a908f4a75401284dd45bf559de18c83adaacb335 22-Oct-2012 Kenneth Graunke <kenneth@whitecape.org> glcpp: Don't use infinite lookhead for #define differentiation.

Previously, we used lookahead patterns to differentiate:

#define FOO(x) function macro
#define FOO (x) object macro

Unfortunately, our rule for function macros:

{HASH}define{HSPACE}+/{IDENTIFIER}"("

relies on infinite lookahead, and apparently triggers a Flex bug where
the generated code overflows a state buffer (see YY_STATE_BUF_SIZE).

There's no need to use infinite lookahead. We can simply change state,
match the identifier, and use a single character lookahead for the '('.
This apparently makes Flex not generate the giant state array, which
avoids the buffer overflow, and should be more efficient anyway.

Fixes piglit test 17000-consecutive-chars-identifier.frag.

NOTE: This is a candidate for every release branch ever.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Carl Worth <cworth@cworth.org>
(cherry picked from commit 9142ade15416415f2d5eb20b093b898c649cd2bb)
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
8f7990c5f2ca25e42c7fefff6312bee2ff77e134 14-Sep-2012 Dave Airlie <airlied@gmail.com> glcpp: fix abuse of yylex

So glcpp tried to workaround yylex its own way, but failed,
do it properly.

This fixes another crash found after fixing the first crash.

this is a candidate for 9.0 and stable branches

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a)
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
dcf8754cce1af09547a5976a74ba807bc6f2657c 28-Jul-2012 Kenneth Graunke <kenneth@whitecape.org> glcpp: Add a newline to expanded #line directives.

Otherwise, the preprocessor happily outputs

#line 2 4 <your next line of code>

and the main compiler gets horribly confused and fails to compile.

This is not the right solution (line numbers in error messages will
likely be off-by-one in certain circumstances), but until Carl comes
up with a proper fix, this gets programs running again.

Fixes regressions in Regnum Online, Overgrowth, Piglit, and others since
commit aac78ce8234d96932c38b3f48b1d828077bc0027.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51802
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51506
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41152
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
532e99cbf26d175220eac245b12011939ea07d0c 04-Jul-2012 Kenneth Graunke <kenneth@whitecape.org> glcpp: Add built-in #define for GL_ARB_uniform_buffer_object.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
aac78ce8234d96932c38b3f48b1d828077bc0027 10-Jun-2012 Carl Worth <cworth@cworth.org> glsl: glcpp: Move handling of #line directives from lexer to parser.

The GLSL specification requires that #line directives be interpreted
after macro expansion. Our existing implementation of #line macros in
the lexer prevents conformance on this point.

Moving the handling of #line from the lexer to the parser gives us the
macro expansion we need. An additional benefit is that the
preprocessor also now supports comments on the same line as #line
directives.

Finally, the preprocessor now emits the (fully-macro-expanded) #line
directives into the output. This allows the full GLSL compiler to also
see and interpret these directives so it can also generate correct
line numbers in error messages.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
39f8c46eaa4d1c3b072cd97d256fe973c1791b14 10-Jun-2012 Carl Worth <cworth@cworth.org> glsl: glcpp: Rename and document _glcpp_parser_expand_if

This function is currently used only in the expansion of #if lines,
but we will soon be using it more generally (for the expansion of
(_glcpp_parser_expand_and_lex_from) and some more documentation.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
c96b8302a398a6db27f1bb6070cdc088c7ee0fba 09-Jun-2012 Carl Worth <cworth@cworth.org> glsl: glcpp: Allow "#if undefined-macro' to evaluate to false.

A strict reading of the GLSL specification would have this be an
error, but we've received reports from users who expect the
preprocessor to interepret undefined macros as 0. This is the standard
behavior of the rpeprocessor for C, and according to these user
reports is also the behavior of other OpenGL implementations.

So here's one of those cases where we can make our users happier by
ignoring the specification. And it's hard to imagine users who really,
really want to see an error for this case.

The two affected tests cases are updated to reflect the new behavior.

Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
199771bc325900eb1d3acc7fa03808894a94fdb2 30-Apr-2012 Olivier Galibert <galibert@pobox.com> glsl: Scaffolding for ARB_shader_bit_encoding.

That adds support for activating the extension. It doesn't actually
*do* anything yet, of course.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
b823b99ec0f13af257dcd885f436a4d294c6222a 10-Feb-2012 Kenneth Graunke <kenneth@whitecape.org> glcpp: Don't strlen() the output for every token being printed.

The ralloc string appending functions were originally intended for
simple, non-hot-path uses like printing to an info log.

Cuts Unigine Tropics load time by around 20% (6 seconds).

v2: Avoid strlen() on every newline, too.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Acked-by: José Fonseca <jfonseca@vmware.com> [v1]
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
cd2e2187cb45accb13bf89ef297324332c46f379 02-Feb-2012 Carl Worth <cworth@cworth.org> glsl: Avoid ralloc_stealing a long-lived object to a short-lived parent

In commit 6ecee54a9aecc120cb68b02f7e14dcac86b9eca2 a call to
talloc_reference was replaced with a call to talloc_steal. This was in
preparation for moving to ralloc which doesn't support reference
counting.

The justification for talloc_steal within token_list_append in that
commit is that the tokens are being copied already. But the copies are
shallow, so this does not work.

Fortunately, the lifetime of these tokens is easy to understand. A
token list for "replacements" is created and stored in a hash table
when a function-like macro is defined. This list will live until the
macro is #undefed (if ever).

Meanwhile, a shallow copy of the list is created when the macro is
used and the list expanded. This copy is short-lived, so is unsuitable
as a new parent.

So we can just let the original, longer-lived owner continue to own
the underlying objects and things will work.

This fixes bug #45082:

"ralloc.c:78: get_header: Assertion `info->canary == 0x5A1106'
failed." when using a macro in GLSL
https://bugs.freedesktop.org/show_bug.cgi?id=45082

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

NOTE: This is a candidate for stable release branches.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
bbcb648bc2f45dd85e33c7301527c8f6d97cbce6 19-Nov-2011 Marek Olšák <maraeo@gmail.com> mesa: rename the AMD_conservative_depth extension flag to ARB

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
54346d1f9b31de531c202ffe26b72551326ad7ae 11-Nov-2011 Morgan Armand <morgan.devel@gmail.com> glcpp: Add GL_ARB_draw_instanced #define.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
2903816aadb281716b6c59a5a48aeadb84a08f50 23-Oct-2011 Chia-I Wu <olv@lunarg.com> glsl: add support for GL_OES_EGL_image_external

This extension introduces a new sampler type: samplerExternalOES.
texture2D (and texture2DProj) can be used to do a texture look up in an
external texture.

Reviewed-by: Brian Paul <brianp@vmware.com>
Acked-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
c4aaf7943c2cdff0e2148b5c05813356dc99696d 30-Sep-2011 Carl Worth <cworth@cworth.org> glcpp: Raise error if defining any macro containing two consecutive underscores

The specification reserves any macro name containing two consecutive
underscores, (anywhere within the name). Previously, we only raised
this error for macro names that started with two underscores.

Fix the implementation to check for two underscores anywhere, and also
update the corresponding 086-reserved-macro-names test.

This also fixes the following two piglit tests:

spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag
spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Carl Worth <cworth@cworth.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
28842c2331e6df2cbe18c0be3487ece93680075d 30-Sep-2011 Carl Worth <cworth@cworth.org> glcpp: Implement token pasting for non-function-like macros

This is as simple as abstracting one existing block of code into a
function call and then adding a single call to that function for the
case of a non-function-like macro.

This fixes the recently-added 097-paste-with-non-function-macro test
as well as the following piglit tests:

spec/glsl-1.30/preprocessor/concat/concat-01.frag
spec/glsl-1.30/preprocessor/concat/concat-02.frag

Also, the concat-04.frag test now passes for the right reason. The
test is intended to fail the compilation, but before this commit it
was failing compilation (and hence passing the test) for the wrong
reason.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
3c01a589448b92945f26bd7e3bfa75155c06f3cf 30-Sep-2011 Carl Worth <cworth@cworth.org> glcpp: Fix two (or more) successive applications of token pasting

There was already a loop here to look for multiple token pastes, but
it was mistakenly incrementing the iterator counter after performing
one paste.

Instead, leave the loop iterator in place to coalesce as many tokens
as necessary into one.

This fixes the recently add 096-paste-twice test as well as the
following piglit test:

spec/glsl-1.30/preprocessor/concat/concat-03.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
778ecc928388b2905d516743d0bdf19ffce03acb 25-Aug-2011 Kenneth Graunke <kenneth@whitecape.org> glcpp: Add GL_ARB_conservative_depth #define.

Forgotten in the patch that enabled the extension.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
5a3a242a8fc4b9f0cac0e40786dd0c4831517473 19-Oct-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Add compiler support for ARB_shader_texture_lod.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Marek Olšák <maraeo@gmail.com>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
9dacbe222641443af000a82161922a5ade206340 15-Apr-2011 Carl Worth <cworth@cworth.org> glcpp: Fix attempts to expand recursive macros infinitely (bug #32835).

The 095-recursive-define test case was triggering infinite recursion
with the following test case:

#define A(a, b) B(a, b)
#define C A(0, C)
C

Here's what was happening:

1. "C" was pushed onto the active list to expand the C node

2. While expanding the "0" argument, the active list would be
emptied by the code at the end of _glcpp_parser_expand_token_list

3. When expanding the "C" argument, the active list was now empty,
so lather, rinse, repeat.

We fix this by adjusting the final popping at the end of
_glcpp_parser_expand_token_list to never pop more nodes then this
particular invocation had pushed itself. This is as simple as saving
the original state of the active list, and then interrupting the
popping when we reach this same state.

With this fix, all of the glcpp-test tests now pass.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32835
Signed-off-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
02d293c08ee2375fc43b343bfc9b074f33a9063c 15-Apr-2011 Carl Worth <cworth@cworth.org> glcpp: Simplify calling convention of parser's active_list functions

These were all written as generic list functions, (accepting and returning
a list to act upon). But they were only ever used with parser->active as
the list. By simply accepting the parser itself, these functions can update
parser->active and now return nothing at all. This makes the code a bit
more compact.

And hopefully the code is no less readable since the functions are also
now renamed to have "_parser_active" in the name for better correlation
with nearby tests of the parser->active field.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
fd1252ab67abb1ea351195e192429f292667a8a2 02-Feb-2011 Chad Versace <chad.versace@intel.com> glcpp: Raise error when modulus is zero

For example, this now raises an error:
#define XXX 1 / 0

Fixes bug: https://bugs.freedesktop.org//show_bug.cgi?id=33507
Fixes Piglit test: spec/glsl-1.10/preprocessor/modulus-by-zero.vert

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
aacd07d623d60356cfad9f96a261310e12eed7c0 31-Jan-2011 Brian Paul <brianp@vmware.com> glsl: make _token_list_is_empty_ignoring_space() static

To silence warning about missing prototype.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
d3073f58c17d8675a2ecdd5dfa83e5520c78e1a8 21-Jan-2011 Kenneth Graunke <kenneth@whitecape.org> Convert everything from the talloc API to the ralloc API.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
2a18d1950c84c96d263cc8f15434502e03aeb1dc 28-Jan-2011 Carl Worth <cworth@cworth.org> Revert "glcpp: Demote "macro redefined" from an error to a warning"

This reverts commit d3df641f0aba99b0b65ecd4d9b06798bca090a29.

The original commit had sat unpushed on my machine for months. By the
time I found it again, I had forgotten that we had decided not to use
this change after all, (the relevant test was removed long ago).
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
d3df641f0aba99b0b65ecd4d9b06798bca090a29 23-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Demote "macro redefined" from an error to a warning

The GLSL specification is vague here, (just says "as is standard for
C++"), though the C specifications seem quite clear that this should
be an error.

However, an existing piglit test (CorrectPreprocess11.frag) expects
this to be a warning, not an error, so we change this, and document in
README the deviation from the specification.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
0423f24eb8a415cf704c307c93e2a8647e799002 27-Jan-2011 Chad Versace <chad.versace@intel.com> glcpp: Conditionally define macro GL_AMD_conservative_depth

Define macro GL_AMD_conservative_depth to 1 when its extension is
enabled.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
6ecee54a9aecc120cb68b02f7e14dcac86b9eca2 16-Jan-2011 Kenneth Graunke <kenneth@whitecape.org> glcpp: Remove use of talloc reference counting.

We almost always want to simply steal; we only need to copy when copying
a token list (in which case we're already cloning stuff anyway).
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
9ca5300b6e781150cec903c73cf5fd8e1deee2f1 10-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glcpp: Generate an error for division by zero

When GCC encounters a division by zero in a preprocessor directive, it
generates an error. Since the GLSL spec says that the GLSL
preprocessor behaves like the C preprocessor, we should generate that
same error.

It's worth noting that I cannot find any text in the C99 spec that
says this should be an error. The only text that I can find is line 5
on page 82 (section 6.5.5 Multiplicative Opertors), which says,

"The result of the / operator is the quotient from the division of
the first operand by the second; the result of the % operator is
the remainder. In both operations, if the value of the second
operand is zero, the behavior is undefined."

Fixes 093-divide-by-zero.c test and bugzilla #32831.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
4fff52f1c973f2f284c142fbb31536a9656767c9 11-Jan-2011 Chad Versace <chad.versace@intel.com> glcpp: Fix segfault when validating macro redefinitions

In _token_list_equal_ignoring_space(token_list_t*, token_list_t*), add
a guard that prevents dereferncing a null token list.

This fixes test src/glsl/glcpp/tests/092-redefine-macro-error-2.c and
Bugzilla #32695.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
800eed6765d43d35a338d3135b3204fa6a318afd 07-Dec-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Don't emit SPACE tokens in conditional_tokens production.

Fixes glslparsertest defined-01.vert.

Reported-by: José Fonseca <jfonseca@vmware.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Carl Worth <cworth@cworth.org>
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
d719bf8fb4b8f511fbb00dd990fb644efc510c0e 17-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.

This is really supposed to be defined only if the driver supports highp
in the fragment shader - but all of our current ES2 implementations do.
So, just define it. In the future, we'll need to add a flag to
gl_context and only define the macro if the flag is set.

"Fixes" freedesktop.org bug #31673.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
3fb83038a05bfcbc41e649b0b6c1a2c6ff41124c 17-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Define GL_FRAGMENT_PRECISION_HIGH if GLSL version >= 1.30.

Per section 4.5.4 of the GLSL 1.30 specification.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
e0c9f67be5c47273416a50e011f70aa9e2021a65 06-Oct-2010 Ian Romanick <ian.d.romanick@intel.com> glcpp: Add the define for ARB_explicit_attrib_location when present
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
48e789d71e01b0a7185555735b4a26b1a53d0825 08-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Fix build on non-GCC compilers.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
7dcfc44b72f00ba5a38cb02123c80113440f0de9 05-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Define GL_ES preprocessor macro if API is OpenGL ES 2.0.

Also define it if #version 100 is encountered.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
bfd7c9ac228c7ed8aec04c3b3aa33f40ee00b035 23-Aug-2010 Chia-I Wu <olv@lunarg.com> glsl: Include main/core.h.

Make glsl include only main/core.h from core mesa.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
3882cf21696d2576bd3d855dbc97c9354f72a15f 18-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Add support for "redefined macro" error.

Carefully avoiding printing any error when the new definition matches
the existing definition.

This fixes the recently-added 088-redefine-macro-legitimate.c and
089-redefine-macro-error.c tests as well as glsparsertest/preprocess1
in piglit.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
6be3a8b70af4ba4fa4d037d54ecf6d5f055edbc9 16-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Remove spurious newline generated by #version handling.

This was causing line numbering to be off by one. The newline comes
from the NEWLINE token at the end of the line; there's no need to
insert one.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
9349379d1acca23e7a2442549e49e9b58515d731 14-Aug-2010 José Fonseca <jfonseca@vmware.com> Revert "glsl2: Use stdint.h instead of inttypes.h"

This reverts commit a77a6bc008b3146c56431fa520a00e1f8dfa3938.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
07ca55b7fa09b8b5c08f8e2e45f9060020593783 14-Aug-2010 Vinson Lee <vlee@vmware.com> Fix an MSVC build error (bugzilla 29570).
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
a77a6bc008b3146c56431fa520a00e1f8dfa3938 14-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Use stdint.h instead of inttypes.h
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
4ca4edd20e10415d7aabcf2ba6ca89e9401854ef 12-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Commit generated file changed by previous commit
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
da6b10a7eb26c8a13056cbae9015d5b84f134142 11-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Fix "unterminated if" diagnostic.

This was previously being appended to the output string *after* a copy
of the supposedly final string was made and handed to the caller. So
the diagnostic was never actually visible to the user.

We fix this by moving the check for an unterminated #if from
glcpp_parser_destroy to the calling function, preprocess.

This fixes the test case 083-unterminated-if.c.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
253cad3f424f71f6984431e5edbde1694ccfae3f 11-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Add an explicit diagnostic for #if with no expression.

This is more clear than the previously-generated diagnostic which was
something confusing like "enexpected newline".

This change makse test 080-if-witout-expression.c now pass.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
624dd585c72103e5bffbc600cdf7bdfba5305a15 11-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Reword diagnostic for #elif with no expression

Rather than telling the user what to fix, the standard convention is to
describe what the detected problem is. With this change, test
081-elif-without-expression now passes.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
48ba058e7a4b808271ca987b1553efd7e9792da9 11-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Additional fixes for not evaluating skipped #if/#elif expressions.

This adds a couple of test cases to expand our coverage of invalid #if and
being skipped, (either by being nested inside an #if/#elif that evaluates to
zero or by being after an #if/#elif that evaluates to non-zero).
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
485f84d36608b4545fc5a0061f9ab3ac71b9e36e 11-Aug-2010 Carl Worth <cworth@cworth.org> glcpp: Initialize location structure at beginning of parse.

Since we have a custom structure for YYLTYPE locations, we need to use
an %initial-action directive to avoid triggering use of uninitialized
memory when, for example, printing error messages.

We apparently don't yet have a test case that allowed valgrind to find
this bug for us, but valgrind found a similar problem in the other
parser, so we fix this one as well.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
f4239872c9cb56d1e5735b62ea53bedf3f39dfb0 05-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Ignore #if and #elif expressions when skipping.

Fixes glcpp test cases 073 and 074, as well as piglit test
xonotic-vs-generic-diffuse.vert.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
16b4eed59a07f5e07587f4f9b0cdc304a08a685c 05-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Refactor HASH_IF and HASH_ELIF expansion to reuse code.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
1ffc1cd86186ae5d03bb28a1e041c4a57761515e 04-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glcpp: Remove xtalloc wrappers in favor of plain talloc.

Calling exit() on a memory failure probably made sense for the
standalone preprocessor, but doesn't seem too appealing as part of
the GL library. Also, we don't use it in the main compiler.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
d6942460cec5ffb69dfee7492f7dac59872735de 29-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Actually fix glsl-version-define.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
d4a04f315560704bf1103df0b93723e468725df7 29-Jul-2010 Eric Anholt <eric@anholt.net> glcpp: Add __VERSION__ define to the current language version.

Fixes:
glsl-version-define
glsl-version-define-110
glsl-version-define-120
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
8605c297cfb8068737991601f163f866395c41c9 29-Jul-2010 Eric Anholt <eric@anholt.net> glcpp: Print integer tokens as decimal, not hex.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
0c7b37c8367e72e7b4295cd249561e5c3079d161 28-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add the define for ARB_fragment_coord_conventions when present.

Fixes:
glsl-arb-fragment-coord-conventions-define
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
efef950f393dfe6cb7ef60bee646f2197143df41 28-Jul-2010 Carl Worth <cworth@cworth.org> glcpp: Explicitly expect 0 shift/reduce conflicts.

The "%expect 0" construct will make bison emit an error if any future
changes to the grammar introduce shift/reduce conflicts, (without also
increasing the number after "%expect").
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
2233d10442f1e19d18693fc030aefe292b14cf29 28-Jul-2010 Carl Worth <cworth@cworth.org> glcpp: Remove 2 shift/reduce conflicts from the grammar.

Since we have productions to turn "defined FOO" and "defined ( FOO )"
into a conditional_token we don't need to list DEFINED as an operator
as well. Doing so just introduces the shift/reduce ambiguity with no
benefit.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
fbe4240626bfe102a9c4c889ee18cb9ea27bddec 23-Jul-2010 Carl Worth <cworth@cworth.org> glcpp: Fix function-like macros with an argument used multiple times.

It's really hard to believe that this case has been broken, but apparently
no test previously exercised it. So this commit adds such a test and fixes
it by making a copy of the argument token-list before expanding it.

This fix causes the following glean tests to now pass:

glsl1-Preprocessor test 6 (#if 0, #define macro)
glsl1-Preprocessor test 7 (multi-line #define)
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
e1acbfca322c4ac720707ec8d3fda08fab65a30b 21-Jul-2010 Carl Worth <cworth@cworth.org> glcpp: Avoid accidental token pasting in preprocessed result.

Consider this test case:

#define EMPTY
int foo = 1+EMPTY+4;

The expression should compile as the sequence of tokens 1, PLUS,
UNARY_POSITIVE, 4. But glcpp has been failing for this case since it
results in the string "1++4" which a compiler correctly sees as a
syntax error, (1, POST_INCREMENT, 4).

We fix this by changing any macro with an empty definition to result
in a single SPACE token rather than nothing. This then gives "1+ +4"
which compiles correctly.

This commit does touch up the two existing test cases which already
have empty macros, (to add the space to the expected result).

It also adds a new test case to exercise the above scenario.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
d80dcaf427e12a5cba9cfc5bcd1b485572a2714b 21-Jul-2010 Carl Worth <cworth@cworth.org> glcpp: Add static keyword to several functions in the parser.

This quiets warnings about missing declarations otherwise.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
61ebc01dfecda0963a184e881ea966e2d92f0519 20-Jul-2010 Carl Worth <cworth@cworth.org> glcpp: Fix use-after-free error from #undef directive.

By taking advantage of the recently-added hash_table_remove function.

With this change, all existing tests are now valgrind-clean.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
06143ea09411aa283ac3633bfbfa4326584cd952 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Conditionally define preprocessor tokens for optional extensions

The only optional extension currently supported by the compiler is
GL_EXT_texture_array.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
2d1223611700b33aab084f1927bfc1ff1b284115 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Define preprocessor tokens for extensions

Currently only GL_ARB_draw_buffers and GL_ARB_texture_rectangle are
defined because those extensions are always enabled. This make
tex_rect-03.frag pass.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y
29285882676388aacff123e8bdf025904abf8ea9 25-Jun-2010 Eric Anholt <eric@anholt.net> glsl2: Move the compiler to the subdirectory it will live in in Mesa.
/external/mesa3d/src/glsl/glcpp/glcpp-parse.y