[llvm-commits] [llvm] r113834 - in /llvm/trunk: lib/Target/CBackend/CBackend.cpp utils/TableGen/IntrinsicEmitter.cpp

Michael Spencer bigcheesegs at gmail.com
Wed Sep 15 19:03:28 PDT 2010


On Tue, Sep 14, 2010 at 7:59 PM, Francois Pichet <pichet2000 at gmail.com> wrote:
> hi,
>
> Can't you not rewrite EmitSuffix like this to get rid of the warning?
>
> void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) {
>  OS << "#if defined(_MSC_VER) && defined(setjmp)\n"
>        "// let's return it to _setjmp state\n"
>        "#  pragma pop_macro(\"setjmp\")\n"
>        "#endif\n\n";
> }

No, because EmitPrefix has #undef setjmp. What I actually need to do
is add back setjmp_undefined_for_visual_studio, but this time undefine
it in the suffix. Without this, the next time this is encountered
(which is included 2x in CBackend), setjmp will be popped more than it
should.

The push/pop macro is still required because setjmp isn't just defined
as _setjmp, it can be other things.

- Michael Spencer

>
>
> On Tue, Sep 14, 2010 at 12:27 AM, Michael J. Spencer
> <bigcheesegs at gmail.com> wrote:
>> Author: mspencer
>> Date: Mon Sep 13 23:27:38 2010
>> New Revision: 113834
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=113834&view=rev
>> Log:
>> CBackend: Fix MSVC build.
>>
>> This may produce warnings on MSVS, but it's better than failures.
>>
>> Modified:
>>    llvm/trunk/lib/Target/CBackend/CBackend.cpp
>>    llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
>>
>> Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=113834&r1=113833&r2=113834&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
>> +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Mon Sep 13 23:27:38 2010
>> @@ -50,6 +50,10 @@
>>  #include "llvm/System/Host.h"
>>  #include "llvm/Config/config.h"
>>  #include <algorithm>
>> +// Some ms header decided to define setjmp as _setjmp, undo this for this file.
>> +#ifdef _MSC_VER
>> +#undef setjmp
>> +#endif
>>  using namespace llvm;
>>
>>  extern "C" void LLVMInitializeCBackendTarget() {
>>
>> Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=113834&r1=113833&r2=113834&view=diff
>> ==============================================================================
>> --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
>> +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Mon Sep 13 23:27:38 2010
>> @@ -69,15 +69,15 @@
>>  void IntrinsicEmitter::EmitPrefix(raw_ostream &OS) {
>>   OS << "// VisualStudio defines setjmp as _setjmp\n"
>>         "#if defined(_MSC_VER) && defined(setjmp)\n"
>> -        "#define setjmp_undefined_for_visual_studio\n"
>> -        "#undef setjmp\n"
>> +        "#  pragma push_macro(\"setjmp\")\n"
>> +        "#  undef setjmp\n"
>>         "#endif\n\n";
>>  }
>>
>>  void IntrinsicEmitter::EmitSuffix(raw_ostream &OS) {
>> -  OS << "#if defined(_MSC_VER) && defined(setjmp_undefined_for_visual_studio)\n"
>> +  OS << "#if defined(_MSC_VER)\n"
>>         "// let's return it to _setjmp state\n"
>> -        "#define setjmp _setjmp\n"
>> +        "#  pragma pop_macro(\"setjmp\")\n"
>>         "#endif\n\n";
>>  }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>




More information about the llvm-commits mailing list