diff --git a/Test/comment.frag b/Test/comment.frag index 01b3f3a93..56da9fe58 100644 --- a/Test/comment.frag +++ b/Test/comment.frag @@ -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() {} + diff --git a/glslang/MachineIndependent/Constant.cpp b/glslang/MachineIndependent/Constant.cpp index 6ae811fc8..9ea3806ed 100644 --- a/glslang/MachineIndependent/Constant.cpp +++ b/glslang/MachineIndependent/Constant.cpp @@ -34,6 +34,7 @@ //POSSIBILITY OF SUCH DAMAGE. // +#include "float.h" #include "localintermediate.h" namespace { diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 475a9327b..1c80147f1 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -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 extensionBehavior; // for each extension string, what it's current enablement is struct TPragma contextPragma; diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 93fcc066c..bace3b24d 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -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; diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 118a3f10a..0fe65bd75 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -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", diff --git a/glslang/MachineIndependent/glslang.l b/glslang/MachineIndependent/glslang.l index 4671352c1..3cf4cc826 100644 --- a/glslang/MachineIndependent/glslang.l +++ b/glslang/MachineIndependent/glslang.l @@ -527,7 +527,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon return 0; } -void yyerror(char *s) +void yyerror(const char *s) { TParseContext& pc = *((TParseContext *)cpp->pC); @@ -572,7 +572,7 @@ int PaIdentOrReserved(bool reserved, TParseContext& pc, int line, const char* te pyylval->lex.line = line; pyylval->lex.string = NewPoolTString(text); - if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) { + if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", yylineno); } @@ -586,7 +586,7 @@ int PaES30ReservedFromGLSL(int version, TParseContext& pc, int line, const char* pc.profile != EEsProfile && pc.version < version) { pyylval->lex.line = yylineno; pyylval->lex.string = NewPoolTString(yytext); - if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) { + if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", yylineno); } @@ -609,7 +609,7 @@ int PaPrecisionKeyword(TParseContext& pc, int line, const char* text, YYSTYPE* p pyylval->lex.line = line; pyylval->lex.string = NewPoolTString(text); - if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) { + if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", yylineno); } @@ -624,7 +624,7 @@ int PaMatNxM(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, in pyylval->lex.line = line; pyylval->lex.string = NewPoolTString(text); - if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) { + if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", yylineno); } @@ -644,7 +644,7 @@ int PaDMat(TParseContext& pc, int line, const char* text, YYSTYPE* pyylval, int pyylval->lex.line = line; pyylval->lex.string = NewPoolTString(text); - if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) { + if (pc.forwardCompatible && ! (pc.messages & EShMsgSuppressWarnings)) { pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno); pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno); } diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y index 477fa0fd3..00d098f33 100644 --- a/glslang/MachineIndependent/glslang.y +++ b/glslang/MachineIndependent/glslang.y @@ -69,9 +69,10 @@ Jutta Degener, 1995 #define parseContext (*((TParseContext*)(parseContextLocal))) #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal) #define YYLEX_PARAM (void*)(parseContextLocal) - extern void yyerror(char*); #endif +extern void yyerror(const char*); + %} %union { diff --git a/glslang/MachineIndependent/preprocessor/memory.c b/glslang/MachineIndependent/preprocessor/memory.c index 7024671fc..a01351bb9 100644 --- a/glslang/MachineIndependent/preprocessor/memory.c +++ b/glslang/MachineIndependent/preprocessor/memory.c @@ -78,14 +78,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include - -#ifdef _WIN32 #include -#elif defined (_WIN64) -typedef unsigned __int64 uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif #include "memory.h" diff --git a/glslang/OSDependent/Linux/osinclude.h b/glslang/OSDependent/Linux/osinclude.h index 883c993dd..c894dc403 100644 --- a/glslang/OSDependent/Linux/osinclude.h +++ b/glslang/OSDependent/Linux/osinclude.h @@ -39,10 +39,6 @@ // 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 #include #include diff --git a/glslang/OSDependent/Linux/ossource.cpp b/glslang/OSDependent/Linux/ossource.cpp index 08757b731..74a4107a3 100644 --- a/glslang/OSDependent/Linux/ossource.cpp +++ b/glslang/OSDependent/Linux/ossource.cpp @@ -38,11 +38,6 @@ #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 // diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 01b204c6f..c7cd6fc4b 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -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;