Age | Commit message (Collapse) | Author |
|
This allows writing tests that verify diagnostics from the preprocessor.
|
|
|
|
The glcpp-test script was leaving around bogus *.valgrind-errors files if
a valgrind test was interrupted.
|
|
After a recent change to glcpp-parse.y
|
|
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).
|
|
|
|
We're already using the return-value of cmp to print either PASS or
FAIL and in the case of failure, we're subsequently running and
showing the output of diff. So any warnings/errors from cmp itself are
not actually needed, and can be quite confusing.
|
|
Commit d4a04f315560704bf1103df0b93723e468725df7 caused this test case
to produce an additional blank line, which is otherwise harmless, but
does need to be reflected in the .expected file for the test to pass.
|
|
After making a minor change to the .y file.
|
|
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.
|
|
Fixes glcpp test cases 073 and 074, as well as piglit test
xonotic-vs-generic-diffuse.vert.
|
|
|
|
The original intention was to use #ifdef.
|
|
|
|
|
|
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.
|
|
|
|
gcc and mesa master agree that this is OK.
|
|
Fixes a valgrind error.
|
|
|
|
Fixes:
glsl-version-define
glsl-version-define-110
glsl-version-define-120
|
|
|
|
Fixes:
glsl-arb-fragment-coord-conventions-define
|
|
This is now consistent with other usage of flex/bison througout mesa,
(which is that these generated files are added to source control so
that the build system does not require external tools like flex/bison
for non-developers).
|
|
I simply forgot to add this file when adding the test case originally.
|
|
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").
|
|
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.
|
|
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)
|
|
In both the preprocessor and in the compiler proper, we use a custom
yyltype struct to allow tracking the source-string number in addition
to line and column. However, we were previously relying on bison's
default initialization of the yyltype struct which of course is not
aware of the source field and leaves it uninitialized.
We fix this by defining our own YYLLOC_DEFAULT macro expanding on the
default version (as appears in the bison manual) and adding
initialization of yylloc.source.
|
|
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.
|
|
Without this, the compiler was legitimately complaining about missing
declarations for all of the functions being defined here.
|
|
This quiets warnings about missing declarations otherwise.
|
|
We define the YY_NO_INPUT macro to avoid one needless function being
generated.
for the other needless functions, (yyunput and yy_top_state), we add a
new UNREACHABLE start condition and call these functions from an
action there. This doesn't change functionality at all, (since we
never enter the UNREACHABLE start condition), but makes the compiler
stop complaining about these two functions being defined but not used.
|
|
It's really a bug in flex that these functions are generated with neither
a declaration nor the 'static' keyword, but we can at least avoid the
warnings this way.
|
|
Previously, if the outer #ifdef/#ifndef evaluated to false, the inner
directive would not be parsed correctly, (the identifier as the subject
of the #ifdef/#ifndef would inadvertently be skipped along with the other
content correctly being skipped).
We fix this by setting the lexing_if state in each case here.
We also add a new test to the test suite to ensure that this case is tested.
|
|
And add a test case to ensure that this works.
|
|
By taking advantage of the recently-added hash_table_remove function.
With this change, all existing tests are now valgrind-clean.
|
|
As it turns out, 4 of our current tests are not valgrind clean,
(use after free errors or so), so this will be helpful for
investigating and fixing those.
|
|
And report PASS or FAIL for each test along the way as well.
|
|
These were only ever intended to exist in the original, standalone
implementation of glcpp, (with the idea of dropping them as soon as
the code moved into mesa). The current build system wasn't compiling
this C file, but the presence of the header files could cause problems
if the two copies diverge in the future.
We head those problems off by deleting al of these redundant files.
|
|
|
|
|
|
The only optional extension currently supported by the compiler is
GL_EXT_texture_array.
|
|
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.
|
|
|