mikerice updated this revision to Diff 198559. mikerice added a comment. Added comments as requested.
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61646/new/ https://reviews.llvm.org/D61646 Files: lib/Headers/stdarg.h lib/Headers/stddef.h test/Headers/Inputs/ms-crt/corecrt.h test/Headers/Inputs/ms-crt/vcruntime.h test/Headers/c11.c test/Headers/ms-additional-includes.cpp test/Headers/ms-null-ms-header-vs-stddef.cpp Index: lib/Headers/stdarg.h =================================================================== --- lib/Headers/stdarg.h +++ lib/Headers/stdarg.h @@ -10,6 +10,11 @@ #ifndef __STDARG_H #define __STDARG_H +#if defined(_MSC_VER) +/* Include otherwise unneeded header for MSVC compatibility. */ +#include <vcruntime.h> +#endif + #ifndef _VA_LIST typedef __builtin_va_list va_list; #define _VA_LIST Index: lib/Headers/stddef.h =================================================================== --- lib/Headers/stddef.h +++ lib/Headers/stddef.h @@ -18,6 +18,12 @@ #if !__has_feature(modules) #define __STDDEF_H #endif + +#if defined(_MSC_VER) +/* Include otherwise unneeded header for MSVC compatibility. */ +#include <corecrt.h> +#endif + #define __need_ptrdiff_t #define __need_size_t #define __need_wchar_t Index: test/Headers/ms-null-ms-header-vs-stddef.cpp =================================================================== --- test/Headers/ms-null-ms-header-vs-stddef.cpp +++ test/Headers/ms-null-ms-header-vs-stddef.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -fms-compatibility -fms-compatibility-version=17.00 %s +// RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -fms-compatibility \ +// RUN: -isystem %S/Inputs/ms-crt -fms-compatibility-version=17.00 %s // RUN: %clang_cc1 -fsyntax-only -triple i386-mingw32 %s // Something in MSVC's headers (pulled in e.g. by <crtdefs.h>) defines __null Index: test/Headers/c11.c =================================================================== --- test/Headers/c11.c +++ test/Headers/c11.c @@ -2,7 +2,8 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s -D__STDC_WANT_LIB_EXT1__=1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 -fms-compatibility-version=17.00 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 \ +// RUN: -fms-compatibility-version=17.00 -isystem %S/Inputs/ms-crt %s noreturn int f(); // expected-error 1+{{}} Index: test/Headers/Inputs/ms-crt/corecrt.h =================================================================== --- test/Headers/Inputs/ms-crt/corecrt.h +++ test/Headers/Inputs/ms-crt/corecrt.h @@ -0,0 +1 @@ +#pragma once Index: test/Headers/Inputs/ms-crt/vcruntime.h =================================================================== --- test/Headers/Inputs/ms-crt/vcruntime.h +++ test/Headers/Inputs/ms-crt/vcruntime.h @@ -0,0 +1 @@ +#pragma once Index: test/Headers/ms-additional-includes.cpp =================================================================== --- test/Headers/ms-additional-includes.cpp +++ test/Headers/ms-additional-includes.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only --show-includes -triple i686-pc-win32 \ +// RUN: -isystem %S/Inputs/ms-crt -fms-compatibility-version=17.00 %s \ +// RUN: | FileCheck %s + +#include <stddef.h> +// CHECK: including file:{{.*}}stddef.h +// CHECK: including file:{{.*}}corecrt.h +#include <stdarg.h> +// CHECK: including file:{{.*}}stdarg.h +// CHECK: including file:{{.*}}vcruntime.h
Index: lib/Headers/stdarg.h =================================================================== --- lib/Headers/stdarg.h +++ lib/Headers/stdarg.h @@ -10,6 +10,11 @@ #ifndef __STDARG_H #define __STDARG_H +#if defined(_MSC_VER) +/* Include otherwise unneeded header for MSVC compatibility. */ +#include <vcruntime.h> +#endif + #ifndef _VA_LIST typedef __builtin_va_list va_list; #define _VA_LIST Index: lib/Headers/stddef.h =================================================================== --- lib/Headers/stddef.h +++ lib/Headers/stddef.h @@ -18,6 +18,12 @@ #if !__has_feature(modules) #define __STDDEF_H #endif + +#if defined(_MSC_VER) +/* Include otherwise unneeded header for MSVC compatibility. */ +#include <corecrt.h> +#endif + #define __need_ptrdiff_t #define __need_size_t #define __need_wchar_t Index: test/Headers/ms-null-ms-header-vs-stddef.cpp =================================================================== --- test/Headers/ms-null-ms-header-vs-stddef.cpp +++ test/Headers/ms-null-ms-header-vs-stddef.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -fms-compatibility -fms-compatibility-version=17.00 %s +// RUN: %clang_cc1 -fsyntax-only -triple i686-pc-win32 -fms-compatibility \ +// RUN: -isystem %S/Inputs/ms-crt -fms-compatibility-version=17.00 %s // RUN: %clang_cc1 -fsyntax-only -triple i386-mingw32 %s // Something in MSVC's headers (pulled in e.g. by <crtdefs.h>) defines __null Index: test/Headers/c11.c =================================================================== --- test/Headers/c11.c +++ test/Headers/c11.c @@ -2,7 +2,8 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 %s // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -fmodules -fmodules-cache-path=%t %s -D__STDC_WANT_LIB_EXT1__=1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s -// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 -fms-compatibility-version=17.00 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -triple i686-pc-win32 \ +// RUN: -fms-compatibility-version=17.00 -isystem %S/Inputs/ms-crt %s noreturn int f(); // expected-error 1+{{}} Index: test/Headers/Inputs/ms-crt/corecrt.h =================================================================== --- test/Headers/Inputs/ms-crt/corecrt.h +++ test/Headers/Inputs/ms-crt/corecrt.h @@ -0,0 +1 @@ +#pragma once Index: test/Headers/Inputs/ms-crt/vcruntime.h =================================================================== --- test/Headers/Inputs/ms-crt/vcruntime.h +++ test/Headers/Inputs/ms-crt/vcruntime.h @@ -0,0 +1 @@ +#pragma once Index: test/Headers/ms-additional-includes.cpp =================================================================== --- test/Headers/ms-additional-includes.cpp +++ test/Headers/ms-additional-includes.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only --show-includes -triple i686-pc-win32 \ +// RUN: -isystem %S/Inputs/ms-crt -fms-compatibility-version=17.00 %s \ +// RUN: | FileCheck %s + +#include <stddef.h> +// CHECK: including file:{{.*}}stddef.h +// CHECK: including file:{{.*}}corecrt.h +#include <stdarg.h> +// CHECK: including file:{{.*}}stdarg.h +// CHECK: including file:{{.*}}vcruntime.h
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits