[PATCH] D21553: Do not require __STDC_LIMIT_MACROS and others

Paweł Bylica via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 05:08:50 PDT 2016


chfast created this revision.
chfast added a subscriber: llvm-commits.

Do not require __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS macros to be defined globally. They are not needed for C++11 compliant standard headers.

http://reviews.llvm.org/D21553

Files:
  cmake/modules/HandleLLVMOptions.cmake
  include/llvm/Support/DataTypes.h.cmake
  utils/vim/vimrc

Index: utils/vim/vimrc
===================================================================
--- utils/vim/vimrc
+++ utils/vim/vimrc
@@ -108,7 +108,6 @@
 " include paths, predefined macros, and language options.
 let g:clang_opts = [
   \ "-x","c++",
-  \ "-D__STDC_LIMIT_MACROS=1","-D__STDC_CONSTANT_MACROS=1",
   \ "-Iinclude" ]
 
 function! ClangComplete(findstart, base)
Index: include/llvm/Support/DataTypes.h.cmake
===================================================================
--- include/llvm/Support/DataTypes.h.cmake
+++ include/llvm/Support/DataTypes.h.cmake
@@ -55,17 +55,14 @@
 
 #ifndef _MSC_VER
 
-/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
-   being defined.  We would define it here, but in order to prevent Bad Things
-   happening when system headers or C++ STL headers include stdint.h before we
-   define it here, we define it on the g++ command line (in Makefile.rules). */
-#if !defined(__STDC_LIMIT_MACROS)
-# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
+#if !defined(UINT32_MAX)
+# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
+        "__STDC_LIMIT_MACROS before #including Support/DataTypes.h"
 #endif
 
-#if !defined(__STDC_CONSTANT_MACROS)
-# error "Must #define __STDC_CONSTANT_MACROS before " \
-        "#including Support/DataTypes.h"
+#if !defined(UINT32_C)
+# error "The standard header <cstdint> is not C++11 compliant. Must #define "\
+        "__STDC_CONSTANT_MACROS before #including Support/DataTypes.h"
 #endif
 
 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -552,10 +552,6 @@
   add_definitions("-gsplit-dwarf")
 endif()
 
-add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
-add_llvm_definitions( -D__STDC_FORMAT_MACROS )
-add_llvm_definitions( -D__STDC_LIMIT_MACROS )
-
 # clang doesn't print colored diagnostics when invoked from Ninja
 if (UNIX AND
     CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21553.61357.patch
Type: text/x-patch
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160621/8686849d/attachment.bin>


More information about the llvm-commits mailing list