]> granicus.if.org Git - clang/commitdiff
Don't claim that va_start has special semantic checks
authorReid Kleckner <rnk@google.com>
Fri, 2 Mar 2018 21:41:08 +0000 (21:41 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 2 Mar 2018 21:41:08 +0000 (21:41 +0000)
We don't have special checks for BI_va_start in
Sema::CheckBuiltinFunctionCall, so setting the 't' flag for va_start in
Builtins.def disables semantic checking for it. That's not desired, and
IRGen crashes when it tries to generate a call to va_start that doesn't
have at least one argument.

Follow-up to r322573

Fixes PR36565

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326622 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Builtins.def
test/Sema/varargs.c

index 716f014fc3dff4a9085475b29c8df86fec6e04c5..9b7e09a75bd0cb0fa304d3c1daf63cb20ad662ec 100644 (file)
@@ -803,7 +803,7 @@ LIBBUILTIN(_setjmpex, "iJ", "fj",   "setjmpex.h", ALL_MS_LANGUAGES)
 
 // C99 library functions
 // C99 stdarg.h
-LIBBUILTIN(va_start, "vA.",       "fnt",   "stdarg.h", ALL_LANGUAGES)
+LIBBUILTIN(va_start, "vA.",       "fn",    "stdarg.h", ALL_LANGUAGES)
 LIBBUILTIN(va_end, "vA",          "fn",    "stdarg.h", ALL_LANGUAGES)
 LIBBUILTIN(va_copy, "vAA",        "fn",    "stdarg.h", ALL_LANGUAGES)
 // C99 stdlib.h
index 0ade0cf0aaf9a35e67477bbd9d0b1c314fc78d43..3fa429163ff5b282d73ea03da635f1e38986c1c0 100644 (file)
@@ -112,3 +112,12 @@ void f13(enum E1 e, ...) {
 #endif
   __builtin_va_end(va);
 }
+
+void f14(int e, ...) {
+  // expected-warning@+3 {{implicitly declaring library function 'va_start'}}
+  // expected-note@+2 {{include the header <stdarg.h>}}
+  // expected-error@+1 {{too few arguments to function call}}
+  va_start();
+  __builtin_va_list va;
+  va_start(va, e);
+}