// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=c,expected -DNO_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=c,expected -DWRONG_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=c,expected -DRIGHT_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=c,expected -DONLY_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=c,expected -DNO_SETJMP %s -ast-dump 2>&1 | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=cxx,expected -x c++ -DNO_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=cxx,expected -x c++ -DWRONG_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=cxx,expected -x c++ -DRIGHT_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK1,CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=cxx,expected -x c++ -DONLY_JMP_BUF %s -ast-dump | FileCheck %s --check-prefixes=CHECK2
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify=cxx,expected -x c++ -DNO_SETJMP %s -ast-dump | FileCheck %s --check-prefixes=CHECK2
extern "C" NO_JMP_BUF
// This happens in some versions of glibc: the declaration of __sigsetjmp
// precedes the declaration of sigjmp_buf.
extern long ; // Can't check, so we trust that this is the right type
// FIXME: We could still diagnose the missing `jmp_buf` at the point of the call.
// c-no-diagnostics
typedef long jmp_buf;
// FIXME: Consider producing a similar warning in C++.
extern int ; // c-warning {{incompatible redeclaration of library function 'setjmp'}}
// c-note@-1 {{'setjmp' is a builtin with type 'int (jmp_buf)' (aka 'int (long)')}}
typedef long jmp_buf;
extern int ; // OK, right type.
typedef int *jmp_buf;
void
// CHECK1: FunctionDecl {{.*}} used setjmp
// CHECK1: BuiltinAttr {{.*}} Implicit
// CHECK1: ReturnsTwiceAttr {{.*}} Implicit
// mingw declares _setjmp with an unusual signature.
int ;
// c-warning@-2 {{incompatible redeclaration of library function '_setjmp'}}
// c-note@-3 {{'_setjmp' is a builtin with type 'int (jmp_buf)'}}
void
// CHECK2: FunctionDecl {{.*}} used _setjmp
// CHECK2: BuiltinAttr {{.*}} Implicit
// CHECK2: ReturnsTwiceAttr {{.*}} Implicit
}