Added primitive support for the ISO C99 inline feature as well as the __inline__ extension.
No inlining is actually done but that part is not required by the standard.
This commit is contained in:
@@ -63,6 +63,7 @@ CUSTOMSOURCES = \
|
||||
# exact error output is required
|
||||
ERRORSOURCES = \
|
||||
custom-reference-error.c \
|
||||
inline-error.c \
|
||||
bug1889-missing-identifier.c \
|
||||
bug2312-preprocessor-error.c
|
||||
|
||||
|
||||
@@ -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:4: Error: Declaration specifier or identifier expected
|
||||
bug1889-missing-identifier.c:4: Error: 'inline' on empty declaration
|
||||
bug1889-missing-identifier.c:6: Error: Expression expected
|
||||
|
||||
36
test/ref/inline-error.c
Normal file
36
test/ref/inline-error.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* C99 inline in declarations */
|
||||
|
||||
inline typedef int; /* Error */
|
||||
static inline int; /* Error */
|
||||
inline static int a1; /* Error */
|
||||
int inline (*fp1)(void); /* Error */
|
||||
typedef inline int f1_t(void); /* Error */
|
||||
inline int f1a(void); /* OK here warning later */
|
||||
inline extern int f1b(void); /* OK here warning later */
|
||||
extern inline int f1b(void); /* Same as above */
|
||||
inline static int f1c(void); /* OK here warning later */
|
||||
static inline int f1c(void); /* Same as above */
|
||||
|
||||
void foo(inline int x); /* Error */
|
||||
int a = sizeof (inline int); /* TODO: better error message */
|
||||
int b = sizeof (inline int (int)); /* TODO: better error message */
|
||||
|
||||
inline int main(void) /* Error */
|
||||
{
|
||||
inline typedef int; /* Error */
|
||||
static inline int; /* Error */
|
||||
extern inline int a2; /* Error */
|
||||
int inline (*fp2)(void); /* Error */
|
||||
typedef inline int f2_t(void); /* Error */
|
||||
inline int f2a(void); /* OK here warning later */
|
||||
inline extern int f2b(void); /* OK here warning later */
|
||||
extern inline int f2b(void); /* Same as above */
|
||||
|
||||
f1a(); /* Still imported */
|
||||
f1b(); /* Still imported */
|
||||
f1c(); /* Not imported */
|
||||
f2a(); /* Still imported */
|
||||
f2b(); /* Still imported */
|
||||
}
|
||||
|
||||
/* Warning: non-external inline functions declared but undefined in TU */
|
||||
20
test/ref/inline-error.cref
Normal file
20
test/ref/inline-error.cref
Normal file
@@ -0,0 +1,20 @@
|
||||
inline-error.c:3: Error: 'inline' on empty declaration
|
||||
inline-error.c:4: Error: 'inline' on empty declaration
|
||||
inline-error.c:5: Error: 'inline' on non-function declaration
|
||||
inline-error.c:6: Error: 'inline' on non-function declaration
|
||||
inline-error.c:7: Error: 'inline' on non-function declaration
|
||||
inline-error.c:14: Error: Unexpected function specifiers
|
||||
inline-error.c:15: Error: Mixed declarations and code are not supported in cc65
|
||||
inline-error.c:16: Error: Mixed declarations and code are not supported in cc65
|
||||
inline-error.c:19: Error: 'main' cannot be declared inline
|
||||
inline-error.c:20: Error: 'inline' on empty declaration
|
||||
inline-error.c:21: Error: 'inline' on empty declaration
|
||||
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
|
||||
Reference in New Issue
Block a user