1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Several fixes detected when using another C compiler.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4785 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2010-08-05 21:15:00 +00:00
parent 4b1c5e4157
commit 1877af89cc
3 changed files with 14 additions and 20 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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