]> git.sur5r.net Git - cc65/commitdiff
Move the Debug flag into a new module "debugflag" in the common directory.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 4 Jan 2003 16:59:51 +0000 (16:59 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 4 Jan 2003 16:59:51 +0000 (16:59 +0000)
Remove the const qualifier from the argument of xfree().

git-svn-id: svn://svn.cc65.org/cc65/trunk@1877 b7a2c559-68d2-44c3-8de9-860c34a00d81

20 files changed:
src/ca65/macpack.c
src/ca65/scanner.c
src/ca65/scanner.h
src/cc65/codeent.c
src/cc65/codeseg.c
src/cc65/compile.c
src/cc65/expr.c
src/cc65/global.c
src/cc65/global.h
src/cc65/main.c
src/cc65/symtab.c
src/common/debugflag.c [new file with mode: 0644]
src/common/debugflag.h [new file with mode: 0644]
src/common/make/gcc.mak
src/common/make/watcom.mak
src/common/segdefs.h
src/common/xmalloc.c
src/common/xmalloc.h
src/ld65/exports.c
src/ld65/exports.h

index 0d968edba169df393ae314d5f060213eee7a3935..02875d0b36859dee19af219a125fab5b44c42c90 100644 (file)
@@ -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,
 };
index 537c35ec49da4b86d6c8ef676736d87393adc07c..22bba99a902895387fb1649da5de3280450e98f5 100644 (file)
@@ -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;
index eb214ab09570ac137ae6664496d51f246996150f..c10d69e3bfcbf8887de6f7f5ae178e66d8c2edcd 100644 (file)
@@ -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);
index 0a78fc858a26b9ad2acf84b5668c110be7af1562..b4a567b72bda399dda749764b029c807985256a3 100644 (file)
@@ -39,6 +39,7 @@
 /* common */
 #include "chartype.h"
 #include "check.h"
+#include "debugflag.h"
 #include "xmalloc.h"
 #include "xsprintf.h"
 
index 06260ff3a30c71488968d6afb10057237ab69c7c..ec229880cd5f57161a257a1bfff788987322a16a 100644 (file)
@@ -39,6 +39,7 @@
 /* common */
 #include "chartype.h"
 #include "check.h"
+#include "debugflag.h"
 #include "global.h"
 #include "hashstr.h"
 #include "strutil.h"
index f194cb1aa023d3fe5a9642f0a65a0be905159580..59698803627c15591976695dd66a39f839e543fe 100644 (file)
@@ -37,6 +37,7 @@
 #include <time.h>
 
 /* common */
+#include "debugflag.h"
 #include "version.h"
 #include "xmalloc.h"
 #include "xsprintf.h"
index 61372143004476fe9ae28e1343248b00631f6274..c375e02201264d190c278f179907a6265745d237 100644 (file)
@@ -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");
index 798c8569fac625cb3afc216fb785946383b75050..51cddb51179f7687995a88a67fda5f88158735c4 100644 (file)
@@ -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 */
 
index b7cc5a5dc1589705bcdf952ae8a7d02f94661427..ff8f3bc914449830dced4364b4545b227a874e68 100644 (file)
@@ -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 */
 
index f6686765df73668ed0214fd66443a41c97de62cc..8b1dc23b1147a423d3bdf0772c0682951e84fc7e 100644 (file)
@@ -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; 
 }
 
 
index dac4344b7412aa14220145071588c7fb650c6908..cc8dcc10604d9a2168bb95181231e1bb42d5c44c 100644 (file)
@@ -40,6 +40,7 @@
 
 /* common */
 #include "check.h"
+#include "debugflag.h"
 #include "hashstr.h"
 #include "xmalloc.h"
 
diff --git a/src/common/debugflag.c b/src/common/debugflag.c
new file mode 100644 (file)
index 0000000..991f42b
--- /dev/null
@@ -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 */
+
+
+
diff --git a/src/common/debugflag.h b/src/common/debugflag.h
new file mode 100644 (file)
index 0000000..e443b60
--- /dev/null
@@ -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
+
+
+
index beec9ebd1e6332f69832a8249f134357f6f53258..56691fb919097ec9ce7161c7e4a9b124a6764494 100644 (file)
@@ -15,6 +15,7 @@ OBJS =        abend.o         \
        check.o         \
        cmdline.o       \
        coll.o          \
+        debugflag.o     \
        exprdefs.o      \
        filepos.o       \
        fname.o         \
index f71b1d5137b47257164071a97183a4fc49cb2686..51551a6b301195c8233ba306d61933898499b8b6 100644 (file)
@@ -47,6 +47,7 @@ OBJS =        abend.obj       \
        check.obj       \
        cmdline.obj     \
        coll.obj        \
+        debugflag.obj   \
        exprdefs.obj    \
        filepos.obj     \
        fname.obj       \
index 9fe2f0d2b3d59e5a254765f88d0fc7bebf477727..2d4e4ba8e0686a8ef8d0cbe07039ba258db25a65 100644 (file)
@@ -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 */
 };
 
index 8b14d1ff5140003dcd29cdf85ca7d44fc3115408..673f6e69d49ab68eecd0b35a62a85dd1acd773fa 100644 (file)
 #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);
 }
 
 
index 4a9597fadb495f8d4a4a40a07a8550bb16c76aac..e041b9b1f509709b3662d8aeb368ba6a7d4d4c7d 100644 (file)
@@ -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);
index 7761a078a6b5bcf8d9b8f368559090044e9ce678..1978f22a646788f9b63ea46141ac31507b982876 100644 (file)
@@ -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;
index cad0313c09f7671759d5581aa792a112a951e4d8..4a2c8751d4e7bc28417a50c2e2ea1bee98ec7516 100644 (file)
@@ -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 */
 };