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// rdar://9559708 (same extension in C99 mode)
12// GNU Extension: check that we can redefine an extern inline function
13GNU_INLINE extern inline int f(int a) {return a;}
14int f(int b) {return b;} // expected-note{{previous definition is here}}
15// And now check that we can't redefine a normal function
16int 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
19GNU_INLINE extern inline int g(int a) {return a;}
20static int g(int b) {return b;}
21
22// Check that we ensure the types of the two definitions are the same
23GNU_INLINE extern inline int h(int a) {return a;} // expected-note{{previous definition is here}}
24int h(short b) {return b;}  // expected-error{{conflicting types for 'h'}}
25