[llvm] r204704 - Disable Visual C++ warning 4722 about aborting a destructor,

Yaron Keren yaron.keren at gmail.com
Tue Mar 25 01:42:53 PDT 2014


Author: yrnkrn
Date: Tue Mar 25 03:42:49 2014
New Revision: 204704

URL: http://llvm.org/viewvc/llvm-project?rev=204704&view=rev
Log:
Disable Visual C++ warning 4722 about aborting a destructor,
it has no value for us.


Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
    llvm/trunk/lib/IR/User.cpp
    llvm/trunk/lib/Support/Process.cpp

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=204704&r1=204703&r2=204704&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Tue Mar 25 03:42:49 2014
@@ -256,13 +256,14 @@ if( MSVC )
     -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored'
     -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data'
     -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data'
+    -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
     -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized'
     -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized'
     -wd4355 # Suppress ''this' : used in base member initializer list'
     -wd4503 # Suppress ''identifier' : decorated name length exceeded, name was truncated'
     -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible'
+    -wd4722 # Suppress 'function' : destructor never returns, potential memory leak
     -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)'
-    -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception'
     
     # Promoted warnings.
     -w14062 # Promote 'enumerator in switch of enum is not handled' to level 1 warning.

Modified: llvm/trunk/lib/IR/User.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/User.cpp?rev=204704&r1=204703&r2=204704&view=diff
==============================================================================
--- llvm/trunk/lib/IR/User.cpp (original)
+++ llvm/trunk/lib/IR/User.cpp Tue Mar 25 03:42:49 2014
@@ -83,28 +83,8 @@ void User::operator delete(void *Usr) {
 //                             Operator Class
 //===----------------------------------------------------------------------===//
 
-#if defined(_MSC_VER)
-// In Release modes, Visual Studio complains that the Operator destructor
-// never returns, which is true by design. 
-// This does *not* depend on llvm_unreachable being dependent on NDEBUG:
-// even if llvm_unreachable is replaced by __assume(false), VC still warns in
-// Release modes but not in Debug modes. The real reason is optimization flags.
-// With /Od in Debug modes the warning is not issued whereas with /O1 it is.
-// I could not find any documentation to this effect, it is reproducable:
-// Try compiling http://msdn.microsoft.com/en-us/library/khwfyc5d(v=vs.90).aspx
-// with /O1 and then with /Od.
-// Anyhow, solution is same as lib/Support/Process.cpp:~self_process().
-
-#pragma warning(push)
-#pragma warning(disable:4722)
-#endif
-
 Operator::~Operator() {
   llvm_unreachable("should never destroy an Operator");
 }
 
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
-
 } // End llvm namespace

Modified: llvm/trunk/lib/Support/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Process.cpp?rev=204704&r1=204703&r2=204704&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Process.cpp (original)
+++ llvm/trunk/lib/Support/Process.cpp Tue Mar 25 03:42:49 2014
@@ -34,14 +34,6 @@ self_process *process::get_self() {
   return SP;
 }
 
-#if defined(_MSC_VER)
-// Visual Studio complains that the self_process destructor never exits. This
-// doesn't make much sense, as that's the whole point of calling abort... Just
-// silence this warning.
-#pragma warning(push)
-#pragma warning(disable:4722)
-#endif
-
 // The destructor for the self_process subclass must never actually be
 // executed. There should be at most one instance of this class, and that
 // instance should live until the process terminates to avoid the potential for
@@ -75,11 +67,6 @@ TimeValue self_process::get_wall_time()
 }
 
 
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
-
-
 #define COLOR(FGBG, CODE, BOLD) "\033[0;" BOLD FGBG CODE "m"
 
 #define ALLCOLORS(FGBG,BOLD) {\





More information about the llvm-commits mailing list