| 1 |
// RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 3 |
|
| 4 |
#if __STDC_VERSION__ >= 199901 |
| 5 |
#define GNU_INLINE __attribute((__gnu_inline__)) |
| 6 |
#else |
| 7 |
#define GNU_INLINE |
| 8 |
#endif |
| 9 |
|
| 10 |
// PR5253 |
| 11 |
// (same extension in C99 mode) |
| 12 |
// GNU Extension: check that we can redefine an extern inline function |
| 13 |
GNU_INLINE extern inline int f(int a) {return a;} |
| 14 |
int f(int b) {return b;} // expected-note{{previous definition is here}} |
| 15 |
// And now check that we can't redefine a normal function |
| 16 |
int f(int c) {return c;} // expected-error{{redefinition of 'f'}} |
| 17 |
|
| 18 |
// Check that we can redefine an extern inline function as a static function |
| 19 |
GNU_INLINE extern inline int g(int a) {return a;} |
| 20 |
static int g(int b) {return b;} |
| 21 |
|
| 22 |
// Check that we ensure the types of the two definitions are the same |
| 23 |
GNU_INLINE extern inline int h(int a) {return a;} // expected-note{{previous definition is here}} |
| 24 |
int h(short b) {return b;} // expected-error{{conflicting types for 'h'}} |