// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -Wno-error=implicit-int -verify -fblocks -Wno-unreachable-code -Wno-unused-value -Wno-strict-prototypes
// clang emits the following warning by default.
// With GCC, -pedantic, -Wreturn-type or -Wall are required to produce the
// following warning.
int
void
int ;
void
int // expected-warning {{non-void function does not return a value}}
int
int // expected-warning {{non-void function does not return a value}}
void
void ;
int
int
int
int j;
int
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value}}
int ;
int
int // expected-warning {{non-void function does not return a value in all control paths}}
int // expected-warning {{non-void function does not return a value in all control paths}}
int
int
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value in all control paths}}
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value in all control paths}}
int
int // expected-warning {{non-void function does not return a value}}
int // expected-warning {{non-void function does not return a value in all control paths}}
int
int
int // expected-warning {{non-void function does not return a value}}
int j;
;
int
// PR4624
void ;
void // expected-warning {{parameter 'x' was not declared, defaults to 'int'; ISO C99 and later do not support implicit int}}
void ;
int
// Include these declarations here explicitly so we don't depend on system headers.
typedef struct __jmp_buf_tag jmp_buf;
extern void ;
extern void ;
jmp_buf test30_j;
int
typedef void ;
void ;
void
void
// Test that 'static inline' functions are only analyzed for CFG-based warnings
// when they are used.
static inline int // expected-warning{{non-void function does not return a value}}
static inline int ; // expected-warning{{non-void function does not return a value}}
static inline int ;
static inline int // expected-warning{{non-void function does not return a value in all control paths}}
int
static inline int // expected-warning{{non-void function does not return a value}}
// Test warnings on ignored qualifiers on return types.
const int ; // expected-warning{{'const' type qualifier on return type has no effect}}
const volatile int ; // expected-warning{{'const volatile' type qualifiers on return type have no effect}}
char* const volatile restrict ; // expected-warning{{'const volatile restrict' type qualifiers on return type have no effect}}
typedef const int CI;
CI ;
const CI ; // expected-warning{{'const' type qualifier}}
// Test that for switch(enum) that if the switch statement covers all the cases
// that we don't consider that for -Wreturn-type.
;
int // no-warning
// PR12318 - Don't give a may reach end of non-void function warning.
int
// PR18999
int
int
int
// PR19074.
void ;
int
int // expected-warning {{non-void function does not return a value in all control paths}}
// sizeof(long) test.
int // no-warning
int // no-warning (used to be "non-void function does not return a value in all control paths")