1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-27 14:29:52 +00:00

Minor rearrangements to make the code more robust in case of errors.

git-svn-id: svn://svn.cc65.org/cc65/trunk@549 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-12-04 20:39:17 +00:00
parent e131b6e432
commit cd6f591d11
2 changed files with 6 additions and 4 deletions

View File

@ -219,7 +219,7 @@ static void Parse (void)
} }
/* Function declaration? */ /* Function declaration? */
if (IsTypeFunc (Decl.Type)) { if (Entry && IsTypeFunc (Entry->Type)) {
/* Function */ /* Function */
if (!comma) { if (!comma) {

View File

@ -696,6 +696,7 @@ SymEntry* AddGlobalSym (const char* Name, type* Type, unsigned Flags)
TypeCmp (Type+DECODE_SIZE+1, EType+DECODE_SIZE+1) < TC_EQUAL) { TypeCmp (Type+DECODE_SIZE+1, EType+DECODE_SIZE+1) < TC_EQUAL) {
/* Types not identical: Conflicting types */ /* Types not identical: Conflicting types */
Error ("Conflicting types for `%s'", Name); Error ("Conflicting types for `%s'", Name);
return Entry;
} else { } else {
/* Check if we have a size in the existing definition */ /* Check if we have a size in the existing definition */
if (ESize == 0) { if (ESize == 0) {
@ -708,6 +709,7 @@ SymEntry* AddGlobalSym (const char* Name, type* Type, unsigned Flags)
/* New type must be identical */ /* New type must be identical */
if (TypeCmp (EType, Type) < TC_EQUAL) { if (TypeCmp (EType, Type) < TC_EQUAL) {
Error ("Conflicting types for `%s'", Name); Error ("Conflicting types for `%s'", Name);
return Entry;
} }
/* In case of a function, use the new type descriptor, since it /* 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. * an actual function definition follows.
*/ */
if (IsTypeFunc (Type)) { if (IsTypeFunc (Type)) {
CopyEncode (Type+1, EType+1); CopyEncode (Type+1, EType+1);
} }
} }