[PATCH] D18325: export additional header modules from xmmintrin

John Thompson via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 12:53:48 PDT 2016


jtsoftware created this revision.
jtsoftware added reviewers: silvas, probinson.
jtsoftware added a subscriber: cfe-commits.

If someone only includes xmmintrin.h, but references any definitions from stdlib.h (included via mm_malloc.h), if module are enabled it will fail, but if modules are not enable, it will not fail to compile.  This will fix this (if __STDC_HOSTED__ is defined).


http://reviews.llvm.org/D18325

Files:
  lib/Headers/module.modulemap
  test/Headers/xmmintrin.c

Index: test/Headers/xmmintrin.c
===================================================================
--- test/Headers/xmmintrin.c
+++ test/Headers/xmmintrin.c
@@ -23,3 +23,7 @@
   return _mm_add_sd(__a, __b);
 }
 
+#if __STDC_HOSTED__
+// Make sure stdlib.h symbols are accessible.
+void *p = NULL;
+#endif
Index: lib/Headers/module.modulemap
===================================================================
--- lib/Headers/module.modulemap
+++ lib/Headers/module.modulemap
@@ -44,14 +44,17 @@
     }
 
     explicit module sse {
-      export mmx
-      export sse2 // note: for hackish <emmintrin.h> dependency
       header "xmmintrin.h"
+      export mm_malloc
+      export mmx
+      export sse2
     }
 
     explicit module sse2 {
-      export sse
       header "emmintrin.h"
+      export mm_malloc
+      export mmx
+      export sse
     }
 
     explicit module sse3 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18325.51210.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160321/ba49c572/attachment.bin>


More information about the cfe-commits mailing list