[PATCH] [PATCH] clang internal library headers changes for C++ modules

John Thompson john.thompson.jtsoftware at gmail.com
Fri Apr 24 10:25:47 PDT 2015


Hi, we've decided to back out the changes to pmmintrin.h and xmmintrin.h and not create _denormals.h.

This leaves the changes to mm_malloc.h, stdarg.h and the new file _gnu_va_list.h.

Thanks.

-John


http://reviews.llvm.org/D9229

Files:
  lib/Headers/_gnuc_va_list.h
  lib/Headers/mm_malloc.h
  lib/Headers/stdarg.h

Index: lib/Headers/_gnuc_va_list.h
===================================================================
--- lib/Headers/_gnuc_va_list.h
+++ lib/Headers/_gnuc_va_list.h
@@ -0,0 +1,29 @@
+/*===---- _gnuc_va_list.h-------------------------------------------------===
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*
+*===-----------------------------------------------------------------------===
+*/
+
+#pragma once
+
+#ifndef _VA_LIST_DECLARED
+#define _VA_LIST_DECLARED
+typedef __builtin_va_list __gnuc_va_list;
+#endif
Index: lib/Headers/mm_malloc.h
===================================================================
--- lib/Headers/mm_malloc.h
+++ lib/Headers/mm_malloc.h
@@ -24,26 +24,32 @@
 #ifndef __MM_MALLOC_H
 #define __MM_MALLOC_H
 
-#include <stdlib.h>
+#ifdef __cplusplus
+extern "C" void free(void *);
+extern "C" void *malloc(__SIZE_TYPE__);
+#else
+void free(void *);
+void *malloc(__SIZE_TYPE__);
+#endif
 
 #ifdef _WIN32
 #include <malloc.h>
 #else
 #ifndef __cplusplus
-extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
+extern int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment, __SIZE_TYPE__ __size);
 #else
 // Some systems (e.g. those with GNU libc) declare posix_memalign with an
 // exception specifier. Via an "egregious workaround" in
 // Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
 // redeclaration of glibc's declaration.
-extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
+extern "C" int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment, __SIZE_TYPE__ __size);
 #endif
 #endif
 
 #if !(defined(_WIN32) && defined(_mm_malloc))
 static __inline__ void *__attribute__((__always_inline__, __nodebug__,
                                        __malloc__))
-_mm_malloc(size_t __size, size_t __align)
+_mm_malloc(__SIZE_TYPE__ __size, __SIZE_TYPE__ __align)
 {
   if (__align == 1) {
     return malloc(__size);
Index: lib/Headers/stdarg.h
===================================================================
--- lib/Headers/stdarg.h
+++ lib/Headers/stdarg.h
@@ -26,6 +26,8 @@
 #ifndef __STDARG_H
 #define __STDARG_H
 
+#include <_gnuc_va_list.h>
+
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -43,10 +45,4 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-/* Hack required to make standard headers work, at least on Ubuntu */
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-#endif
-typedef __builtin_va_list __gnuc_va_list;
-
 #endif /* __STDARG_H */

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9229.24397.patch
Type: text/x-patch
Size: 3653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150424/12c88a0c/attachment.bin>


More information about the cfe-commits mailing list