Commit Graph

20 Commits

Author SHA1 Message Date
Rémi Verschelde
ebfd91a719 Remove Unix executable permission from text files 2018-12-10 10:49:16 +01:00
John Kessenich
4ee2f75294 PP: More clearly distinguish funtion-like and object-like macros 2018-11-07 17:22:17 -07:00
John Kessenich
2eb135506a GLSL: Fix #396: Error when 'defined' comes from macro expansion. 2017-06-07 17:19:08 -06:00
John Kessenich
aead93aafd Preprocessor: Allow '\' as a token, which gets actual use in #error, but should have no other use.
This is just for '\' that's not before a new line.
Note the specification says it has no use other than as line continuation,
but #error is a grey area. (There are no escape sequences.)
2015-07-25 17:34:32 -06:00
John Kessenich
2b20dcb64d Fix public bug 1277: #line L sets the next line to L+1 or just L, based on the version of the language.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@29277 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2014-12-20 07:03:18 +00:00
John Kessenich
7054075804 Tests: add a few more test cases.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24635 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-31 23:02:24 +00:00
John Kessenich
fcb4ed054c Preprocessor: Rationalize, simplify, and correct the stack of input sources and their tokenization. This included
- consistently dealing with EOF and its effect on error recovery (bug 11444, #1)
 - turning a simulated OO hierarchy of function pointers and typecasting into a real C++ class hierarchy
 - correctly handling '\' everywhere, in all classes of tokens, as a layer before preprocessing itself
 - conditionally handling '\n' in macro expansion input, depending on whether it is in a macro expression or not
 - delete some unused "memory cleanup" code


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24626 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-30 20:34:28 +00:00
John Kessenich
2d2f31625d Preprocessor: Implement skipping of macros that evaluate to nothing while evaluating expressions. They had been causing early termination of an expression's evaluation.
Also includes some unrelated updates of documentation.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24420 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-10 00:25:14 +00:00
John Kessenich
e28beee891 Preprocessor: Fixed that some comments incorrectly substituted a new line instead of space. Also generally cleaned up the space-related coding.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24387 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-06 16:13:47 +00:00
John Kessenich
1abc4045ce Add #line functionality to allow expressions instead of just literals. Also made some preprocessor code slightly more clear.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24294 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-03 17:19:03 +00:00
John Kessenich
98434bed00 Preprocessor fixes:
- Correctly handle non-directive lines starting with "#"
 - Correctly ignore unrecognized #pragma
 - Partial fix for new lines in the middle of macro invocation



git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24266 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-12-02 15:56:38 +00:00
John Kessenich
69aa9c1b84 Fixes to scanning:
- do version checking for the line-continuation character
 - check for built-in names in #undef
 - bug fix for #elif after #else
 - do version checking for use of floating point suffixes (f, LF, etc.)


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24011 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-11-12 03:31:24 +00:00
John Kessenich
4d6570a1b3 Fix several issues in the preprocessor:
- macro expansion of hexidecimal numbers 
 - give errors instead of warnings/silence on extra tokens after #endif, #else, etc.
 - give errors on reserved macro name use, reuse of argument, and redefinition with different whitespace presence
 - detect and give error for all cases of #elif and #else after #else



git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23982 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-11-10 23:07:36 +00:00
John Kessenich
5f1a0b7998 Eliminate flex as the GLSL lexical analyzer, going from two nested lexical analyzers down to one, leaving just the preprocessor's lexical analysis. A new layer replaces it, to translate from the preprocessor's view of tokenization to glslang's view of tokenization.
Also:
 - change source locations from an int to TSourceLoc (shader number, line number) throughout
 - various improvements to the preprocessor


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22277 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-07-06 19:54:21 +00:00
John Kessenich
f78fff94e9 Implement __VERSION__ macro, make ftransform() non-ES only, add more tests.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22000 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-13 23:56:04 +00:00
John Kessenich
fb7044a9a8 Semantic checks: ES doesn't have unsized arrays or noise*().
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21998 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-13 20:16:43 +00:00
John Kessenich
ceb0623823 Fix another problem with undefined macros needing to evaluate to 0 within a preprocessor expression, but not outside a preprocessor expression.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21815 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-06-03 04:15:57 +00:00
John Kessenich
52ac67e913 Make the PP report an error on undefined macro in "#if ..." for ES profiles, unless relaxed error checking is requested. Still works as normal CPP on non-ES.
Also, improved error reporting in general for the PP.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21417 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-05-05 23:46:22 +00:00
John Kessenich
38c507e75a Make the default version be 100.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20509 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-08 18:56:56 +00:00
John Kessenich
464f6d9ff1 Add some CPP tests.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20457 e7fa87d3-cd2b-0410-9028-fcbf551c1848
2013-02-06 00:14:16 +00:00