r200344 - Intrin.h: include setjmp.h to get a jmp_buf definition

Reid Kleckner rnk at google.com
Tue Jul 8 11:29:03 PDT 2014


On Tue, Jul 8, 2014 at 11:08 AM, Nico Weber <thakis at chromium.org> wrote:

> Two zombie review comments below.
>
> On Tue, Jan 28, 2014 at 3:01 PM, Hans Wennborg <hans at hanshq.net> wrote:
>
>> Author: hans
>> Date: Tue Jan 28 17:01:59 2014
>> New Revision: 200344
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=200344&view=rev
>> Log:
>> Intrin.h: include setjmp.h to get a jmp_buf definition
>>
>> This makes sure that the ms-intrin.cpp test passes by providing
>> a mock setjmp.h as a test input.
>>
>> Added:
>>     cfe/trunk/test/Headers/Inputs/include/setjmp.h
>> Modified:
>>     cfe/trunk/lib/Headers/Intrin.h
>>     cfe/trunk/test/Headers/ms-intrin.cpp
>>
>> Modified: cfe/trunk/lib/Headers/Intrin.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=200344&r1=200343&r2=200344&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Headers/Intrin.h (original)
>> +++ cfe/trunk/lib/Headers/Intrin.h Tue Jan 28 17:01:59 2014
>> @@ -32,6 +32,9 @@
>>  /* First include the standard intrinsics. */
>>  #include <x86intrin.h>
>>
>> +/* For the definition of jmp_buf. */
>> +#include <setjmp.h>
>>
>
> Should this (and the functions below) be behind a #if __STDC_HOSTED__,
> like the stdlib.h include in xmmintrin.h? (My use case is that I sometimes
> use clang-cl with -Xclang -ffreestanding on a non-Windows machine, and that
> doesn't work because of this include. It's arguably a somewhat strange use
> case, given that -ffreestanding is a cc1 flag.)
>

Yeah, let's do that.  clang -cc1 -ffreestanding should be able to include
<intrin.h> without pulling in crt headers.


> +
>>  #ifdef __cplusplus
>>  extern "C" {
>>  #endif
>> @@ -279,10 +282,7 @@ unsigned __int64 __cdecl _rotr64(unsigne
>>  static __inline__
>>  unsigned char _rotr8(unsigned char _Value, unsigned char _Shift);
>>  int _sarx_i32(int, unsigned int);
>> -
>> -/* FIXME: Need definition for jmp_buf.
>> -   int __cdecl _setjmp(jmp_buf); */
>>
>
> There's another FIXME like this in the 64bit section below; should that go
> away too?
>

Sure.


>
>
>> -
>> +int __cdecl _setjmp(jmp_buf);
>>  unsigned int _shlx_u32(unsigned int, unsigned int);
>>  unsigned int _shrx_u32(unsigned int, unsigned int);
>>  void _Store_HLERelease(long volatile *, long);
>>
>> Added: cfe/trunk/test/Headers/Inputs/include/setjmp.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/Inputs/include/setjmp.h?rev=200344&view=auto
>>
>> ==============================================================================
>> --- cfe/trunk/test/Headers/Inputs/include/setjmp.h (added)
>> +++ cfe/trunk/test/Headers/Inputs/include/setjmp.h Tue Jan 28 17:01:59
>> 2014
>> @@ -0,0 +1,8 @@
>> +#ifndef SETJMP_H
>> +#define SETJMP_H
>> +
>> +typedef struct {
>> +  int x[42];
>> +} jmp_buf;
>> +
>> +#endif
>>
>> Modified: cfe/trunk/test/Headers/ms-intrin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/ms-intrin.cpp?rev=200344&r1=200343&r2=200344&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Headers/ms-intrin.cpp (original)
>> +++ cfe/trunk/test/Headers/ms-intrin.cpp Tue Jan 28 17:01:59 2014
>> @@ -1,6 +1,7 @@
>>  // RUN: %clang_cc1 -triple i386-pc-win32 -target-cpu pentium4 \
>>  // RUN:     -fms-extensions -fms-compatibility -fmsc-version=1700 \
>> -// RUN:     -ffreestanding -fsyntax-only -Werror %s
>> +// RUN:     -ffreestanding -fsyntax-only -Werror \
>> +// RUN:     -isystem %S/Inputs/include %s
>>
>>  // Intrin.h needs size_t, but -ffreestanding prevents us from getting it
>> from
>>  // stddef.h.  Work around it with this typedef.
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140708/fa5b3fc0/attachment.html>


More information about the cfe-commits mailing list