[PATCH] D51171: Fix some Wundef warnings in Compiler.h

Sven van Haastregt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 09:21:57 PDT 2018


svenvh created this revision.
svenvh added a reviewer: chandlerc.
Herald added a subscriber: llvm-commits.

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`.


Repository:
  rL LLVM

https://reviews.llvm.org/D51171

Files:
  include/llvm/Support/Compiler.h


Index: include/llvm/Support/Compiler.h
===================================================================
--- include/llvm/Support/Compiler.h
+++ include/llvm/Support/Compiler.h
@@ -519,7 +519,7 @@
 /// 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 @@
 /// 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51171.162199.patch
Type: text/x-patch
Size: 873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180823/d499343a/attachment.bin>


More information about the llvm-commits mailing list