summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp
Commit message (Collapse)AuthorAgeFilesLines
* glcpp: Avoid accidental token pasting in preprocessed result.Carl Worth2010-07-205-5/+43
| | | | | | | | | | | | | | | | | | | | | 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.
* glcpp: Add missing include in xtalloc.cCarl Worth2010-07-201-1/+1
| | | | | Without this, the compiler was legitimately complaining about missing declarations for all of the functions being defined here.
* glcpp: Add static keyword to several functions in the parser.Carl Worth2010-07-201-3/+3
| | | | This quiets warnings about missing declarations otherwise.
* glcpp: Avoid warnings in generated flex code.Carl Worth2010-07-201-1/+12
| | | | | | | | | | | 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.
* glcpp-lex: Declare some generated functions to eliminate compiler warnings.Carl Worth2010-07-201-0/+5
| | | | | | 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.
* glcpp: Fix support for nested #ifdef and nested #ifndefCarl Worth2010-07-203-2/+85
| | | | | | | | | | | 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.
* glcpp: Support #if(expression) with no intervening space.Carl Worth2010-07-203-1/+8
| | | | And add a test case to ensure that this works.
* glcpp: Fix use-after-free error from #undef directive.Carl Worth2010-07-201-4/+1
| | | | | | By taking advantage of the recently-added hash_table_remove function. With this change, all existing tests are now valgrind-clean.
* glcpp: Make test suite test for valgrind cleanliness.Carl Worth2010-07-201-1/+21
| | | | | | 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.
* glcpp: Make test suite report final count of passed/total tests.Carl Worth2010-07-201-2/+22
| | | | And report PASS or FAIL for each test along the way as well.
* glcpp: Delete copies of hash_table.c, hash_table.h, and other headers.Carl Worth2010-07-205-526/+0
| | | | | | | | | | 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.
* glsl2: Initialize yylineno and yycolumn so line numbers are sane.Kenneth Graunke2010-07-071-0/+1
|
* glcpp: Add #error support.Kenneth Graunke2010-07-021-0/+8
|
* glsl2: Conditionally define preprocessor tokens for optional extensionsIan Romanick2010-07-014-9/+18
| | | | | The only optional extension currently supported by the compiler is GL_EXT_texture_array.
* glsl2: Define preprocessor tokens for extensionsIan Romanick2010-07-011-1/+17
| | | | | | 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.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-24152-0/+3935