From 33e8b5189bbf02f3a18d933e9b79e7d134f2d76c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 29 Apr 2019 05:52:26 -0700 Subject: [PATCH] Omit musl's stdarg.h and stddef.h from the sysroot. We already use the compiler's versions of these; this just moves from having libc #include_next them to having libc just omit them entirely, which is simpler. This removes the special code to define musl's include guard, however I originally added that when I was still working out how WASI's stddef.h would interact with other code. I believe it's no longer important. --- Makefile | 5 +++++ expected/wasm32-wasi/include-all.c | 2 -- expected/wasm32-wasi/predefined-macros.txt | 1 - libc-top-half/musl/include/stdarg.h | 5 ----- libc-top-half/musl/include/stddef.h | 12 ------------ 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index e56447d..e0f25cb 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,11 @@ override MUSL_OMIT_HEADERS += \ "bits/alltypes.h.in" \ "alltypes.h.in" +# Use the compiler's version of these headers. +override MUSL_OMIT_HEADERS += \ + "stdarg.h" \ + "stddef.h" + # Use the WASI errno definitions. override MUSL_OMIT_HEADERS += \ "bits/errno.h" diff --git a/expected/wasm32-wasi/include-all.c b/expected/wasm32-wasi/include-all.c index 3ca0641..535c920 100644 --- a/expected/wasm32-wasi/include-all.c +++ b/expected/wasm32-wasi/include-all.c @@ -120,10 +120,8 @@ #include #include #include -#include #include #include -#include #include #include #include diff --git a/expected/wasm32-wasi/predefined-macros.txt b/expected/wasm32-wasi/predefined-macros.txt index 77b965a..87bdca0 100644 --- a/expected/wasm32-wasi/predefined-macros.txt +++ b/expected/wasm32-wasi/predefined-macros.txt @@ -2370,7 +2370,6 @@ #define _STDALIGN_H #define _STDBOOL_H #define _STDC_PREDEF_H -#define _STDDEF_H #define _STDINT_H #define _STDIO_EXT_H #define _STDIO_H diff --git a/libc-top-half/musl/include/stdarg.h b/libc-top-half/musl/include/stdarg.h index 0c69316..3256f80 100644 --- a/libc-top-half/musl/include/stdarg.h +++ b/libc-top-half/musl/include/stdarg.h @@ -1,4 +1,3 @@ -#ifdef __wasilibc_unmodified_upstream /* Use the compiler's stdarg.h */ #ifndef _STDARG_H #define _STDARG_H @@ -20,7 +19,3 @@ extern "C" { #endif #endif -#else -/* Just use the compiler's stdarg.h. */ -#include_next -#endif diff --git a/libc-top-half/musl/include/stddef.h b/libc-top-half/musl/include/stddef.h index 9cad1af..bd75385 100644 --- a/libc-top-half/musl/include/stddef.h +++ b/libc-top-half/musl/include/stddef.h @@ -1,4 +1,3 @@ -#ifdef __wasilibc_unmodified_upstream /* Use the compiler's stddef.h */ #ifndef _STDDEF_H #define _STDDEF_H @@ -24,14 +23,3 @@ #endif #endif -#else - -/* Just use the compiler's stddef.h. */ -#include_next - -/* Define musl's include guard, in case any code depends on that. */ -#if defined(__STDDEF_H) && !defined(_STDDEF_H) -#define _STDDEF_H -#endif - -#endif -- 2.39.5