Added missing checks for forward declarations of the main() function.

More accurate diagnosis on implicit 'int' type specifiers.
This commit is contained in:
acqn
2024-01-23 14:33:05 +08:00
parent bea2e86210
commit ba75a2ac26
5 changed files with 50 additions and 70 deletions

View File

@@ -1,4 +1,4 @@
bug1889-missing-identifier.c:3: Error: Identifier or ';' expected after declaration specifiers
bug1889-missing-identifier.c:3: Warning: Implicit 'int' is an obsolete feature
bug1889-missing-identifier.c:3: Warning: Implicit 'int' type specifier is an obsolete feature
bug1889-missing-identifier.c:4: Error: 'inline' on empty declaration
bug1889-missing-identifier.c:6: Error: Expression expected

View File

@@ -33,4 +33,6 @@ inline int main(void) /* Error */
f2b(); /* Still imported */
}
inline int main(void); /* Error */
/* Warning: non-external inline functions declared but undefined in TU */

View File

@@ -13,8 +13,9 @@ inline-error.c:22: Error: 'inline' on non-function declaration
inline-error.c:23: Error: 'inline' on non-function declaration
inline-error.c:24: Error: 'inline' on non-function declaration
inline-error.c:34: Warning: Variable 'fp2' is defined but never used
inline-error.c:37: Warning: Inline function 'f1a' used but never defined
inline-error.c:37: Warning: Inline function 'f1b' used but never defined
inline-error.c:37: Warning: Static function 'f1c' used but never defined
inline-error.c:37: Warning: Inline function 'f2a' used but never defined
inline-error.c:37: Warning: Inline function 'f2b' used but never defined
inline-error.c:36: Error: 'main' cannot be declared inline
inline-error.c:39: Warning: Inline function 'f1a' used but never defined
inline-error.c:39: Warning: Inline function 'f1b' used but never defined
inline-error.c:39: Warning: Static function 'f1c' used but never defined
inline-error.c:39: Warning: Inline function 'f2a' used but never defined
inline-error.c:39: Warning: Inline function 'f2b' used but never defined