[llvm] r341364 - Fix some Wundef warnings in Compiler.h

Sven van Haastregt via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 05:46:21 PDT 2018


Author: svenvh
Date: Tue Sep  4 05:46:21 2018
New Revision: 341364

URL: http://llvm.org/viewvc/llvm-project?rev=341364&view=rev
Log:
Fix some Wundef warnings in Compiler.h

Check for definedness of the __cpp_sized_deallocation and
__cpp_aligned_new feature test macros.  These will not be defined
when the feature is not available, and that prevents any code that
includes this header from compiling with -Wundef -Werror.

Differential Revision: https://reviews.llvm.org/D51171

Modified:
    llvm/trunk/include/llvm/Support/Compiler.h

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=341364&r1=341363&r2=341364&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Tue Sep  4 05:46:21 2018
@@ -519,7 +519,7 @@ namespace llvm {
 /// reduced default alignment.
 inline void *allocate_buffer(size_t Size, size_t Alignment) {
   return ::operator new(Size
-#if __cpp_aligned_new
+#ifdef __cpp_aligned_new
                         ,
                         std::align_val_t(Alignment)
 #endif
@@ -535,11 +535,11 @@ inline void *allocate_buffer(size_t Size
 /// most likely using the above helper.
 inline void deallocate_buffer(void *Ptr, size_t Size, size_t Alignment) {
   ::operator delete(Ptr
-#if __cpp_sized_deallocation
+#ifdef __cpp_sized_deallocation
                     ,
                     Size
 #endif
-#if __cpp_aligned_new
+#ifdef __cpp_aligned_new
                     ,
                     std::align_val_t(Alignment)
 #endif




More information about the llvm-commits mailing list