Another round of gcc/g++ fixes.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20819 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
37827023c4
commit
cfd643e447
25 changed files with 131 additions and 44 deletions
|
|
@ -1,7 +1,7 @@
|
|||
INCLUDE = -I../
|
||||
CC = g++
|
||||
CC = gcc
|
||||
|
||||
CPPFLAGS=$(DEFINE) $(INCLUDE)
|
||||
CPPFLAGS=$(DEFINE) $(INCLUDE) -fPIC
|
||||
|
||||
OBJECTS = atom.o cpp.o cppstruct.o memory.o scanner.o symbols.o tokens.o
|
||||
AR=ar
|
||||
|
|
@ -14,7 +14,7 @@ libPreprocessor.a : $(OBJECTS)
|
|||
ranlib $@
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CPPFLAGS) -c $<
|
||||
$(CC) -c $(CPPFLAGS) $<
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
|
|
|
|||
|
|
@ -128,6 +128,10 @@ static Scope *macros = 0;
|
|||
|
||||
static SourceLoc ifloc; /* outermost #if */
|
||||
|
||||
int ChkCorrectElseNesting(void);
|
||||
int PredefineMacro(char *);
|
||||
void FreeMacro(MacroSymbol *);
|
||||
|
||||
int InitCPP(void)
|
||||
{
|
||||
char buffer[64], *t;
|
||||
|
|
|
|||
|
|
@ -85,12 +85,6 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "tokens.h"
|
||||
#include "Versions.h"
|
||||
|
||||
int InitCPP(void);
|
||||
int FinalCPP(void);
|
||||
int readCPPline(yystypepp * yylvalpp);
|
||||
int MacroExpand(int atom, yystypepp * yylvalpp);
|
||||
int ChkCorrectElseNesting(void);
|
||||
|
||||
typedef struct MacroSymbol {
|
||||
int argc;
|
||||
int *args;
|
||||
|
|
@ -99,8 +93,14 @@ typedef struct MacroSymbol {
|
|||
unsigned undef:1;
|
||||
} MacroSymbol;
|
||||
|
||||
void FreeMacro(MacroSymbol *);
|
||||
int PredefineMacro(char *);
|
||||
int InitCPP(void);
|
||||
int FinalCPP(void);
|
||||
int readCPPline(yystypepp * yylvalpp);
|
||||
int MacroExpand(int atom, yystypepp * yylvalpp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void CPPDebugLogMsg(const char *msg); // Prints information into debug log
|
||||
void CPPShInfoLogMsg(const char*); // Store cpp Err Msg into Sh.Info.Log
|
||||
|
|
@ -118,4 +118,9 @@ void SetProfile(EProfile);
|
|||
void updateExtensionBehavior(const char* extName, const char* behavior);
|
||||
int FreeCPP(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // !(defined(__CPP_H)
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __STDC99__
|
||||
#ifdef _WIN32
|
||||
#include <stdint.h>
|
||||
#elif defined (_WIN64)
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static void str_ungetch(StringInputSrc *in, int ch, yystypepp *type) {
|
|||
int ScanFromString(char *s)
|
||||
{
|
||||
|
||||
StringInputSrc *in = malloc(sizeof(StringInputSrc));
|
||||
StringInputSrc *in = (StringInputSrc *)malloc(sizeof(StringInputSrc));
|
||||
memset(in, 0, sizeof(StringInputSrc));
|
||||
in->p = s;
|
||||
in->base.line = 1;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "parser.h"
|
||||
|
||||
// Not really atom table stuff but needed first...
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct SourceLoc_Rec {
|
||||
unsigned short file, line;
|
||||
|
|
@ -114,5 +117,10 @@ void SetStringNumber(int);
|
|||
void IncLineNumber(void);
|
||||
void DecLineNumber(void);
|
||||
int FreeScanner(void); // Free the cpp scanner
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !(defined(__SCANNER_H)
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ Scope *CurrentScope = NULL;
|
|||
Scope *GlobalScope = NULL;
|
||||
|
||||
static void unlinkScope(void *_scope) {
|
||||
Scope *scope = _scope;
|
||||
Scope *scope = (Scope*)_scope;
|
||||
|
||||
if (scope->next)
|
||||
scope->next->prev = scope->prev;
|
||||
|
|
@ -112,7 +112,7 @@ Scope *NewScopeInPool(MemoryPool *pool)
|
|||
{
|
||||
Scope *lScope;
|
||||
|
||||
lScope = mem_Alloc(pool, sizeof(Scope));
|
||||
lScope = (Scope*)mem_Alloc(pool, sizeof(Scope));
|
||||
lScope->pool = pool;
|
||||
lScope->parent = NULL;
|
||||
lScope->funScope = NULL;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void DeleteTokenStream(TokenStream *pTok)
|
|||
void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
|
||||
{
|
||||
const char *s;
|
||||
unsigned char *str=NULL;
|
||||
char *str = NULL;
|
||||
|
||||
if (token > 256)
|
||||
lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
|
||||
|
|
@ -259,10 +259,10 @@ void RecordToken(TokenStream *pTok, int token, yystypepp * yylvalpp)
|
|||
break;
|
||||
case CPP_FLOATCONSTANT:
|
||||
case CPP_INTCONSTANT:
|
||||
str=yylvalpp->symbol_name;
|
||||
str = yylvalpp->symbol_name;
|
||||
while (*str){
|
||||
lAddByte(pTok,(unsigned char) *str);
|
||||
*str++;
|
||||
lAddByte(pTok, (unsigned char) *str);
|
||||
str++;
|
||||
}
|
||||
lAddByte(pTok, 0);
|
||||
break;
|
||||
|
|
@ -398,7 +398,7 @@ static int scan_token(TokenInputSrc *in, yystypepp * yylvalpp)
|
|||
|
||||
int ReadFromTokenStream(TokenStream *ts, int name, int (*final)(CPPStruct *))
|
||||
{
|
||||
TokenInputSrc *in = malloc(sizeof(TokenInputSrc));
|
||||
TokenInputSrc *in = (TokenInputSrc *) malloc(sizeof(TokenInputSrc));
|
||||
memset(in, 0, sizeof(TokenInputSrc));
|
||||
in->base.name = name;
|
||||
in->base.prev = cpp->currentInput;
|
||||
|
|
@ -426,12 +426,14 @@ static int reget_token(UngotToken *t, yystypepp * yylvalpp)
|
|||
return token;
|
||||
}
|
||||
|
||||
typedef int (*scanFnPtr_t)(struct InputSrc *, yystypepp *);
|
||||
|
||||
void UngetToken(int token, yystypepp * yylvalpp) {
|
||||
UngotToken *t = malloc(sizeof(UngotToken));
|
||||
UngotToken *t = (UngotToken *) malloc(sizeof(UngotToken));
|
||||
memset(t, 0, sizeof(UngotToken));
|
||||
t->token = token;
|
||||
t->lval = *yylvalpp;
|
||||
t->base.scan = (void *)reget_token;
|
||||
t->base.scan = (scanFnPtr_t)reget_token;
|
||||
t->base.prev = cpp->currentInput;
|
||||
t->base.name = cpp->currentInput->name;
|
||||
t->base.line = cpp->currentInput->line;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue