Get a clean g++/gcc build. Runs and gets correct results on linux.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20820 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-03-09 19:50:19 +00:00
parent cfd643e447
commit 20169715df
11 changed files with 33 additions and 41 deletions

View File

@@ -9,4 +9,11 @@ oanot */
// escape nothing \o oeu // escape nothing \o oeu
// escape newline \ // escape newline \
still in a comment still in a comment
// escape newline \
// a different comment
#version 430 core
varying vec4 v;
void main() {}

View File

@@ -34,6 +34,7 @@
//POSSIBILITY OF SUCH DAMAGE. //POSSIBILITY OF SUCH DAMAGE.
// //
#include "float.h"
#include "localintermediate.h" #include "localintermediate.h"
namespace { namespace {

View File

@@ -87,7 +87,6 @@ struct TParseContext {
EProfile profile; // the declared profile in the shader (core by default) 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 bool forwardCompatible; // true if errors are to be given for use of deprecated features
EShMessages messages; // errors/warnings 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 TMap<TString, TBehavior> extensionBehavior; // for each extension string, what it's current enablement is
struct TPragma contextPragma; struct TPragma contextPragma;

View File

@@ -212,42 +212,42 @@ bool ConsumeWhitespaceComment(const char*& s)
const char* startPoint = s; const char* startPoint = s;
// first, skip white space // first, skip white space
while (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r') { while (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n') {
++s; ++s;
} }
// then, check for a comment // then, check for a comment
if (*s == '/') { if (*s == '/') {
if (*(s+1) == '/') { if (*(s+1) == '/') {
// a '//' style comment
s += 2; s += 2;
do { do {
while (*s && *s != '\\' && *s != '\n') while (*s && *s != '\\' && *s != '\r' && *s != '\n')
++s; ++s;
if (*s == '\n' || *s == 0) { if (*s == '\r' || *s == '\n' || *s == 0) {
if (*s == '\n') { while (*s == '\r' || *s == '\n')
++s; ++s;
if (*s == '\r')
++s;
} // else it's 0, end of string
// we reached the end of the comment // we reached the end of the comment
break; break;
} else { } else {
// it's a '\', so we need to keep going, after skipping what's escaped // it's a '\', so we need to keep going, after skipping what's escaped
++s; ++s;
if (*s == '\n') { if (*s == '\r' && *(s+1) == '\n')
++s; s += 2;
if (*s == '\r') else {
++s;
} else {
// skip the escaped character // skip the escaped character
if (*s) if (*s)
++s; ++s;
} }
} }
} while (true); } while (true);
} else if (*(s+1) == '*') { } else if (*(s+1) == '*') {
// a '/*' style comment
s += 2; s += 2;
do { do {
while (*s && *s != '*') while (*s && *s != '*')
@@ -318,7 +318,7 @@ void ScanVersion(const char* const shaderStrings[], int numStrings, int& version
// profile // profile
const char* end = s; const char* end = s;
while (*end != ' ' && *end != '\t' && *end != '\n') { while (*end != ' ' && *end != '\t' && *end != '\n' && *end != '\r') {
if (*end == 0) if (*end == 0)
return; return;
++end; ++end;

View File

@@ -44,7 +44,7 @@
#include "ParseHelper.h" #include "ParseHelper.h"
char* StageName[EShLangCount] = { const char* StageName[EShLangCount] = {
"vertex", "vertex",
"tessellation control", "tessellation control",
"tessellation evaluation", "tessellation evaluation",
@@ -52,7 +52,7 @@ char* StageName[EShLangCount] = {
"fragment" "fragment"
}; };
char* ProfileName[EProfileCount] = { const char* ProfileName[EProfileCount] = {
"none", "none",
"core", "core",
"compatibility", "compatibility",

View File

@@ -527,7 +527,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon
return 0; return 0;
} }
void yyerror(char *s) void yyerror(const char *s)
{ {
TParseContext& pc = *((TParseContext *)cpp->pC); 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.line = line;
pyylval->lex.string = NewPoolTString(text); 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, pyylval->lex.string->c_str(), yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", 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) { pc.profile != EEsProfile && pc.version < version) {
pyylval->lex.line = yylineno; pyylval->lex.line = yylineno;
pyylval->lex.string = NewPoolTString(yytext); 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, pyylval->lex.string->c_str(), yylineno);
pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", 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.line = line;
pyylval->lex.string = NewPoolTString(text); 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, pyylval->lex.string->c_str(), yylineno);
pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", 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.line = line;
pyylval->lex.string = NewPoolTString(text); 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, pyylval->lex.string->c_str(), yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", 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.line = line;
pyylval->lex.string = NewPoolTString(text); 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, pyylval->lex.string->c_str(), yylineno);
pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno); pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);
} }

View File

@@ -69,9 +69,10 @@ Jutta Degener, 1995
#define parseContext (*((TParseContext*)(parseContextLocal))) #define parseContext (*((TParseContext*)(parseContextLocal)))
#define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal) #define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
#define YYLEX_PARAM (void*)(parseContextLocal) #define YYLEX_PARAM (void*)(parseContextLocal)
extern void yyerror(char*);
#endif #endif
extern void yyerror(const char*);
%} %}
%union { %union {

View File

@@ -78,14 +78,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef _WIN32
#include <stdint.h> #include <stdint.h>
#elif defined (_WIN64)
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#include "memory.h" #include "memory.h"

View File

@@ -39,10 +39,6 @@
// This file contains any Linux specific functions. // 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 <pthread.h>
#include <semaphore.h> #include <semaphore.h>
#include <assert.h> #include <assert.h>

View File

@@ -38,11 +38,6 @@
#include "osinclude.h" #include "osinclude.h"
#include "InitializeDll.h" #include "InitializeDll.h"
#if !(defined(linux))
#error Trying to build a Linux specific file in a non-Linux build.
#endif
// //
// Thread cleanup // Thread cleanup
// //

View File

@@ -87,7 +87,7 @@ typedef enum {
EShLangFragmentMask = (1 << EShLangFragment), EShLangFragmentMask = (1 << EShLangFragment),
} EShLanguageMask; } EShLanguageMask;
extern char* StageName[EShLangCount]; extern const char* StageName[EShLangCount];
// //
// Types of output the linker will create. // Types of output the linker will create.
@@ -121,7 +121,7 @@ enum EShMessages {
// attributes, uniforms, globals, etc., as needed. // attributes, uniforms, globals, etc., as needed.
// //
typedef struct { typedef struct {
char* name; const char* name;
int binding; int binding;
} ShBinding; } ShBinding;