1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00

silence more debug stuff

This commit is contained in:
mrdudz 2022-07-21 02:31:55 +02:00
parent 77ce005d0a
commit 6001f5d0e0
5 changed files with 96 additions and 64 deletions

View File

@ -4,7 +4,7 @@
** 2020-11-20, Greg King
*/
//#define DEBUG
#include <stdio.h>
#include <stdlib.h>
@ -40,7 +40,13 @@
#include "typeconv.h"
#include "expr.h"
#ifdef DEBUG
#define LOG(x) printf x
#define FIXME(x) printf x
#else
#define LOG(x)
#define FIXME(x)
#endif
/*****************************************************************************/
/* Data */
@ -2044,7 +2050,7 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */
int rconst; /* Right operand is a constant */
int floatop = 0;
//printf("hie_internal\n");
//LOG(("hie_internal\n"));
ExprWithCheck (hienext, Expr);
*UsedGen = 0;
@ -2124,7 +2130,7 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */
) {
Error ("RHS Integer expression expected (hie_internal)");
}
printf("hie_internal lconst:%d rconst:%d\n", lconst, rconst);
LOG(("hie_internal lconst:%d rconst:%d\n", lconst, rconst));
/* Check for const operands */
if (lconst && rconst) {
@ -2135,14 +2141,14 @@ printf("hie_internal lconst:%d rconst:%d\n", lconst, rconst);
Expr->Type = ArithmeticConvert (Expr->Type, Expr2.Type);
/* FIXME: float --- newcode start */
printf("hie_internal Expr->Type:%s Expr2->Type:%s\n",
LOG(("hie_internal Expr->Type:%s Expr2->Type:%s\n",
(IsClassFloat (Expr->Type) == CF_FLOAT) ? "float" : "int",
(IsClassFloat (Expr2.Type) == CF_FLOAT) ? "float" : "int"
);
printf("hie_internal Expr->Type:%s Expr2->Type:%s\n",
));
LOG(("hie_internal Expr->Type:%s Expr2->Type:%s\n",
(Expr->Type == type_float) ? "float" : "int",
(Expr2.Type == type_float) ? "float" : "int"
);
));
/* FIXME: float */
/* FIXME: right now this works only when both rhs and lhs are float,
@ -2154,7 +2160,7 @@ printf("hie_internal Expr->Type:%s Expr2->Type:%s\n",
/* Evaluate the result for float operands */
Double Val1 = Expr->V.FVal;
Double Val2 = Expr2.V.FVal;
printf("hie_internal float X float\n");
LOG(("hie_internal float X float\n"));
switch (Tok) {
case TOK_DIV:
#if 0 // TODO
@ -2175,7 +2181,7 @@ printf("hie_internal Expr->Type:%s Expr2->Type:%s\n",
}
/* FIXME: float --- newcode end */
} else {
printf("hie_internal signed int X signed int\n");
LOG(("hie_internal signed int X signed int\n"));
/* Handle the op differently for signed and unsigned types */
if (IsSignSigned (Expr->Type)) {
@ -2215,7 +2221,7 @@ printf("hie_internal Expr->Type:%s Expr2->Type:%s\n",
Internal ("hie_internal: got token 0x%X\n", Tok);
}
} else {
printf("hie_internal unsigned int X unsigned int\n");
LOG(("hie_internal unsigned int X unsigned int\n"));
/* Evaluate the result for unsigned operands */
unsigned long Val1 = Expr->IVal;
@ -2373,7 +2379,7 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
if (ED_IsConstAbs (Expr)) {
/* Numeric constant value */
GetCodePos (&Mark2);
// printf("iVal:%08x FVal:%f\n", Expr->IVal, Expr->V.FVal.V);
// LOG(("iVal:%08x FVal:%f\n", Expr->IVal, Expr->V.FVal.V));
g_push (ltype | CF_CONST, Expr->IVal);
} else {
/* Value not numeric constant */
@ -2838,11 +2844,11 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
flags = CF_INT;
} else if (!DoArrayRef && IsClassFloat (lhst) && IsClassFloat (rhst)) {
/* FIXME: float addition (const + const) */
printf("%s:%d float addition (const + const)\n", __FILE__, __LINE__);
LOG(("%s:%d float addition (const + const)\n", __FILE__, __LINE__));
/* Integer addition */
flags = CF_FLOAT;
} else {
printf("%s:%d OOPS\n", __FILE__, __LINE__);
LOG(("%s:%d OOPS\n", __FILE__, __LINE__));
/* OOPS */
AddDone = -1;
/* Avoid further errors */
@ -2858,7 +2864,7 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
Expr->Type = type_float;
//Expr->Type = ArithmeticConvert (Expr->Type, Expr2.Type);
AddDone = 1;
printf("%s:%d float addition (const + const) res:%f\n", __FILE__, __LINE__, Expr->V.FVal.V);
LOG(("%s:%d float addition (const + const) res:%f\n", __FILE__, __LINE__, Expr->V.FVal.V));
} else {
/* integer + integer */
if (ED_IsAbs (&Expr2) &&
@ -2983,10 +2989,10 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
} else if (!DoArrayRef && IsClassFloat (lhst) && IsClassFloat (rhst)) {
/* Float addition */
/*flags |= typeadjust (Expr, &Expr2, 1);*/
printf("%s:%d float addition (const + var)\n", __FILE__, __LINE__);
LOG(("%s:%d float addition (const + var)\n", __FILE__, __LINE__));
} else {
/* OOPS */
printf("%s:%d OOPS\n", __FILE__, __LINE__);
LOG(("%s:%d OOPS\n", __FILE__, __LINE__));
AddDone = -1;
}
@ -3080,14 +3086,14 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
flags = typeadjust (Expr, &Expr2, 1);
} else if (!DoArrayRef && IsClassFloat (lhst) && IsClassFloat (rhst)) {
/* FIXME: float - what to do here exactly? */
printf("%s:%d float addition (Expr2.V.FVal.V:%f)\n", __FILE__, __LINE__, Expr2.V.FVal.V);
LOG(("%s:%d float addition (Expr2.V.FVal.V:%f)\n", __FILE__, __LINE__, Expr2.V.FVal.V));
/* Float addition (variable+constant) */
/*flags = typeadjust (Expr, &Expr2, 1);*/
flags |= CF_FLOAT;
Expr->Type = Expr2.Type;
} else {
/* OOPS */
printf("%s:%d OOPS\n", __FILE__, __LINE__);
LOG(("%s:%d OOPS\n", __FILE__, __LINE__));
AddDone = -1;
}
@ -3142,7 +3148,7 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
LoadExpr (CF_NONE, &Expr2);
} else if (!DoArrayRef && IsClassFloat (lhst) && IsClassFloat (rhst)) {
/* FIXME: float - what to do here exactly? */
printf("%s:%d float addition (Expr2.V.FVal.V:%f)\n", __FILE__, __LINE__, Expr2.V.FVal.V);
LOG(("%s:%d float addition (Expr2.V.FVal.V:%f)\n", __FILE__, __LINE__, Expr2.V.FVal.V));
/* Float addition */
/* flags = typeadjust (Expr, &Expr2, 0); */
flags |= CF_FLOAT;
@ -3150,7 +3156,7 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
LoadExpr (CF_NONE, &Expr2);
} else {
/* OOPS */
printf("%s:%d OOPS\n", __FILE__, __LINE__);
LOG(("%s:%d OOPS\n", __FILE__, __LINE__));
AddDone = -1;
/* We can't just goto End as that would leave the stack unbalanced */
}
@ -3479,7 +3485,7 @@ static void parsesub (ExprDesc* Expr)
} else if (IsClassFloat (lhst) && IsClassFloat (rhst)) {
/* Float substraction */
/* FIXME: float - what to do here exactly? */
printf("%s:%d float substraction\n", __FILE__, __LINE__);
LOG(("%s:%d float substraction\n", __FILE__, __LINE__));
/* Adjust operand types */
/*flags = typeadjust (Expr, &Expr2, 0);*/
flags = CF_FLOAT;

View File

@ -31,6 +31,8 @@
/* */
/*****************************************************************************/
//#define DEBUG
#include <stdlib.h>
/* cc65 */
@ -40,7 +42,13 @@
#include "global.h"
#include "loadexpr.h"
#ifdef DEBUG
#define LOG(x) printf x
#define FIXME(x) printf x
#else
#define LOG(x)
#define FIXME(x)
#endif
/*****************************************************************************/
/* Code */
@ -51,7 +59,7 @@
static void LoadAddress (unsigned Flags, ExprDesc* Expr)
/* Load the primary register with some address value. */
{
printf("LoadAddress flags:%04x\n", Flags);
LOG(("LoadAddress flags:%04x\n", Flags));
switch (ED_GetLoc (Expr)) {
case E_LOC_ABS:
@ -119,7 +127,7 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr)
** unfortunately.
*/
{
/*printf("LoadExpr flags:%4x\n", Flags);*/
/*LOG(("LoadExpr flags:%4x\n", Flags));*/
if (!ED_IsAddrExpr (Expr)) {
/* Lvalue. If this is a bit field its type is unsigned. But if the
@ -172,12 +180,12 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr)
}
/* Load the content of Expr */
/*printf("LoadExpr ED_GetLoc:%04x\n", ED_GetLoc (Expr));*/
/*LOG(("LoadExpr ED_GetLoc:%04x\n", ED_GetLoc (Expr)));*/
switch (ED_GetLoc (Expr)) {
case E_LOC_NONE:
/* FIXME: float */
/*printf("LoadExpr E_LOC_NONE (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer");*/
/*LOG(("LoadExpr E_LOC_NONE (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"));*/
/* Immediate number constant */
if (TypeOf (Expr->Type) == CF_FLOAT) {
g_getimmed (Flags | CF_IMM | TypeOf (Expr->Type) | CF_CONST, FP_D_As32bitRaw(Expr->V.FVal), 0);
@ -187,56 +195,56 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr)
break;
case E_LOC_ABS:
printf("LoadExpr E_LOC_ABS (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer");
LOG(("LoadExpr E_LOC_ABS (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"));
if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_ABS\n", __FILE__, __LINE__); exit(-1); }
/* Absolute numeric addressed variable */
g_getstatic (Flags | CF_ABSOLUTE, Expr->IVal, 0);
break;
case E_LOC_GLOBAL:
/* printf("LoadExpr E_LOC_GLOBAL (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"); */
/* LOG(("LoadExpr E_LOC_GLOBAL (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer")); */
/* if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_GLOBAL\n", __FILE__, __LINE__); exit(-1); } */
/* Global variable, offset in IVal */
g_getstatic (Flags | CF_EXTERNAL, Expr->Name, Expr->IVal);
break;
case E_LOC_STATIC:
/* printf("LoadExpr E_LOC_STATIC (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"); */
/* LOG(("LoadExpr E_LOC_STATIC (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer")); */
/* if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_STATIC\n", __FILE__, __LINE__); exit(-1); } */
/* Static variable, offset in IVal */
g_getstatic (Flags | CF_STATIC, Expr->Name, Expr->IVal);
break;
case E_LOC_LITERAL:
/* printf("LoadExpr E_LOC_LITERAL (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"); */
/* LOG(("LoadExpr E_LOC_LITERAL (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer")); */
/* if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_LITERAL\n", __FILE__, __LINE__); exit(-1); } */
/* Literal in the literal pool, offset in IVal */
g_getstatic (Flags | CF_LITERAL, Expr->Name, Expr->IVal);
break;
case E_LOC_REGISTER:
/* printf("LoadExpr E_LOC_REGISTER (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"); */
/* LOG(("LoadExpr E_LOC_REGISTER (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer")); */
/* if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_REGISTER\n", __FILE__, __LINE__); exit(-1); } */
/* Register variable, offset in IVal */
g_getstatic (Flags | CF_REGVAR, Expr->Name, Expr->IVal);
break;
case E_LOC_CODE:
/* printf("LoadExpr E_LOC_CODE (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"); */
/* LOG(("LoadExpr E_LOC_CODE (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer")); */
/* if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_CODE\n", __FILE__, __LINE__); exit(-1); } */
/* Code label location, offset in IVal */
g_getstatic (Flags | CF_CODE, Expr->Name, Expr->IVal);
break;
case E_LOC_STACK:
/* printf("LoadExpr E_LOC_STACK (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"); */
/* LOG(("LoadExpr E_LOC_STACK (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer")); */
/* if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_STACK\n", __FILE__, __LINE__); exit(-1); } */
/* Fetch value on the stack (with offset in IVal) */
g_getlocal (Flags, Expr->IVal);
break;
case E_LOC_PRIMARY:
/*printf("LoadExpr E_LOC_PRIMARY (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer");*/
/*LOG(("LoadExpr E_LOC_PRIMARY (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"));*/
/*if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_PRIMARY\n", __FILE__, __LINE__); exit(-1); }*/
/* The primary register */
if (TypeOf (Expr->Type) == CF_FLOAT) {
@ -261,7 +269,7 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr)
break;
case E_LOC_EXPR:
/*printf("LoadExpr E_LOC_EXPR (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer");*/
/*LOG(("LoadExpr E_LOC_EXPR (%s)\n", (TypeOf (Expr->Type) == CF_FLOAT) ? "float" : "integer"));*/
/*if (TypeOf (Expr->Type) == CF_FLOAT) { printf("%s:%d FIXME: E_LOC_EXPR\n", __FILE__, __LINE__); exit(-1); }*/
/* Reference to address in primary with offset in IVal */
g_getind (Flags, Expr->IVal);

View File

@ -31,7 +31,7 @@
/* */
/*****************************************************************************/
//#define DEBUG
/* common */
#include "xmalloc.h"
@ -56,7 +56,13 @@
#include "typeconv.h"
#include "input.h"
#ifdef DEBUG
#define LOG(x) printf x
#define FIXME(x) printf x
#else
#define LOG(x)
#define FIXME(x)
#endif
/*****************************************************************************/
/* Code */
@ -198,7 +204,7 @@ static void ParseAutoDecl (Declaration* Decl)
/* Get the size of the variable */
unsigned Size = SizeOf (Decl->Type);
printf("ParseAutoDecl SIze:%d IsCompound:%d\n", Size, IsCompound);
LOG(("ParseAutoDecl SIze:%d IsCompound:%d\n", Size, IsCompound));
/* Check if this is a variable on the stack or in static memory */
if (IS_Get (&StaticLocals) == 0) {
@ -278,7 +284,7 @@ static void ParseAutoDecl (Declaration* Decl)
/* Push the value */
if (TypeOf (Sym->Type) == CF_FLOAT) {
/* FIXME: float */
printf("Expr.V.FVal.V: %f\n", Expr.V.FVal.V);
LOG(("ParseAutoDecl Expr.V.FVal.V: %f\n", Expr.V.FVal.V));
g_push_float (Flags | TypeOf (Sym->Type), Expr.V.FVal.V);
} else {
g_push (Flags | TypeOf (Sym->Type), Expr.IVal);

View File

@ -31,7 +31,7 @@
/* */
/*****************************************************************************/
//#define DEBUG
#include <stdio.h>
#include <stdlib.h>
@ -59,7 +59,13 @@
#include "standard.h"
#include "symtab.h"
#ifdef DEBUG
#define LOG(x) printf x
#define FIXME(x) printf x
#else
#define LOG(x)
#define FIXME(x)
#endif
/*****************************************************************************/
/* data */
@ -620,7 +626,7 @@ static void NumericConst (void)
/* Float constant */
Double FVal = FP_D_FromInt (IVal); /* Convert to double */
printf("NumericConst start IVal:%ld FVal: %f\n", IVal, FVal.V);
LOG(("NumericConst start IVal:%ld FVal: %f\n", IVal, FVal.V));
/* Check for a fractional part and read it */
if (CurC == '.') {
@ -694,7 +700,7 @@ static void NumericConst (void)
}
}
printf("NumericConst end FVal: %f\n", FVal.V);
LOG(("NumericConst end FVal: %f\n", FVal.V));
/* Check for a suffix and determine the type of the constant */
if (toupper (CurC) == 'F') {
@ -709,7 +715,7 @@ static void NumericConst (void)
NextTok.Tok = TOK_FCONST;
}
printf("NumericConst exit IsFloat:%d IVal: %ld FVal: %f\n", IsFloat, NextTok.IVal, NextTok.FVal.V);
LOG(("NumericConst exit IsFloat:%d IVal: %ld FVal: %f\n", IsFloat, NextTok.IVal, NextTok.FVal.V));
}

View File

@ -31,7 +31,7 @@
/* */
/*****************************************************************************/
//#define DEBUG
/* common */
#include "shift.h"
@ -47,7 +47,13 @@
#include "typecmp.h"
#include "typeconv.h"
#ifdef DEBUG
#define LOG(x) printf x
#define FIXME(x) printf x
#else
#define LOG(x)
#define FIXME(x)
#endif
/*****************************************************************************/
/* Code */
@ -97,10 +103,10 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType)
/* lvalue? */
if (ED_IsLVal (Expr)) {
printf("DoConversion 1 Old: %s New: %s\n",
(IsTypeFloat (OldType)) ? "float" : "int",
(IsTypeFloat (NewType)) ? "float" : "int"
);
LOG(("DoConversion 1 Old: %s New: %s\n",
(IsTypeFloat (OldType)) ? "float" : "int",
(IsTypeFloat (NewType)) ? "float" : "int"
));
/* We have an lvalue. If the new size is smaller than the old one,
** we don't need to do anything. The compiler will generate code
** to load only the portion of the value that is actually needed.
@ -124,10 +130,10 @@ printf("DoConversion 1 Old: %s New: %s\n",
}
} else if (ED_IsConstAbs (Expr)) {
printf("DoConversion 2 Old: %s New: %s\n",
(IsTypeFloat (OldType)) ? "float" : "int",
(IsTypeFloat (NewType)) ? "float" : "int"
);
LOG(("DoConversion 2 Old: %s New: %s\n",
(IsTypeFloat (OldType)) ? "float" : "int",
(IsTypeFloat (NewType)) ? "float" : "int"
));
/* A cast of a constant numeric value to another type. Be sure
** to handle sign extension correctly.
@ -137,11 +143,11 @@ printf("DoConversion 2 Old: %s New: %s\n",
if (IsTypeFloat (OldType) && !IsTypeFloat (NewType)) {
OldBits = 32;
Expr->IVal = FP_D_ToLong(Expr->V.FVal);
printf("DoConversion 2 new ival: %ld\n", Expr->IVal);
LOG(("DoConversion 2 new ival: %ld\n", Expr->IVal));
} else if (!IsTypeFloat (OldType) && IsTypeFloat (NewType)) {
OldBits = 0;
Expr->V.FVal = FP_D_FromInt(Expr->IVal);
printf("DoConversion 2 new fval: %f\n", Expr->V.FVal.V);
LOG(("DoConversion 2 new fval: %f\n", Expr->V.FVal.V));
}
/* FIXME: float --- end of new code */
@ -149,7 +155,7 @@ printf("DoConversion 2 Old: %s New: %s\n",
** has a larger range, things are OK, since the value is
** internally already represented by a long.
*/
printf("DoConversion 2 NewBits: %d OldBits: %d\n", NewBits, OldBits);
LOG(("DoConversion 2 NewBits: %d OldBits: %d\n", NewBits, OldBits));
if (NewBits <= OldBits) {
/* Cut the value to the new size */
@ -165,9 +171,9 @@ printf("DoConversion 2 Old: %s New: %s\n",
}
if (IsTypeFloat (NewType)) {
printf("DoConversion 2 new fval: %f\n", Expr->V.FVal.V);
LOG(("DoConversion 2 new fval: %f\n", Expr->V.FVal.V));
} else {
printf("DoConversion 2 new ival: %ld\n", Expr->IVal);
LOG(("DoConversion 2 new ival: %ld\n", Expr->IVal));
}
/* Do the integer constant <-> absolute address conversion if necessary */
@ -180,10 +186,10 @@ printf("DoConversion 2 Old: %s New: %s\n",
}
} else {
printf("DoConversion 3 Old: %s New: %s\n",
(IsTypeFloat (OldType)) ? "float" : "int",
(IsTypeFloat (NewType)) ? "float" : "int"
);
LOG(("DoConversion 3 Old: %s New: %s\n",
(IsTypeFloat (OldType)) ? "float" : "int",
(IsTypeFloat (NewType)) ? "float" : "int"
));
/* The value is not a constant. If the sizes of the types are
** not equal, add conversion code. Be sure to convert chars