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

Richard Smith richard at metafoo.co.uk
Fri Apr 24 13:24:55 PDT 2015


================
Comment at: lib/Headers/mm_malloc.h:27-33
@@ -26,3 +26,9 @@
 
-#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
 
----------------
The intended layering is that Clang's `_Builtin_intrinsics` module is a layer on top of the C standard library module. Does that not work in your setup? (Does the module defining <stdlib.h> contain a header that includes these intrinsics headers?)

================
Comment at: lib/Headers/stdarg.h:29
@@ -28,1 +28,3 @@
 
+#include <_gnuc_va_list.h>
+
----------------
Can you say a bit more about why this split is useful to you? Do you want to include this part of <stdarg.h> and not the rest, and if so, why?

It looks to me like we have a more fundamental problem with our <stdarg.h>; like <stddef.h> it appears to be intended that glibc can request individual pieces of it with `__need_*` macros -- or at least, if `__need___va_list` is defined, we're supposed to vend a `__gnuc_va_list` typedef and nothing else.

So I think we should rearrange this header to properly handle `__need___va_list` in general, and the behavior you want here (to be able to produce `__gnuc_va_list` only) will naturally fall out from that.

http://reviews.llvm.org/D9229

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list