PP: Fix issue #738: don't assert on characters within a string.
authorJohn Kessenich <cepheus@frii.com>
Wed, 1 Mar 2017 01:39:20 +0000 (18:39 -0700)
committerJohn Kessenich <cepheus@frii.com>
Wed, 1 Mar 2017 02:39:51 +0000 (19:39 -0700)
Test/badChars.frag
Test/baseResults/badChars.frag.out
glslang/Include/revision.h
glslang/MachineIndependent/preprocessor/PpContext.h
glslang/MachineIndependent/preprocessor/PpTokens.cpp

index d67bf3a..3e9700d 100644 (file)
@@ -4,3 +4,4 @@
 #if\ 1
 #endif
 int aÿ
+#define A "ÿ
\ No newline at end of file
index e9ebff7..9a2aeca 100644 (file)
@@ -5,8 +5,9 @@ ERROR: 0:3: '#error' : A <bad token> B
 ERROR: 0:4: 'preprocessor evaluation' : bad expression 
 ERROR: 0:4: '#if' : unexpected tokens following directive 
 ERROR: 0:6: '\80' : unexpected token 
+ERROR: 0:7: 'string' : End of line in string 
 ERROR: 0:7: '' :  syntax error
-ERROR: 7 compilation errors.  No code generated.
+ERROR: 8 compilation errors.  No code generated.
 
 
 Shader version: 100
index d1bce52..ccc2152 100644 (file)
@@ -2,5 +2,5 @@
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the date, it uses the current date (when then script is run).
 
-#define GLSLANG_REVISION "Overload400-PrecQual.1861"
+#define GLSLANG_REVISION "Overload400-PrecQual.1865"
 #define GLSLANG_DATE "28-Feb-2017"
index f7b3522..f1c41ab 100644 (file)
@@ -236,7 +236,7 @@ public:
         void reset() { current = 0; }
 
     protected:
-        void putSubtoken(int);
+        void putSubtoken(char);
         int getSubtoken();
         void ungetSubtoken();
 
index 32d2b0b..7fa06a5 100644 (file)
@@ -96,9 +96,8 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 namespace glslang {
 
 // push onto back of stream
-void TPpContext::TokenStream::putSubtoken(int subtoken)
+void TPpContext::TokenStream::putSubtoken(char subtoken)
 {
-    assert((subtoken & ~0xff) == 0);
     data.push_back(static_cast<unsigned char>(subtoken));
 }
 
@@ -125,7 +124,8 @@ void TPpContext::TokenStream::putToken(int token, TPpToken* ppToken)
     const char* s;
     char* str = NULL;
 
-    putSubtoken(token);
+    assert((token & ~0xff) == 0);
+    putSubtoken(static_cast<char>(token));
 
     switch (token) {
     case PpAtomIdentifier: