/* */
/* */
/* */
-/* (C) 1998-2005 Ullrich von Bassewitz */
-/* Römerstraße 52 */
+/* (C) 1998-2008 Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
}
/* Create a symbol table entry with type int */
- AddLocalSym (CurTok.Ident, type_int, SC_AUTO | SC_PARAM | SC_DEF, 0);
+ AddLocalSym (CurTok.Ident, type_int, SC_AUTO | SC_PARAM | SC_DEF | SC_DEFTYPE, 0);
/* Count arguments */
++F->ParamCount;
/* Parse a comma separated variable list */
while (1) {
- Declaration Decl;
+ Declaration Decl;
/* Read the parameter */
ParseDecl (&Spec, &Decl, DM_NEED_IDENT);
/* We have a name given. Search for the symbol */
SymEntry* Sym = FindLocalSym (Decl.Ident);
if (Sym) {
- /* Found it, change the default type to the one given */
- ChangeSymType (Sym, ParamTypeCvt (Decl.Type));
+ /* Check if we already changed the type for this
+ * parameter
+ */
+ if (Sym->Flags & SC_DEFTYPE) {
+ /* Found it, change the default type to the one given */
+ ChangeSymType (Sym, ParamTypeCvt (Decl.Type));
+ /* Reset the "default type" flag */
+ Sym->Flags &= ~SC_DEFTYPE;
+ } else {
+ /* Type has already been changed */
+ Error ("Redefinition for parameter `%s'", Sym->Name);
+ }
} else {
Error ("Unknown identifier: `%s'", Decl.Ident);
}
/* */
/* */
/* */
-/* (C) 2000-2006 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
+/* (C) 2000-2008 Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
#define SC_PARAM 0x0080U /* This is a function parameter */
#define SC_FUNC 0x0100U /* Function entry */
+#define SC_DEFTYPE 0x0200U /* Parameter has default type (=int, old style) */
#define SC_STORAGE 0x0400U /* Symbol with associated storage */
#define SC_DEFAULT 0x0800U /* Flag: default storage class was used */