mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-24 11:50:06 +00:00
Pass 2 at building on linux: remove compile errors from the preprocessor.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20539 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
54d8cda95e
commit
3e1fcf34c5
@ -72,7 +72,7 @@ depend:
|
||||
#
|
||||
.PHONY : clean
|
||||
clean :
|
||||
$(RM) *.o *.a gen_glslang_tab.cpp gen_glslang.cpp glslang_tab.h glslang.output
|
||||
$(RM) *.o *.a gen_glslang_tab.cpp glslang_tab.cpp glslang_tab.cpp.h gen_glslang.cpp glslang_tab.h glslang.output
|
||||
$(RM) ./lib/*.so
|
||||
cd $(INCPREPROCESSOR); make clean
|
||||
cd $(INCCODEGEN); make clean
|
||||
|
@ -643,11 +643,11 @@ void CPPShInfoLogMsg(const char *msg)
|
||||
GlobalParseContext->recover();
|
||||
}
|
||||
|
||||
void CPPErrorToInfoLog(char *msg)
|
||||
void CPPErrorToInfoLog(const char *msg)
|
||||
{
|
||||
TParseContext& pc = *((TParseContext *)cpp->pC);
|
||||
|
||||
pc.error(yylineno, "CPP error:", "",msg,"");
|
||||
pc.error(yylineno, "CPP error:", "", msg, "");
|
||||
GlobalParseContext->recover();
|
||||
}
|
||||
|
||||
@ -770,7 +770,7 @@ void HandlePragma(const char **tokens, int numTokens)
|
||||
}
|
||||
}
|
||||
|
||||
void StoreStr(char *string)
|
||||
void StoreStr(const char *string)
|
||||
{
|
||||
TParseContext& pc = *((TParseContext *)cpp->pC);
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
CC = gcc
|
||||
INCLUDE = -I../
|
||||
CC = g++
|
||||
|
||||
CPPFLAGS=$(DEFINE) $(INCLUDE)
|
||||
|
||||
OBJECTS = atom.o cpp.o cppstruct.o memory.o scanner.o symbols.o tokens.o
|
||||
AR=ar
|
||||
@ -11,7 +14,7 @@ libPreprocessor.a : $(OBJECTS)
|
||||
ranlib $@
|
||||
|
||||
%.o : %.c
|
||||
$(CC) -c $<
|
||||
$(CC) $(CPPFLAGS) -c $<
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
|
@ -357,11 +357,11 @@ static int GrowAtomTable(AtomTable *atable, int size)
|
||||
|
||||
if (atable->size < size) {
|
||||
if (atable->amap) {
|
||||
newmap = realloc(atable->amap, sizeof(int)*size);
|
||||
newrev = realloc(atable->arev, sizeof(int)*size);
|
||||
newmap = (int*)realloc(atable->amap, sizeof(int)*size);
|
||||
newrev = (int*)realloc(atable->arev, sizeof(int)*size);
|
||||
} else {
|
||||
newmap = malloc(sizeof(int)*size);
|
||||
newrev = malloc(sizeof(int)*size);
|
||||
newmap = (int*)malloc(sizeof(int)*size);
|
||||
newrev = (int*)malloc(sizeof(int)*size);
|
||||
atable->size = 0;
|
||||
}
|
||||
if (!newmap || !newrev) {
|
||||
|
@ -218,7 +218,7 @@ static int CPPdefine(yystypepp * yylvalpp)
|
||||
return token;
|
||||
}
|
||||
mac.argc = argc;
|
||||
mac.args = mem_Alloc(macros->pool, argc * sizeof(int));
|
||||
mac.args = (int*)mem_Alloc(macros->pool, argc * sizeof(int));
|
||||
memcpy(mac.args, args, argc * sizeof(int));
|
||||
token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
|
||||
}
|
||||
@ -392,7 +392,7 @@ static int op_neg(int a) { return -a; }
|
||||
static int op_cmpl(int a) { return ~a; }
|
||||
static int op_not(int a) { return !a; }
|
||||
|
||||
struct {
|
||||
struct Tbinops {
|
||||
int token, prec, (*op)(int, int);
|
||||
} binop[] = {
|
||||
{ CPP_OR_OP, LOGOR, op_logor },
|
||||
@ -415,7 +415,7 @@ struct {
|
||||
{ '%', MUL, op_mod },
|
||||
};
|
||||
|
||||
struct {
|
||||
struct tunops {
|
||||
int token, (*op)(int);
|
||||
} unop[] = {
|
||||
{ '+', op_pos },
|
||||
@ -853,7 +853,7 @@ static int eof_scan(InputSrc *in, yystypepp * yylvalpp) { return -1; }
|
||||
static void noop(InputSrc *in, int ch, yystypepp * yylvalpp) { }
|
||||
|
||||
static void PushEofSrc() {
|
||||
InputSrc *in = malloc(sizeof(InputSrc));
|
||||
InputSrc *in = (InputSrc*)malloc(sizeof(InputSrc));
|
||||
memset(in, 0, sizeof(InputSrc));
|
||||
in->scan = eof_scan;
|
||||
in->getch = eof_scan;
|
||||
@ -902,7 +902,9 @@ typedef struct MacroInputSrc {
|
||||
/* macro_scan ---
|
||||
** return the next token for a macro expanion, handling macro args
|
||||
*/
|
||||
static int macro_scan(MacroInputSrc *in, yystypepp * yylvalpp) {
|
||||
static int macro_scan(InputSrc *inInput, yystypepp * yylvalpp) {
|
||||
MacroInputSrc* in = (MacroInputSrc*)inInput;
|
||||
|
||||
int i;
|
||||
int token = ReadToken(in->mac->body, yylvalpp);
|
||||
if (token == CPP_IDENTIFIER) {
|
||||
@ -957,9 +959,9 @@ int MacroExpand(int atom, yystypepp * yylvalpp)
|
||||
}
|
||||
if (!sym || sym->details.mac.undef) return 0;
|
||||
if (sym->details.mac.busy) return 0; // no recursive expansions
|
||||
in = malloc(sizeof(*in));
|
||||
in = (MacroInputSrc*)malloc(sizeof(*in));
|
||||
memset(in, 0, sizeof(*in));
|
||||
in->base.scan = (void *)macro_scan;
|
||||
in->base.scan = macro_scan;
|
||||
in->base.line = cpp->currentInput->line;
|
||||
in->base.name = cpp->currentInput->name;
|
||||
in->mac = &sym->details.mac;
|
||||
@ -970,7 +972,7 @@ int MacroExpand(int atom, yystypepp * yylvalpp)
|
||||
yylvalpp->sc_ident = atom;
|
||||
return 0;
|
||||
}
|
||||
in->args = malloc(in->mac->argc * sizeof(TokenStream *));
|
||||
in->args = (TokenStream**)malloc(in->mac->argc * sizeof(TokenStream *));
|
||||
for (i=0; i<in->mac->argc; i++)
|
||||
in->args[i] = NewTokenStream("macro arg", 0);
|
||||
i=0;j=0;
|
||||
|
@ -107,8 +107,7 @@ void CPPShInfoLogMsg(const char*); // Store cpp Err Msg into Sh.Info.Lo
|
||||
void CPPWarningToInfoLog(const char *msg); // Prints warning messages into info log
|
||||
void HandlePragma(const char**, int numTokens); // #pragma directive container.
|
||||
void ResetTString(void); // #error Message as TString.
|
||||
void CPPErrorToInfoLog(char*); // Stick all cpp errors into Sh.Info.log .
|
||||
void StoreStr(char*); // Store the TString in Parse Context.
|
||||
void StoreStr(const char*); // Store the TString in Parse Context.
|
||||
void SetLineNumber(int); // Set line number.
|
||||
void SetStringNumber(int); // Set string number.
|
||||
int GetLineNumber(void); // Get the current String Number.
|
||||
|
@ -124,7 +124,7 @@ MemoryPool *mem_CreatePool(size_t chunksize, unsigned int align)
|
||||
if (align & (align-1)) return 0;
|
||||
if (chunksize < sizeof(MemoryPool)) return 0;
|
||||
if (chunksize & (align-1)) return 0;
|
||||
if (!(pool = malloc(chunksize))) return 0;
|
||||
if (!(pool = (MemoryPool*)malloc(chunksize))) return 0;
|
||||
pool->next = 0;
|
||||
pool->chunksize = chunksize;
|
||||
pool->alignmask = (uintptr_t)(align)-1;
|
||||
@ -162,10 +162,10 @@ void *mem_Alloc(MemoryPool *pool, size_t size)
|
||||
if (minreq >= pool->chunksize) {
|
||||
// request size is too big for the chunksize, so allocate it as
|
||||
// a single chunk of the right size
|
||||
ch = malloc(minreq);
|
||||
ch = (struct chunk*)malloc(minreq);
|
||||
if (!ch) return 0;
|
||||
} else {
|
||||
ch = malloc(pool->chunksize);
|
||||
ch = (struct chunk*)malloc(pool->chunksize);
|
||||
if (!ch) return 0;
|
||||
pool->free = (uintptr_t)ch + minreq;
|
||||
pool->end = (uintptr_t)ch + pool->chunksize;
|
||||
@ -181,7 +181,7 @@ int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
|
||||
struct cleanup *cleanup;
|
||||
|
||||
pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
|
||||
cleanup = mem_Alloc(pool, sizeof(struct cleanup));
|
||||
cleanup = (struct cleanup *)(mem_Alloc(pool, sizeof(struct cleanup)));
|
||||
if (!cleanup) return -1;
|
||||
cleanup->next = pool->cleanup;
|
||||
cleanup->fn = fn;
|
||||
|
@ -105,14 +105,14 @@ typedef struct InputSrc {
|
||||
int line;
|
||||
} InputSrc;
|
||||
|
||||
int InitScanner(CPPStruct *cpp); // Intialise the cpp scanner.
|
||||
int ScanFromString(char *); // Start scanning the input from the string mentioned.
|
||||
int check_EOF(int); // check if we hit a EOF abruptly
|
||||
void CPPErrorToInfoLog(char *); // sticking the msg,line into the Shader's.Info.log
|
||||
int InitScanner(CPPStruct *cpp); // Intialise the cpp scanner.
|
||||
int ScanFromString(char *); // Start scanning the input from the string mentioned.
|
||||
int check_EOF(int); // check if we hit a EOF abruptly
|
||||
void CPPErrorToInfoLog(const char *); // sticking the msg,line into the Shader's.Info.log
|
||||
void SetLineNumber(int);
|
||||
void SetStringNumber(int);
|
||||
void IncLineNumber(void);
|
||||
void DecLineNumber(void);
|
||||
int FreeScanner(void); // Free the cpp scanner
|
||||
int FreeScanner(void); // Free the cpp scanner
|
||||
#endif // !(defined(__SCANNER_H)
|
||||
|
||||
|
@ -138,8 +138,6 @@ Symbol *NewSymbol(SourceLoc *loc, Scope *fScope, int name, symbolkind kind);
|
||||
Symbol *AddSymbol(SourceLoc *loc, Scope *fScope, int atom, symbolkind kind);
|
||||
Symbol *LookUpLocalSymbol(Scope *fScope, int atom);
|
||||
Symbol *LookUpSymbol(Scope *fScope, int atom);
|
||||
void CPPErrorToInfoLog(char *);
|
||||
|
||||
|
||||
#endif // !defined(__SYMBOLS_H)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user