From 4a3c6c6daebce44416a63bb19ad1ab7fe0d16354 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 4 Apr 2013 02:55:24 +0000 Subject: [PATCH] Add tests that build modules for our builtin headers, and fix two buglets exposed by doing so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178736 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/cpuid.h | 6 +++--- lib/Headers/module.map | 1 + test/Headers/c11.c | 1 + test/Headers/c89.c | 1 + test/Headers/cxx11.cpp | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Headers/cpuid.h b/lib/Headers/cpuid.h index 6d7d61d508..7b012384a2 100644 --- a/lib/Headers/cpuid.h +++ b/lib/Headers/cpuid.h @@ -25,9 +25,9 @@ #error this header is for x86 only #endif -static inline int __get_cpuid (unsigned int __level, unsigned int *__eax, - unsigned int *__ebx, unsigned int *__ecx, - unsigned int *__edx) { +static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax, + unsigned int *__ebx, unsigned int *__ecx, + unsigned int *__edx) { __asm("cpuid" : "=a"(*__eax), "=b" (*__ebx), "=c"(*__ecx), "=d"(*__edx) : "0"(__level)); return 1; diff --git a/lib/Headers/module.map b/lib/Headers/module.map index 1b476a5e55..aa219cb407 100644 --- a/lib/Headers/module.map +++ b/lib/Headers/module.map @@ -17,6 +17,7 @@ module _Builtin_intrinsics [system] { } explicit module cpuid { + requires x86 header "cpuid.h" } diff --git a/test/Headers/c11.c b/test/Headers/c11.c index 24a1c2a60d..f65164d15c 100644 --- a/test/Headers/c11.c +++ b/test/Headers/c11.c @@ -1,4 +1,5 @@ // RUN: %clang -fsyntax-only -Xclang -verify -std=c11 %s +// RUN: %clang -fsyntax-only -Xclang -verify -std=c11 -fmodules %s noreturn int f(); // expected-error 1+{{}} diff --git a/test/Headers/c89.c b/test/Headers/c89.c index acf01b40e0..95f692b8f0 100644 --- a/test/Headers/c89.c +++ b/test/Headers/c89.c @@ -1,4 +1,5 @@ // RUN: %clang -target i386-apple-darwin10 -fsyntax-only -Xclang -verify -std=c89 %s +// RUN: %clang -target i386-apple-darwin10 -fsyntax-only -Xclang -verify -std=c89 -fmodules %s // expected-no-diagnostics // FIXME: Disable inclusion of mm_malloc.h, our current implementation is broken diff --git a/test/Headers/cxx11.cpp b/test/Headers/cxx11.cpp index 995fc6528d..41bdc76fda 100644 --- a/test/Headers/cxx11.cpp +++ b/test/Headers/cxx11.cpp @@ -1,4 +1,5 @@ // RUN: %clang -fsyntax-only -std=c++11 %s +// RUN: %clang -fsyntax-only -std=c++11 -fmodules %s #include -- 2.40.0