From 1877af89cc7ab13488559df712b255daa6e77461 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 5 Aug 2010 21:15:00 +0000 Subject: [PATCH] Several fixes detected when using another C compiler. git-svn-id: svn://svn.cc65.org/cc65/trunk@4785 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/dbginfo/dbginfo.c | 19 +++++++------------ src/dbginfo/dbginfo.h | 7 +++---- src/dbginfo/make/gcc.mak | 8 ++++---- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/dbginfo/dbginfo.c b/src/dbginfo/dbginfo.c index 8997b1b0b..4f683ff6c 100644 --- a/src/dbginfo/dbginfo.c +++ b/src/dbginfo/dbginfo.c @@ -63,9 +63,6 @@ struct StrBuf { /* Initializer for a string buffer */ #define STRBUF_INITIALIZER { 0, 0, 0 } -/* An empty string buf */ -static const StrBuf EmptyStrBuf = STRBUF_INITIALIZER; - /* An array of pointers that grows if needed */ typedef struct Collection Collection; struct Collection { @@ -77,9 +74,6 @@ struct Collection { /* Initializer for static collections */ #define COLLECTION_INITIALIZER { 0, 0, 0 } -/* An empty collection */ -static const Collection EmptyCollection = COLLECTION_INITIALIZER; - /* Data structure containing information from the debug info file. A pointer @@ -91,8 +85,7 @@ struct DbgInfo { }; /* Input tokens */ -typedef enum Token Token; -enum Token { +typedef enum { TOK_INVALID, /* Invalid token */ TOK_EOF, /* End of file reached */ @@ -129,7 +122,7 @@ enum Token { TOK_ZEROPAGE, /* ZEROPAGE keyword */ TOK_IDENT, /* To catch unknown keywords */ -}; +} Token; /* Data used when parsing the debug info file */ typedef struct InputData InputData; @@ -1523,7 +1516,7 @@ static LineInfo* FindLineInfo (FileInfo* F, cc65_addr Addr) -cc65_dbginfo cc65_read_dbginfo (const char* filename, cc65_errorfunc errorfunc) +cc65_dbginfo cc65_read_dbginfo (const char* FileName, cc65_errorfunc ErrFunc) /* Parse the debug info file with the given name. On success, the function * will return a pointer to an opaque cc65_dbginfo structure, that must be * passed to the other functions in this module to retrieve information. @@ -1533,7 +1526,7 @@ cc65_dbginfo cc65_read_dbginfo (const char* filename, cc65_errorfunc errorfunc) { /* Data structure used to control scanning and parsing */ InputData D = { - filename, /* Name of input file */ + 0, /* Name of input file */ 1, /* Line number */ 0, /* Input file */ 0, /* Line at start of current token */ @@ -1544,12 +1537,14 @@ cc65_dbginfo cc65_read_dbginfo (const char* filename, cc65_errorfunc errorfunc) TOK_INVALID, /* Input token */ 0, /* Integer constant */ STRBUF_INITIALIZER, /* String constant */ - errorfunc, /* Function called in case of errors */ + 0, /* Function called in case of errors */ 0, /* Major version number */ 0, /* Minor version number */ COLLECTION_INITIALIZER, /* Line information */ 0, /* Pointer to debug info */ }; + D.FileName = FileName; + D.Error = ErrFunc; /* Open the input file */ D.F = fopen (D.FileName, "r"); diff --git a/src/dbginfo/dbginfo.h b/src/dbginfo/dbginfo.h index 80a51cf13..f98ea67e4 100644 --- a/src/dbginfo/dbginfo.h +++ b/src/dbginfo/dbginfo.h @@ -55,12 +55,11 @@ typedef unsigned cc65_addr; /* Use to store (65xx) addresses */ */ typedef void* cc65_dbginfo; -/* ### Parseerror */ -typedef enum cc65_error_severity cc65_error_severity; -enum cc65_error_severity { +/* Severity for cc65_parseerror */ +typedef enum { CC65_WARNING, CC65_ERROR, -}; +} cc65_error_severity; /* Warnings/errors in cc65_read_dbginfo are passed via this struct */ typedef struct cc65_parseerror cc65_parseerror; diff --git a/src/dbginfo/make/gcc.mak b/src/dbginfo/make/gcc.mak index 750792d68..d04d49eaf 100644 --- a/src/dbginfo/make/gcc.mak +++ b/src/dbginfo/make/gcc.mak @@ -1,5 +1,5 @@ # -# Makefile for debug info test executable +# Makefile for the debug info test executable # @@ -14,10 +14,10 @@ EXE = dbgtest CC = gcc CFLAGS = -g -O2 -Wall -W EBIND = emxbind -LDFLAGS = -g +LDFLAGS = # ------------------------------------------------------------------------------ -# Object files and libraries to link +# Object files to link OBJS = dbginfo.o \ dbgtest.o @@ -52,7 +52,7 @@ zap: clean .PHONY: depend dep depend dep: $(OBJS:.o=.c) @echo "Creating dependency information" - $(CC) -I$(COMMON) -MM $^ > .depend + $(CC) -MM $^ > .depend -- 2.39.5