[llvm] r256836 - Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 06:24:01 PST 2016


Author: aaronballman
Date: Tue Jan  5 08:24:01 2016
New Revision: 256836

URL: http://llvm.org/viewvc/llvm-project?rev=256836&view=rev
Log:
Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.

Patch by Alexander Riccio

Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=256836&r1=256835&r2=256836&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Tue Jan  5 08:24:01 2016
@@ -363,6 +363,17 @@ if( MSVC )
 
   append("/Zc:inline" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 
+  # Disable string literal const->non-const type conversion
+  # "When specified, the compiler requires strict const-qualification
+  # conformance for pointers initialized by using string literals."
+  append("/Zc:strictStrings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
+  # Generate Intrinsic Functions
+  append("/Oi" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
+  # Enforce type conversion rules
+  append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
+
   # Disable sized deallocation if the flag is supported. MSVC fails to compile
   # the operator new overload in User otherwise.
   check_c_compiler_flag("/WX /Zc:sizedDealloc-" SUPPORTS_SIZED_DEALLOC)




More information about the llvm-commits mailing list