gdb complains about:
[fw/sdcc] / src / SDCCglobl.h
index 7290bbf5696bc80428cdb34df6ed7716a5914219..d5547fdf135f82ee0430cac0e7b0f6db1e1409b6 100644 (file)
@@ -1,4 +1,4 @@
-/* SDCCglobl.h - global macros etc required by all files */
+;/* SDCCglobl.h - global macros etc required by all files */
 #ifndef SDCCGLOBL_H
 #define SDCCGLOBL_H
 #include <memory.h>
@@ -6,19 +6,25 @@
 #include <stdlib.h>
 #include <setjmp.h>
 #include <stdio.h>
-#include "sdccconf.h"
-#include "SDCCerr.h"
-
-#ifdef _NO_GC
 
-#define GC_malloc malloc
-#define GC_free free
-#define GC_realloc realloc
-#define GC_malloc_atomic malloc
+#if defined(_MSC_VER)
+#      include "sdcc_vc.h"
 #else
+#      include "sdccconf.h"
+#endif // _MSC_VER
+
+#include "SDCCerr.h"
 
-#include "./gc/gc.h" 
+#if defined(_MSC_VER)
+#      define NATIVE_WIN32             1
+#endif
+
+#ifdef __BORLANDC__
+#define NATIVE_WIN32           1
+#endif
 
+#ifdef __MINGW32__
+#define NATIVE_WIN32           1
 #endif
 
 #define SPACE ' '
@@ -82,11 +88,21 @@ typedef int bool;
     type *type##FreeStack [size]  ; \
     int   type##StackPtr = 0      ;
 
-#define ALLOCTYPE(type,size) if (!(type##Pool = GC_malloc(size*sizeof(type))))   \
+#if 0
+#define  ALLOC(x,sz) if (!(x = calloc(1, sz)))      \
+         {                                          \ 
+            werror(E_OUT_OF_MEM,__FILE__,(long) sz);\
+            exit (1);                               \
+         }
+#endif
+
+#if 0
+#define ALLOCTYPE(type,size) if (!(type##Pool = calloc(1, size*sizeof(type))))\
          {                                                            \
-            werror(E_OUT_OF_MEM,__FILE__,(long) size);                          \
+            werror(E_OUT_OF_MEM,__FILE__,(long) size);               \
             exit (1);                                                \
          }
+#endif
 
 #define PUSH(x,y)   x##FreeStack[x##StackPtr++] = y
 #define PEEK(x)     x##FreeStack[x##StackPtr-1]
@@ -99,17 +115,6 @@ typedef int bool;
 #define EMPTY(x)       (x##StackPtr == 0 ? 1 : 0)
 #endif
 
-#define  ALLOC(x,sz) if (!(x = GC_malloc(sz)))      \
-         {                                          \
-            werror(E_OUT_OF_MEM,__FILE__,(long) sz);\
-            exit (1);                               \
-         }
-
-#define ALLOC_ATOMIC(x,sz)   if (!(x = GC_malloc_atomic(sz)))   \
-         {                                               \
-            werror(E_OUT_OF_MEM,__FILE__,(long) sz);     \
-            exit (1);                                    \
-         }
 
 #define COPYTYPE(start,end,from) (end = getSpec (start = from))
 
@@ -163,14 +168,21 @@ struct optimize {
     unsigned    noLoopReverse :1;
 } ;
 
-/* Values for options.model. */
-#define MODEL_SMALL    0
-#define MODEL_LARGE    1
-#define MODEL_FLAT24   2
+/** Build model.
+    Used in options.model.A bit each as port.supported_models is an OR
+    of these. 
+*/
+enum {
+    MODEL_SMALL              = 1,
+    MODEL_COMPACT     = 2,
+    MODEL_MEDIUM      = 4,
+    MODEL_LARGE              = 8,
+    MODEL_FLAT24      = 16
+};
 
 /* other command line options */
 struct options {
-    int model  : 3     ; /* see MODEL_* defines above */
+    int model;          /* see MODEL_* defines above */
     int stackAuto : 3  ; /* Stack Automatic  */
     int useXstack : 3  ; /* use Xternal Stack */
     int stack10bit : 3;  /* use 10 bit stack (flat24 model only) */
@@ -193,11 +205,16 @@ struct options {
     int nopeep    : 1  ; /* no peep hole optimization */
     int asmpeep   : 1  ; /* pass inline assembler thru peep hole */
     int debug     : 1  ; /* generate extra debug info */
+    int nodebug          : 1  ; /* Generate no debug info. */
     int stackOnData:1  ; /* stack after data segment  */
     int noregparms: 1  ; /* do not pass parameters in registers */
     int c1mode   : 1  ; /* Act like c1 - no pre-proc, asm or link */
     char *peep_file    ; /* additional rules for peep hole */
     char *out_name     ; /* Asm output name for c1 mode */
+    int nostdlib  : 1  ; /* Don't use standard lib files */
+    int nostdinc  : 1  ; /* Don't use standard include files */
+    int verbose   : 1  ; /* Show what the compiler is doing */
+    int ANSIint   : 1  ;  /* Use ANSI integer promotion rules in expressions. */
 
     char *calleeSaves[128]; /* list of functions using callee save */
     char *excludeRegs[32] ; /* registers excluded from saving */
@@ -233,6 +250,20 @@ extern int      currBlockno;     /* sequentail block number */
 extern struct optimize optimize ;
 extern struct options options;
 extern int maxInterrupts;
+
+/* Visible from SDCCmain.c */
+extern int nrelFiles;
+extern char *relFiles[128];
+extern char *libFiles[128] ;
+extern int nlibFiles;
+
+/*
+void buildCmdLine(char *into, char **args, const char **cmds, 
+                         const char *p1, const char *p2, 
+                         const char *p3, const char **list);
+int my_system (const char *cmd, char **cmd_argv);
+*/
+
 void parseWithComma (char **,char *) ;
 
 /** Creates a temporary file a'la tmpfile which avoids the bugs
@@ -241,4 +272,18 @@ void parseWithComma (char **,char *) ;
 */
 FILE *tempfile(void);
 
+/** Creates a duplicate of the string 'sz' a'la strdup but using
+    libgc.
+*/
+char *gc_strdup(const char *sz);
+
+/** An assert() macro that will go out through sdcc's error
+    system.
+*/
+#define wassertl(a,s)  ((a) ? 0 : \
+        (werror (E_INTERNAL_ERROR,__FILE__,__LINE__, s), 0))
+
+#define wassert(a)    wassertl(a,"code generator internal error")
+
+
 #endif