From a62cffae523b91937759ca8c01a52b60fef60cb8 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 8 Jul 2014 18:34:46 +0000 Subject: [PATCH] Don't pull in setjmp.h in -ffreestanding compiles. Also provide _setjmpex(). r200243 put in _setjmp() and _setjmpex() behind a comment since jmp_buf wasn't available. r200344 added jmp_buf and put in _setjmp(), but missed _setjmpex(). llvm-svn: 212557 --- clang/lib/Headers/Intrin.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clang/lib/Headers/Intrin.h b/clang/lib/Headers/Intrin.h index d8dc0a4..13e105e 100644 --- a/clang/lib/Headers/Intrin.h +++ b/clang/lib/Headers/Intrin.h @@ -35,7 +35,9 @@ #endif /* For the definition of jmp_buf. */ +#if __STDC_HOSTED__ #include +#endif #ifdef __cplusplus extern "C" { @@ -291,7 +293,9 @@ unsigned __int64 __cdecl _rotr64(unsigned __int64 _Value, int _Shift); static __inline__ unsigned char _rotr8(unsigned char _Value, unsigned char _Shift); int _sarx_i32(int, unsigned int); +#if __STDC_HOSTED__ int __cdecl _setjmp(jmp_buf); +#endif unsigned int _shlx_u32(unsigned int, unsigned int); unsigned int _shrx_u32(unsigned int, unsigned int); void _Store_HLERelease(long volatile *, long); @@ -449,8 +453,9 @@ unsigned int __cdecl _readgsbase_u32(void); unsigned __int64 __cdecl _readgsbase_u64(void); unsigned __int64 _rorx_u64(unsigned __int64, const unsigned int); __int64 _sarx_i64(__int64, unsigned int); -/* FIXME: Need definition for jmp_buf. - int __cdecl _setjmpex(jmp_buf); */ +#if __STDC_HOSTED__ +int __cdecl _setjmpex(jmp_buf); +#endif unsigned __int64 _shlx_u64(unsigned __int64, unsigned int); unsigned __int64 shrx_u64(unsigned __int64, unsigned int); unsigned __int64 _tzcnt_u64(unsigned __int64); -- 2.7.4