ORCA-C/Tests/Conformance/c99inline.c
Stephen Heumann f31b5ea1e6 Allow "extern inline" functions.
A function declared "inline" with an explicit "extern" storage class has the same semantics as if "inline" was omitted. (It is not an inline definition as defined in the C standards.) The "inline" specifier suggests that the function should be inlined, but it is legal to just ignore it, as we already do for "static inline" functions.

Also add a test for the inline function specifier.
2022-10-29 19:43:57 -05:00

34 lines
618 B
C

/*
* Test inline function specifier (C99).
*
* This only tests "static inline" and "extern inline",
* which are the only forms currently supported by ORCA/C.
*/
#include <stdio.h>
static inline int f(void) {
return 1;
}
inline int extern g(void) {
return 2;
}
int main(void) {
int (*p)(void) = f;
int (*q)(void) = g;
if (f() + g() != 3)
goto Fail;
if (p() + q() != 3)
goto Fail;
printf ("Passed Conformance Test c99inline\n");
return 0;
Fail:
printf ("Failed Conformance Test c99inline\n");
}