mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-12 03:04:45 +00:00
f31b5ea1e6
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.
34 lines
618 B
C
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");
|
|
}
|