mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Output warnings for implicit int types if std >= C99.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3361 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
9cd0b7705c
commit
5c1bc2d740
@ -151,7 +151,10 @@ static void Parse (void)
|
|||||||
SymFlags = Spec.StorageClass;
|
SymFlags = Spec.StorageClass;
|
||||||
if (IsTypeFunc (Decl.Type)) {
|
if (IsTypeFunc (Decl.Type)) {
|
||||||
SymFlags |= SC_FUNC;
|
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) {
|
if (NeedStorage) {
|
||||||
/* We will allocate storage, variable is defined */
|
/* We will allocate storage, variable is defined */
|
||||||
SymFlags |= SC_STORAGE | SC_DEF;
|
SymFlags |= SC_STORAGE | SC_DEF;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2004 Ullrich von Bassewitz */
|
/* (C) 1998-2005 Ullrich von Bassewitz */
|
||||||
/* Römerstraße 52 */
|
/* Römerstraße 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@ -843,7 +843,12 @@ static FuncDesc* ParseFuncDecl (const DeclSpec* Spec)
|
|||||||
if ((Spec->Flags & DS_DEF_TYPE) != 0 &&
|
if ((Spec->Flags & DS_DEF_TYPE) != 0 &&
|
||||||
Spec->Type[0] == T_INT &&
|
Spec->Type[0] == T_INT &&
|
||||||
Spec->Type[1] == T_END) {
|
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;
|
F->Flags |= FD_OLDSTYLE_INTRET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "loadexpr.h"
|
#include "loadexpr.h"
|
||||||
#include "locals.h"
|
#include "locals.h"
|
||||||
#include "stackptr.h"
|
#include "stackptr.h"
|
||||||
|
#include "standard.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "typeconv.h"
|
#include "typeconv.h"
|
||||||
|
|
||||||
@ -432,6 +433,13 @@ static void ParseOneDecl (const DeclSpec* Spec)
|
|||||||
} else {
|
} else {
|
||||||
Internal ("Invalid storage class in ParseOneDecl: %04X", SC);
|
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 */
|
/* If the symbol is not marked as external, it will be defined now */
|
||||||
|
Loading…
Reference in New Issue
Block a user