mirror of
https://github.com/cc65/cc65.git
synced 2024-06-02 04:41:35 +00:00
Move the Debug flag into a new module "debugflag" in the common directory.
Remove the const qualifier from the argument of xfree(). git-svn-id: svn://svn.cc65.org/cc65/trunk@1877 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
b22030dbc7
commit
abcc981253
|
@ -50,7 +50,7 @@
|
|||
|
||||
|
||||
/* Predefined packages */
|
||||
static const char MacGeneric [] = /* Generic macros */
|
||||
static char MacGeneric [] = /* Generic macros */
|
||||
".macro add Arg1, Arg2\n"
|
||||
" clc\n"
|
||||
" .if .paramcount = 2\n"
|
||||
|
@ -70,7 +70,7 @@ static const char MacGeneric [] = /* Generic macros */
|
|||
|
||||
|
||||
|
||||
static const char MacLongBranch [] = /* Long branch macros */
|
||||
static char MacLongBranch [] = /* Long branch macros */
|
||||
".macro jeq Target\n"
|
||||
" .if .match(Target, 0)\n"
|
||||
" bne *+5\n"
|
||||
|
@ -163,7 +163,7 @@ static const char MacLongBranch [] = /* Long branch macros */
|
|||
|
||||
|
||||
/* Table with pointers to the different packages */
|
||||
static const char* MacPackages [] = {
|
||||
static char* MacPackages [] = {
|
||||
MacGeneric,
|
||||
MacLongBranch,
|
||||
};
|
||||
|
|
|
@ -95,7 +95,7 @@ struct InputFile_ {
|
|||
/* Struct to handle textual input data */
|
||||
typedef struct InputData_ InputData;
|
||||
struct InputData_ {
|
||||
const char* Data; /* Pointer to the data */
|
||||
char* Data; /* Pointer to the data */
|
||||
const char* Pos; /* Pointer to current position */
|
||||
int Malloced; /* Memory was malloced */
|
||||
enum Token Tok; /* Last token */
|
||||
|
@ -370,7 +370,7 @@ void DoneInputFile (void)
|
|||
|
||||
|
||||
|
||||
void NewInputData (const char* Data, int Malloced)
|
||||
void NewInputData (char* Data, int Malloced)
|
||||
/* Add a chunk of input data to the input stream */
|
||||
{
|
||||
InputData* I;
|
||||
|
|
|
@ -186,7 +186,7 @@ enum Token {
|
|||
TOK_P816,
|
||||
TOK_PAGELENGTH,
|
||||
TOK_PARAMCOUNT,
|
||||
TOK_PC02,
|
||||
TOK_PC02,
|
||||
TOK_POPSEG,
|
||||
TOK_PROC,
|
||||
TOK_PUSHSEG,
|
||||
|
@ -240,7 +240,7 @@ void NewInputFile (const char* Name);
|
|||
void DoneInputFile (void);
|
||||
/* Close the current input file */
|
||||
|
||||
void NewInputData (const char* Data, int Malloced);
|
||||
void NewInputData (char* Data, int Malloced);
|
||||
/* Add a chunk of input data to the input stream */
|
||||
|
||||
void LocaseSVal (void);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
/* common */
|
||||
#include "chartype.h"
|
||||
#include "check.h"
|
||||
#include "debugflag.h"
|
||||
#include "xmalloc.h"
|
||||
#include "xsprintf.h"
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
/* common */
|
||||
#include "chartype.h"
|
||||
#include "check.h"
|
||||
#include "debugflag.h"
|
||||
#include "global.h"
|
||||
#include "hashstr.h"
|
||||
#include "strutil.h"
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <time.h>
|
||||
|
||||
/* common */
|
||||
#include "debugflag.h"
|
||||
#include "version.h"
|
||||
#include "xmalloc.h"
|
||||
#include "xsprintf.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
/* common */
|
||||
#include "check.h"
|
||||
#include "debugflag.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* cc65 */
|
||||
|
@ -1628,11 +1629,11 @@ int hie10 (ExprDesc* lval)
|
|||
/* If the expression is already a pointer to function, the
|
||||
* additional dereferencing operator must be ignored.
|
||||
*/
|
||||
if (IsTypeFuncPtr (lval->Type)) {
|
||||
if (IsTypeFuncPtr (lval->Type)) {
|
||||
/* Expression not storable */
|
||||
return 0;
|
||||
} else {
|
||||
if (IsClassPtr (lval->Type)) {
|
||||
if (IsClassPtr (lval->Type)) {
|
||||
lval->Type = Indirect (lval->Type);
|
||||
} else {
|
||||
Error ("Illegal indirection");
|
||||
|
|
|
@ -59,7 +59,6 @@ unsigned char StaticLocals = 0; /* Make local variables static */
|
|||
unsigned char SignedChars = 0; /* Make characters signed by default */
|
||||
unsigned char AddSource = 0; /* Add source lines as comments */
|
||||
unsigned char DebugInfo = 0; /* Add debug info to the obj */
|
||||
unsigned char Debug = 0; /* Debug mode */
|
||||
unsigned char CreateDep = 0; /* Create a dependency file */
|
||||
unsigned char CheckStack = 0; /* Generate stack overflow checks */
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ extern unsigned char StaticLocals; /* Make local variables static */
|
|||
extern unsigned char SignedChars; /* Make characters signed by default */
|
||||
extern unsigned char AddSource; /* Add source lines as comments */
|
||||
extern unsigned char DebugInfo; /* Add debug info to the obj */
|
||||
extern unsigned char Debug; /* Debug mode */
|
||||
extern unsigned char CreateDep; /* Create a dependency file */
|
||||
extern unsigned char CheckStack; /* Generate stack overflow checks */
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "abend.h"
|
||||
#include "chartype.h"
|
||||
#include "cmdline.h"
|
||||
#include "debugflag.h"
|
||||
#include "fname.h"
|
||||
#include "print.h"
|
||||
#include "segdefs.h"
|
||||
|
@ -401,10 +402,10 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg)
|
|||
|
||||
|
||||
static void OptDebug (const char* Opt attribute ((unused)),
|
||||
const char* Arg attribute ((unused)))
|
||||
const char* Arg attribute ((unused)))
|
||||
/* Compiler debug mode */
|
||||
{
|
||||
Debug = 1;
|
||||
++Debug;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
/* common */
|
||||
#include "check.h"
|
||||
#include "debugflag.h"
|
||||
#include "hashstr.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
|
50
src/common/debugflag.c
Normal file
50
src/common/debugflag.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*****************************************************************************/
|
||||
/* */
|
||||
/* debugflag.c */
|
||||
/* */
|
||||
/* Global debug flag */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
/* arising from the use of this software. */
|
||||
/* */
|
||||
/* Permission is granted to anyone to use this software for any purpose, */
|
||||
/* including commercial applications, and to alter it and redistribute it */
|
||||
/* freely, subject to the following restrictions: */
|
||||
/* */
|
||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||
/* claim that you wrote the original software. If you use this software */
|
||||
/* in a product, an acknowledgment in the product documentation would be */
|
||||
/* appreciated but is not required. */
|
||||
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* common */
|
||||
#include "debugflag.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
unsigned char Debug = 0; /* Debug mode */
|
||||
|
||||
|
||||
|
55
src/common/debugflag.h
Normal file
55
src/common/debugflag.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*****************************************************************************/
|
||||
/* */
|
||||
/* debugflag.h */
|
||||
/* */
|
||||
/* Global debug flag */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2002 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
/* arising from the use of this software. */
|
||||
/* */
|
||||
/* Permission is granted to anyone to use this software for any purpose, */
|
||||
/* including commercial applications, and to alter it and redistribute it */
|
||||
/* freely, subject to the following restrictions: */
|
||||
/* */
|
||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||
/* claim that you wrote the original software. If you use this software */
|
||||
/* in a product, an acknowledgment in the product documentation would be */
|
||||
/* appreciated but is not required. */
|
||||
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef DEBUGFLAG_H
|
||||
#define DEBUGFLAG_H
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
extern unsigned char Debug; /* Debug mode */
|
||||
|
||||
|
||||
|
||||
/* End of debugflag.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -15,6 +15,7 @@ OBJS = abend.o \
|
|||
check.o \
|
||||
cmdline.o \
|
||||
coll.o \
|
||||
debugflag.o \
|
||||
exprdefs.o \
|
||||
filepos.o \
|
||||
fname.o \
|
||||
|
|
|
@ -47,6 +47,7 @@ OBJS = abend.obj \
|
|||
check.obj \
|
||||
cmdline.obj \
|
||||
coll.obj \
|
||||
debugflag.obj \
|
||||
exprdefs.obj \
|
||||
filepos.obj \
|
||||
fname.obj \
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
/* Segment definition */
|
||||
typedef struct SegDef SegDef;
|
||||
struct SegDef {
|
||||
const char* Name; /* Segment name */
|
||||
char* Name; /* Segment name */
|
||||
unsigned Type; /* Segment type, see above */
|
||||
};
|
||||
|
||||
|
|
|
@ -37,12 +37,13 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "abend.h"
|
||||
#include "debugflag.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* code */
|
||||
/* code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
@ -81,10 +82,10 @@ void* xrealloc (void* P, size_t Size)
|
|||
|
||||
|
||||
|
||||
void xfree (const void* Block)
|
||||
void xfree (void* Block)
|
||||
/* Free the block, do some debugging */
|
||||
{
|
||||
free ((void*) Block);
|
||||
free (Block);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ void* xmalloc (size_t Size);
|
|||
void* xrealloc (void* P, size_t Size);
|
||||
/* Reallocate a memory block, check for out of memory */
|
||||
|
||||
void xfree (const void* Block);
|
||||
void xfree (void* Block);
|
||||
/* Free the block, do some debugging */
|
||||
|
||||
char* xstrdup (const char* S);
|
||||
|
|
|
@ -114,7 +114,7 @@ void InsertImport (Import* I)
|
|||
unsigned HashVal;
|
||||
|
||||
/* As long as the import is not inserted, V.Name is valid */
|
||||
const char* Name = I->V.Name;
|
||||
char* Name = I->V.Name;
|
||||
|
||||
/* Create a hash value for the given name */
|
||||
HashVal = HashStr (Name) % HASHTAB_SIZE;
|
||||
|
|
|
@ -65,7 +65,7 @@ struct Import {
|
|||
FilePos Pos; /* File position of reference */
|
||||
union {
|
||||
struct Export* Exp; /* Matching export for this import */
|
||||
const char* Name; /* Name if not in table */
|
||||
char* Name; /* Name if not in table */
|
||||
} V;
|
||||
unsigned char Type; /* Type of import */
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user