Get a clean g++/gcc build. Runs and gets correct results on linux.
authorJohn Kessenich <cepheus@frii.com>
Sat, 9 Mar 2013 19:50:19 +0000 (19:50 +0000)
committerJohn Kessenich <cepheus@frii.com>
Sat, 9 Mar 2013 19:50:19 +0000 (19:50 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20820 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Test/comment.frag
glslang/MachineIndependent/Constant.cpp
glslang/MachineIndependent/ParseHelper.h
glslang/MachineIndependent/ShaderLang.cpp
glslang/MachineIndependent/Versions.cpp
glslang/MachineIndependent/glslang.l
glslang/MachineIndependent/glslang.y
glslang/MachineIndependent/preprocessor/memory.c
glslang/OSDependent/Linux/osinclude.h
glslang/OSDependent/Linux/ossource.cpp
glslang/Public/ShaderLang.h

index 01b3f3a9367708613aeeb831dec155572bb4ad24..56da9fe587008a84ae792e23751286e1616d9dd2 100644 (file)
@@ -9,4 +9,11 @@ oanot */
 // escape nothing \o oeu
 // escape newline \
 still in a comment
+// escape newline \
+
+// a different comment
+#version 430 core
+varying vec4 v;
+void main() {}
+
 
index 6ae811fc8ed6e5ccf8cc2a23ef42f2b48da67489..9ea3806ed620206a95586515503889a6d5573913 100644 (file)
@@ -34,6 +34,7 @@
 //POSSIBILITY OF SUCH DAMAGE.
 //
 
+#include "float.h"
 #include "localintermediate.h"
 
 namespace {
index 475a9327ba54688dbd64fcf66f73493886834087..1c80147f1711f452cd21f882fd597ee465a643a2 100644 (file)
@@ -87,7 +87,6 @@ struct TParseContext {
     EProfile profile;            // the declared profile in the shader (core by default)
     bool forwardCompatible;      // true if errors are to be given for use of deprecated features
     EShMessages messages;        // errors/warnings
-    bool futureCompatibility;    // true if requesting errors for future compatibility (false by default)
     TMap<TString, TBehavior> extensionBehavior;    // for each extension string, what it's current enablement is
 
     struct TPragma contextPragma;
index 93fcc066cf3aade6107403c04a7fc8b07ee158c2..bace3b24db5d3a6646ce82027502cbd253b70979 100644 (file)
@@ -212,42 +212,42 @@ bool ConsumeWhitespaceComment(const char*& s)
     const char* startPoint = s;
 
     // first, skip white space    
-    while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') {
+    while (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n') {
         ++s;
     }
 
     // then, check for a comment
     if (*s == '/') {
         if (*(s+1) == '/') {
+
+            // a '//' style comment
             s += 2;
             do {
-                while (*s && *s != '\\' && *s != '\n')
+                while (*s && *s != '\\' && *s != '\r' && *s != '\n')
                     ++s;
 
-                if (*s == '\n' || *s == 0) {
-                    if (*s == '\n') {
+                if (*s == '\r' || *s == '\n' || *s == 0) {
+                    while (*s == '\r' || *s == '\n')
                         ++s;
-                        if (*s == '\r')
-                            ++s;
-                    }  // else it's 0, end of string
 
                     // we reached the end of the comment
                     break;
                 } else {
                     // it's a '\', so we need to keep going, after skipping what's escaped
                     ++s;
-                    if (*s == '\n') {
-                        ++s;
-                        if (*s == '\r')
-                            ++s;
-                    } else {
+                    if (*s == '\r' && *(s+1) == '\n')
+                        s += 2;
+                    else {
                         // skip the escaped character
                         if (*s)
                             ++s;
                     }
                 }
             } while (true);
+
         } else if (*(s+1) == '*') {
+
+            // a '/*' style comment
             s += 2;
             do {
                 while (*s && *s != '*')
@@ -318,7 +318,7 @@ void ScanVersion(const char* const shaderStrings[], int numStrings, int& version
 
     // profile
     const char* end = s;
-    while (*end != ' ' && *end != '\t' && *end != '\n') {
+    while (*end != ' ' && *end != '\t' && *end != '\n' && *end != '\r') {
         if (*end == 0)
             return;
         ++end;
index 118a3f10a8f2fd72ca604fba19f0f40f964c439f..0fe65bd7537c0cb0cc941a1ee3f981a55865b8c9 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "ParseHelper.h"
 
-char* StageName[EShLangCount] = {
+const char* StageName[EShLangCount] = {
     "vertex",
     "tessellation control",
     "tessellation evaluation",
@@ -52,7 +52,7 @@ char* StageName[EShLangCount] = {
     "fragment"
 };
 
-char* ProfileName[EProfileCount] = {
+const char* ProfileName[EProfileCount] = {
     "none",
     "core",
     "compatibility",
index 4671352c1cb9a2831e6f4d1b15715ec518f88ac8..3cf4cc826e2314dff03dfa4a0c58ff5ff4ed2316 100644 (file)
@@ -527,7 +527,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon
         return 0;\r
 }\r
 \r
-void yyerror(char *s)\r
+void yyerror(const char *s)\r
 {\r
     TParseContext& pc = *((TParseContext *)cpp->pC);\r
 \r
@@ -572,7 +572,7 @@ int PaIdentOrReserved(bool reserved, TParseContext& pc, int line, const char* te
 \r
     pyylval->lex.line = line;\r
     pyylval->lex.string = NewPoolTString(text);\r
-    if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
+    if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {\r
         pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
         pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", yylineno);\r
     }\r
@@ -586,7 +586,7 @@ int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char*
         pc.profile != EEsProfile && pc.version < version) {\r
             pyylval->lex.line = yylineno;\r
             pyylval->lex.string = NewPoolTString(yytext);\r
-            if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
+            if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {\r
                 pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
                 pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", yylineno);\r
             }\r
@@ -609,7 +609,7 @@ int PaPrecisionKeyword(TParseContext& pc, int line, const char* text, YYSTYPE* p
 \r
     pyylval->lex.line = line;\r
     pyylval->lex.string = NewPoolTString(text);\r
-    if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
+    if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {\r
         pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
         pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", yylineno);\r
     }\r
@@ -624,7 +624,7 @@ int PaMatNxM(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, in
 \r
     pyylval->lex.line = line;\r
     pyylval->lex.string = NewPoolTString(text);\r
-    if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
+    if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {\r
         pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
         pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", yylineno);\r
     }\r
@@ -644,7 +644,7 @@ int PaDMat(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int
 \r
     pyylval->lex.line = line;\r
     pyylval->lex.string = NewPoolTString(text);\r
-    if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
+    if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) {\r
         pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
         pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);\r
     }\r
index 477fa0fd3efff5d9510aae9d807b15b7502c161d..00d098f33c25583aac7436dd1bb03278e9488233 100644 (file)
@@ -69,9 +69,10 @@ Jutta Degener, 1995
     #define parseContext (*((TParseContext*)(parseContextLocal)))\r
     #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)\r
     #define YYLEX_PARAM (void*)(parseContextLocal)\r
-    extern void yyerror(char*);\r
 #endif\r
 \r
+extern void yyerror(const char*);\r
+\r
 %}\r
 \r
 %union {\r
index 7024671fc3542364548d901fd2f664788feee2db..a01351bb9fb741d8cdbd185fdedd9b7292ce1ae2 100644 (file)
@@ -78,14 +78,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-
-#ifdef _WIN32
 #include <stdint.h>
-#elif defined (_WIN64)
-typedef unsigned __int64 uintptr_t;
-#else 
-typedef unsigned int uintptr_t;
-#endif
 
 #include "memory.h"
 
index 883c993dd27024b22b4181b09929d2fb07fbb8b7..c894dc40319e47ded832ded84f1017f2eff48842 100644 (file)
 // This file contains any Linux specific functions.
 //
 
-#if !(defined(linux))
-#error Trying to include a Linux specific file in a non-Linux build.
-#endif
-
 #include <pthread.h>
 #include <semaphore.h>
 #include <assert.h>
index 08757b73120a4c263bd0633c070439f6edc2a9cd..74a4107a383304d87562875387a722f728576caa 100644 (file)
 #include "osinclude.h"
 #include "InitializeDll.h"
 
-#if !(defined(linux))
-#error Trying to build a Linux specific file in a non-Linux build.
-#endif
-
-
 //
 // Thread cleanup
 //
index 01b204c6f23649d5f8a9e732fc0ea5d68757f19b..c7cd6fc4b1077871f3dc2bc56b4830352f90634e 100644 (file)
@@ -87,7 +87,7 @@ typedef enum {
        EShLangFragmentMask       = (1 << EShLangFragment),
 } EShLanguageMask;
 
-extern char* StageName[EShLangCount];
+extern const char* StageName[EShLangCount];
 
 //
 // Types of output the linker will create.
@@ -121,7 +121,7 @@ enum EShMessages {
 // attributes, uniforms, globals, etc., as needed.
 //
 typedef struct {
-    char* name;
+    const char* name;
     int binding;
 } ShBinding;