]> git.sur5r.net Git - cc65/blobdiff - src/cc65/symtab.c
New optimization
[cc65] / src / cc65 / symtab.c
index 11a4252f49a43a3fa7ecbe57f203dd00e7817ee4..3bab90d7c01bb838937a6e56f3648ce55cc500ed 100644 (file)
@@ -165,9 +165,9 @@ static void CheckSymTable (SymTable* Tab)
            if (((Flags & SC_AUTO) || (Flags & SC_STATIC)) && (Flags & SC_EXTERN) == 0) {
                if ((Flags & SC_DEF) && !(Flags & SC_REF)) {
                    if (Flags & SC_PARAM) {
-                       Warning (WARN_UNUSED_PARM, Entry->Name);
+                       Warning ("Parameter `%s' is never used", Entry->Name);
                    } else {
-                       Warning (WARN_UNUSED_ITEM, Entry->Name);
+                       Warning ("`%s' is defined but never used", Entry->Name);
                    }
                }
            }
@@ -176,10 +176,10 @@ static void CheckSymTable (SymTable* Tab)
            if (Flags & SC_LABEL) {
                if ((Flags & SC_DEF) == 0) {
                    /* Undefined label */
-                   Error (ERR_UNDEFINED_LABEL, Entry->Name);
+                   Error ("Undefined label: `%s'", Entry->Name);
                } else if ((Flags & SC_REF) == 0) {
                    /* Defined but not used */
-                   Warning (WARN_UNUSED_ITEM, Entry->Name);
+                   Warning ("`%s' is defined but never used", Entry->Name);
                }
            }
 
@@ -536,10 +536,10 @@ SymEntry* AddStructSym (const char* Name, unsigned Size, SymTable* Tab)
        /* We do have an entry. This may be a forward, so check it. */
        if ((Entry->Flags & SC_STRUCT) == 0) {
            /* Existing symbol is not a struct */
-           Error (ERR_SYMBOL_KIND);
+           Error ("Symbol `%s' is already different kind", Name);
        } else if (Size > 0 && Entry->V.S.Size > 0) {
            /* Both structs are definitions. */
-           Error (ERR_MULTIPLE_DEFINITION, Name);
+           Error ("Multiple definition for `%s'", Name);
        } else {
            /* Define the struct size if it is given */
            if (Size > 0) {
@@ -574,9 +574,9 @@ SymEntry* AddEnumSym (const char* Name, int Val)
     SymEntry* Entry = FindSymInTable (SymTab, Name, HashStr (Name));
     if (Entry) {
        if (Entry->Flags != SC_ENUM) {
-           Error (ERR_SYMBOL_KIND);
+           Error ("Symbol `%s' is already different kind", Name);
        } else {
-           Error (ERR_MULTIPLE_DEFINITION, Name);
+           Error ("Multiple definition for `%s'", Name);
        }
        return Entry;
     }
@@ -608,7 +608,7 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags)
 
        if ((Entry->Flags & SC_DEF) != 0 && (Flags & SC_DEF) != 0) {
            /* Trying to define the label more than once */
-                   Error (ERR_MULTIPLE_DEFINITION, Name);
+                   Error ("Label `%s' is defined more than once", Name);
        }
        Entry->Flags |= Flags;
 
@@ -639,7 +639,7 @@ SymEntry* AddLocalSym (const char* Name, type* Type, unsigned Flags, int Offs)
     if (Entry) {
 
        /* We have a symbol with this name already */
-       Error (ERR_MULTIPLE_DEFINITION, Name);
+       Error ("Multiple definition for `%s'", Name);
 
     } else {
 
@@ -675,7 +675,7 @@ SymEntry* AddGlobalSym (const char* Name, type* Type, unsigned Flags)
 
        /* We have a symbol with this name already */
        if (Entry->Flags & SC_TYPE) {
-           Error (ERR_MULTIPLE_DEFINITION, Name);
+           Error ("Multiple definition for `%s'", Name);
            return Entry;
        }
 
@@ -695,7 +695,8 @@ SymEntry* AddGlobalSym (const char* Name, type* Type, unsigned Flags)
            if ((Size != 0 && ESize != 0) ||
                TypeCmp (Type+DECODE_SIZE+1, EType+DECODE_SIZE+1) < TC_EQUAL) {
                /* Types not identical: Conflicting types */
-               Error (ERR_CONFLICTING_TYPES, Name);
+               Error ("Conflicting types for `%s'", Name);
+               return Entry;
            } else {
                /* Check if we have a size in the existing definition */
                if (ESize == 0) {
@@ -707,7 +708,8 @@ SymEntry* AddGlobalSym (const char* Name, type* Type, unsigned Flags)
                } else {
            /* New type must be identical */
            if (TypeCmp (EType, Type) < TC_EQUAL) {
-               Error (ERR_CONFLICTING_TYPES, Name);
+               Error ("Conflicting types for `%s'", Name);
+               return Entry;
            }
 
            /* In case of a function, use the new type descriptor, since it
@@ -715,7 +717,7 @@ SymEntry* AddGlobalSym (const char* Name, type* Type, unsigned Flags)
             * an actual function definition follows.
             */
            if (IsTypeFunc (Type)) {
-               CopyEncode (Type+1, EType+1);
+               CopyEncode (Type+1, EType+1);
            }
        }
 
@@ -772,7 +774,7 @@ void MakeZPSym (const char* Name)
     if (Entry) {
        Entry->Flags |= SC_ZEROPAGE;
     } else {
-       Error (ERR_UNDEFINED_SYMBOL, Name);
+       Error ("Undefined symbol: `%s'", Name);
     }
 }