SymFlags = Spec.StorageClass;
if (IsTypeFunc (Decl.Type)) {
SymFlags |= SC_FUNC;
- } else {
+ } else if ((SymFlags & SC_TYPEDEF) == 0) {
+ if ((Spec.Flags & DS_DEF_TYPE) != 0 && IS_Get (&Standard) >= STD_C99) {
+ Warning ("Implicit `int' is an obsolete feature");
+ }
if (NeedStorage) {
/* We will allocate storage, variable is defined */
SymFlags |= SC_STORAGE | SC_DEF;
/* */
/* */
/* */
-/* (C) 1998-2004 Ullrich von Bassewitz */
+/* (C) 1998-2005 Ullrich von Bassewitz */
/* Römerstraße 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
if ((Spec->Flags & DS_DEF_TYPE) != 0 &&
Spec->Type[0] == T_INT &&
Spec->Type[1] == T_END) {
- /* Function has an implicit int return */
+ /* Function has an implicit int return. Output a warning if we don't
+ * have the C89 standard enabled explicitly.
+ */
+ if (IS_Get (&Standard) >= STD_C99) {
+ Warning ("Implicit `int' return type is an obsolete feature");
+ }
F->Flags |= FD_OLDSTYLE_INTRET;
}
/* Get the flag bit for the next token */
unsigned F = FD_NONE;
switch (CurTok.Tok) {
- case TOK_FASTCALL: F = FD_FASTCALL; break;
- case TOK_NEAR: F = FD_NEAR; break;
- case TOK_FAR: F = FD_FAR; break;
+ case TOK_FASTCALL: F = FD_FASTCALL; break;
+ case TOK_NEAR: F = FD_NEAR; break;
+ case TOK_FAR: F = FD_FAR; break;
default: Internal ("Unexpected token: %d", CurTok.Tok);
}
#include "loadexpr.h"
#include "locals.h"
#include "stackptr.h"
+#include "standard.h"
#include "symtab.h"
#include "typeconv.h"
static void ParseOneDecl (const DeclSpec* Spec)
/* Parse one variable declaration */
{
- unsigned SC; /* Storage class for symbol */
+ unsigned SC; /* Storage class for symbol */
unsigned SymData = 0; /* Symbol data (offset, label name, ...) */
Declaration Decl; /* Declaration data structure */
} else {
Internal ("Invalid storage class in ParseOneDecl: %04X", SC);
}
+
+ /* If the standard was not set explicitly to C89, print a warning
+ * for variables with implicit int type.
+ */
+ if ((Spec->Flags & DS_DEF_TYPE) != 0 && IS_Get (&Standard) >= STD_C99) {
+ Warning ("Implicit `int' is an obsolete feature");
+ }
}
/* If the symbol is not marked as external, it will be defined now */