Commits

tbone  committed 087c3ce

Changed #ifdef DEBUG to #ifdef DEBUG_DMD to allow debug output from D specific stuff and not from gcc itself

  • Participants
  • Parent commits c2eb0f4

Comments (0)

Files changed (36)

File d/dmd/cast.c

 
     //if (t1) printf("\tt1 = %s\n", t1->toChars());
     //if (t2) printf("\tt2 = %s\n", t2->toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!t2) printf("\te2 = '%s'\n", e2->toChars());
 #endif
     assert(t2);

File d/dmd/declaration.c

     : Declaration(id)
 {
     //printf("VarDeclaration('%s')\n", id->toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!type && !init)
     {   printf("VarDeclaration('%s')\n", id->toChars());
         //*(char*)0=0;

File d/dmd/dsymbol.c

 Dsymbol *DsymbolTable::lookup(Identifier *ident)
 {
 #if STRINGTABLE
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     assert(ident);
     assert(tab);
 #endif
     //printf("DsymbolTable::insert(this = %p, '%s')\n", this, s->ident->toChars());
     Identifier *ident = s->ident;
 #if STRINGTABLE
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     assert(ident);
     assert(tab);
 #endif

File d/dmd/expression.c

 
             if (!arg->type)
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 if (!global.gag)
                     printf("1: \n");
 #endif
 
 void expToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e, enum PREC pr)
 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (precedence[e->op] == PREC_zero)
         printf("precedence not defined for token '%s'\n",Token::tochars[e->op]);
 #endif
     Expression *e;
     if (!size)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         fprintf(stdmsg, "No expression copy for: %s\n", toChars());
         printf("op = %d\n", op);
         dump(0);
 void Expression::toMangleBuffer(OutBuffer *buf)
 {
     error("expression %s is not a valid template value argument", toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 dump(0);
 #endif
 }
 {
     // Default is 'yes' - do nothing
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!type)
         dump(0);
 #endif
                  */
                 if (!global.errors)
                 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                     t->print();
 #endif
                     assert(0);
             }
 
             // BUG: handle other cases like in IdentifierExp::semantic()
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             printf("s = '%s', kind = '%s'\n", s->toChars(), s->kind());
 #endif
             assert(0);

File d/dmd/interpret.c

     else
     {
         error("%s cannot be evaluated at compile time", toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         dump(0);
 #endif
     }

File d/dmd/lexer.c

     return ::operator new(size);
 }
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 void Token::print()
 {
     fprintf(stdmsg, "%s\n", toChars());

File d/dmd/mangle.c

         buf.writestring(sthis->type->deco);
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         if (!fd->inferRetType)
             printf("%s\n", fd->toChars());
 #endif

File d/dmd/mars.c

  */
 void halt()
 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     *(char*)0=0;
 #endif
 }

File d/dmd/mars.h

 #include <stdarg.h>
 
 #ifdef __DMC__
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 #undef assert
 #define assert(e) (static_cast<void>((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt())))
 #endif

File d/dmd/mtype.c

     }
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         if (!global.gag)
             printf("1: ");
 #endif
 
     if (!t)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         if (s) printf("s = %s\n", s->kind());
         printf("2: e:%p s:%p ", e, s);
 #endif
 {
     if (!sym->memtype)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("1: ");
 #endif
         error(0, "enum %s is forward referenced", sym->toChars());
     }
     if (!sym->memtype)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("2: ");
 #endif
         error(sym->loc, "enum %s is forward referenced", sym->toChars());
     }
 
     d = s->isDeclaration();
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!d)
         printf("d = %s '%s'\n", s->kind(), s->toChars());
 #endif
     //printf("TypeTuple(this = %p)\n", this);
     this->arguments = arguments;
     //printf("TypeTuple() %s\n", toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (arguments)
     {
         for (size_t i = 0; i < arguments->dim; i++)
             buf->writeByte('L');
             break;
         default:
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             halt();
 #endif
             assert(0);

File d/dmd/scope.c

     this->fes = enclosing->fes;
     this->structalign = enclosing->structalign;
     this->enclosing = enclosing;
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (enclosing->enclosing)
         assert(!(enclosing->enclosing->flags & SCOPEfree));
     if (this == enclosing->enclosing)

File d/dmd/template.c

     }
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("bad Object = %p\n", oarg);
 #endif
         assert(0);
     }
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         o->print();
 #endif
         assert(0);
                 }
                 s = s2;
             }
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             //if (!s->parent) printf("s = %s %s\n", s->kind(), s->toChars());
 #endif
             //assert(s->parent);
                 buf.writestring(ta->deco);
             else
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 printf("ta = %d, %s\n", ta->ty, ta->toChars());
 #endif
                 assert(global.errors);

File d/dmd/todt.c

             }
             else if (dim > tadim)
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 printf("1: ");
 #endif
                 error(loc, "too many initializers, %d, for array[%d]", dim, tadim);
         {
             if (dim > tadim)
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 printf("2: ");
 #endif
                 error(loc, "too many initializers, %d, for array[%d]", dim, tadim);
 
 dt_t **Expression::toDt(dt_t **pdt)
 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     printf("Expression::toDt() %d\n", op);
     dump(0);
 #endif
     assert(var);
     if (!(var->isDataseg() || var->isCodeseg()) || var->needThis())
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("SymOffExp::toDt()\n");
 #endif
         error("non-constant expression %s", toChars());
         sd->dsym->toDt(pdt);
         return pdt;
     }
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     printf("VarExp::toDt(), kind = %s\n", var->kind());
 #endif
     error("non-constant expression %s", toChars());

File d/dmd/toobj.c

     {
         if (classinfo->structsize != classinfo_size)
         {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             printf("CLASSINFO_SIZE = x%x, classinfo->structsize = x%x\n", offset, classinfo->structsize);
 #endif
             error("mismatch between dmd and object.d or object.di found. Check installation and import paths with -v compiler switch.");

File d/dmd/unialpha.c

         { 0xAC00, 0xD7A3 },
     };
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
         //printf("%x\n", table[i][0]);
     }
 
 Lisnot:
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
         assert(u < table[i][0] || u > table[i][1]);
     return 0;
 
 Lis:
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
         if (u >= table[i][0] && u <= table[i][1])

File d/dmd2/cast.c

 
     //if (t1) printf("\tt1 = %s\n", t1->toChars());
     //if (t2) printf("\tt2 = %s\n", t2->toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!t2) printf("\te2 = '%s'\n", e2->toChars());
 #endif
     assert(t2);

File d/dmd2/declaration.c

     : Declaration(id)
 {
     //printf("VarDeclaration('%s')\n", id->toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!type && !init)
     {   printf("VarDeclaration('%s')\n", id->toChars());
         //*(char*)0=0;

File d/dmd2/dsymbol.c

 Dsymbol *DsymbolTable::lookup(Identifier *ident)
 {
 #if STRINGTABLE
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     assert(ident);
     assert(tab);
 #endif
     //printf("DsymbolTable::insert(this = %p, '%s')\n", this, s->ident->toChars());
     Identifier *ident = s->ident;
 #if STRINGTABLE
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     assert(ident);
     assert(tab);
 #endif

File d/dmd2/expression.c

 
             if (!arg->type)
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 if (!global.gag)
                     printf("1: \n");
 #endif
 
 void expToCBuffer(OutBuffer *buf, HdrGenState *hgs, Expression *e, enum PREC pr)
 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (precedence[e->op] == PREC_zero)
         printf("precedence not defined for token '%s'\n",Token::tochars[e->op]);
 #endif
     Expression *e;
     if (!size)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         fprintf(stdmsg, "No expression copy for: %s\n", toChars());
         printf("op = %d\n", op);
         dump(0);
 void Expression::toMangleBuffer(OutBuffer *buf)
 {
     error("expression %s is not a valid template value argument", toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 dump(0);
 #endif
 }
 {
     // Default is 'yes' - do nothing
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!type)
         dump(0);
 #endif
                  */
                 if (!global.errors)
                 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                     t->print();
 #endif
                     assert(0);
             }
 
             // BUG: handle other cases like in IdentifierExp::semantic()
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             printf("s = '%s', kind = '%s'\n", s->toChars(), s->kind());
 #endif
             assert(0);

File d/dmd2/interpret.c

     else
     {
         error("%s cannot be evaluated at compile time", toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         dump(0);
 #endif
     }

File d/dmd2/lexer.c

     return ::operator new(size);
 }
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 void Token::print()
 {
     fprintf(stdmsg, "%s\n", toChars());

File d/dmd2/mangle.c

         buf.writestring(sthis->type->deco);
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         if (!fd->inferRetType)
             printf("%s\n", fd->toChars());
 #endif

File d/dmd2/mars.c

  */
 void halt()
 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     *(char*)0=0;
 #endif
 }

File d/dmd2/mars.h

 #include <stdarg.h>
 
 #ifdef __DMC__
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 #undef assert
 #define assert(e) (static_cast<void>((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt())))
 #endif
 #endif
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 #define UNITTEST 1
 #endif
 void unittests();

File d/dmd2/mtype.c

         sv = stringtable.update((char *)buf.data, buf.offset);
         if (sv->ptrvalue)
         {   t = (Type *) sv->ptrvalue;
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             if (!t->deco)
                 printf("t = %s\n", t->toChars());
 #endif
         ti->semantic2(sc);
         ti->semantic3(sc);
         impl = ti->toAlias()->isStructDeclaration();
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         if (!impl)
         {   Dsymbol *s = ti->toAlias();
             printf("%s %s\n", s->kind(), s->toChars());
     }
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         if (!global.gag)
             printf("1: ");
 #endif
 
     if (!t)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("2: ");
 #endif
         error(loc, "%s is used as a type", toChars());
 {
     if (!sym->memtype)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("1: ");
 #endif
         error(0, "enum %s is forward referenced", sym->toChars());
     }
     if (!sym->memtype)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("2: ");
 #endif
         error(sym->loc, "enum %s is forward referenced", sym->toChars());
     }
     if (!sym->defaultval)
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("3: ");
 #endif
         error(loc, "enum %s is forward referenced", sym->toChars());
     }
 
     d = s->isDeclaration();
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (!d)
         printf("d = %s '%s'\n", s->kind(), s->toChars());
 #endif
     //printf("TypeTuple(this = %p)\n", this);
     this->arguments = arguments;
     //printf("TypeTuple() %p, %s\n", this, toChars());
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (arguments)
     {
         for (size_t i = 0; i < arguments->dim; i++)
             buf->writeByte('L');
             break;
         default:
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             halt();
 #endif
             assert(0);

File d/dmd2/scope.c

     this->fes = enclosing->fes;
     this->structalign = enclosing->structalign;
     this->enclosing = enclosing;
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     if (enclosing->enclosing)
         assert(!(enclosing->enclosing->flags & SCOPEfree));
     if (this == enclosing->enclosing)

File d/dmd2/template.c

     }
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("bad Object = %p\n", oarg);
 #endif
         assert(0);
     }
     else
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         o->print();
 #endif
         assert(0);
                 }
                 s = s2;
             }
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             //if (!s->parent) printf("s = %s %s\n", s->kind(), s->toChars());
 #endif
             //assert(s->parent);
                 buf.writestring(ta->deco);
             else
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 printf("ta = %d, %s\n", ta->ty, ta->toChars());
 #endif
                 assert(global.errors);

File d/dmd2/todt.c

             }
             else if (dim > tadim)
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 printf("1: ");
 #endif
                 error(loc, "too many initializers, %d, for array[%d]", dim, tadim);
         {
             if (dim > tadim)
             {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
                 printf("2: ");
 #endif
                 error(loc, "too many initializers, %d, for array[%d]", dim, tadim);
 
 dt_t **Expression::toDt(dt_t **pdt)
 {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     printf("Expression::toDt() %d\n", op);
     dump(0);
 #endif
         var->needThis() ||
         var->isThreadlocal())
     {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("SymOffExp::toDt()\n");
 #endif
         error("non-constant expression %s", toChars());
         sd->dsym->toDt(pdt);
         return pdt;
     }
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     printf("VarExp::toDt(), kind = %s\n", var->kind());
 #endif
     error("non-constant expression %s", toChars());

File d/dmd2/toobj.c

     {
         if (classinfo->structsize != classinfo_size)
         {
-#ifdef DEBUG
+#ifdef DEBUG_DMD
             printf("CLASSINFO_SIZE = x%x, classinfo->structsize = x%x\n", offset, classinfo->structsize);
 #endif
             error("mismatch between dmd and object.d or object.di found. Check installation and import paths with -v compiler switch.");

File d/dmd2/unialpha.c

         { 0xAC00, 0xD7A3 },
     };
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
         //printf("%x\n", table[i][0]);
     }
 
 Lisnot:
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
         assert(u < table[i][0] || u > table[i][1]);
     return 0;
 
 Lis:
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     for (int i = 0; i < sizeof(table) / sizeof(table[0]); i++)
     {
         if (u >= table[i][0] && u <= table[i][1])

File d/phobos/internal/deh.c

         spoff = handler_table->espoffset;
         retoffset = handler_table->retoffset;
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         printf("retaddr = x%x\n",(unsigned)retaddr);
         printf("regebp=x%04x, funcoffset=x%04x, spoff=x%x, retoffset=x%x\n",
         regebp,funcoffset,spoff,retoffset);

File d/zlib/deflate.c

 local uInt longest_match  OF((deflate_state *s, IPos cur_match));
 #endif
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 local  void check_match OF((deflate_state *s, IPos start, IPos match,
                             int length));
 #endif
 
 #endif /* FASTEST */
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
  */

File d/zlib/deflate.h

     uInt matches;       /* number of string matches in current block */
     int last_eob_len;   /* bit length of EOB code for last block */
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     ulg compressed_len; /* total bit length of compressed file mod 2^32 */
     ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
 #endif

File d/zlib/trees.c

 
 #include "deflate.h"
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 #  include <ctype.h>
 #endif
 
  * Send a value on a given number of bits.
  * IN assertion: length <= 16 and value fits in length bits.
  */
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 local void send_bits      OF((deflate_state *s, int value, int length));
 
 local void send_bits(s, value, length)
     s->bi_buf = 0;
     s->bi_valid = 0;
     s->last_eob_len = 8; /* enough lookahead for inflate */
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     s->compressed_len = 0L;
     s->bits_sent = 0L;
 #endif
     int last;         /* one if this is the last block for a file */
 {
     send_bits(s, (STORED_BLOCK<<1)+last, 3);    /* send block type */
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
     s->compressed_len += (stored_len + 4) << 3;
 #endif
 {
     send_bits(s, STATIC_TREES<<1, 3);
     send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
 #endif
     bi_flush(s);
     if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
         send_bits(s, STATIC_TREES<<1, 3);
         send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         s->compressed_len += 10L;
 #endif
         bi_flush(s);
 #endif
         send_bits(s, (STATIC_TREES<<1)+last, 3);
         compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         s->compressed_len += 3 + s->static_len;
 #endif
     } else {
         send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
                        max_blindex+1);
         compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         s->compressed_len += 3 + s->opt_len;
 #endif
     }
 
     if (last) {
         bi_windup(s);
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         s->compressed_len += 7;  /* align on byte boundary */
 #endif
     }
     }
     s->bi_buf = 0;
     s->bi_valid = 0;
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     s->bits_sent = (s->bits_sent+7) & ~7;
 #endif
 }
     if (header) {
         put_short(s, (ush)len);
         put_short(s, (ush)~len);
-#ifdef DEBUG
+#ifdef DEBUG_DMD
         s->bits_sent += 2*16;
 #endif
     }
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     s->bits_sent += (ulg)len<<3;
 #endif
     while (len--) {

File d/zlib/zutil.c

     case 8:     flags += 2 << 6;        break;
     default:    flags += 3 << 6;
     }
-#ifdef DEBUG
+#ifdef DEBUG_DMD
     flags += 1 << 8;
 #endif
 #if defined(ASMV) || defined(ASMINF)
     return flags;
 }
 
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 
 #  ifndef verbose
 #    define verbose 0

File d/zlib/zutil.h

 #endif
 
 /* Diagnostic functions */
-#ifdef DEBUG
+#ifdef DEBUG_DMD
 #  include <stdio.h>
    extern int ZLIB_INTERNAL z_verbose;
    extern void ZLIB_INTERNAL z_error OF((char *m));