Index: clang-tools-extra/clangd/IncludeFixer.cpp =================================================================== --- clang-tools-extra/clangd/IncludeFixer.cpp +++ clang-tools-extra/clangd/IncludeFixer.cpp @@ -197,7 +197,8 @@ case diag::err_no_member_template: case diag::err_no_member_template_suggest: case diag::warn_implicit_function_decl: - case diag::ext_implicit_function_decl: + case diag::ext_implicit_function_decl_c99: + case diag::ext_implicit_function_decl_c11: case diag::err_opencl_implicit_function_decl: dlog("Unresolved name at {0}, last typo was {1}", Info.getLocation().printToString(Info.getSourceManager()), Index: clang-tools-extra/clangd/ParsedAST.cpp =================================================================== --- clang-tools-extra/clangd/ParsedAST.cpp +++ clang-tools-extra/clangd/ParsedAST.cpp @@ -428,7 +428,8 @@ // this is an error. (The actual typo correction is nice too). // We restore the original severity in the level adjuster. // FIXME: It would be better to have a real API for this, but what? - for (auto ID : {diag::ext_implicit_function_decl, + for (auto ID : {diag::ext_implicit_function_decl_c99, + diag::ext_implicit_function_decl_c11, diag::warn_implicit_function_decl}) { OverriddenSeverity.try_emplace( ID, Clang->getDiagnostics().getDiagnosticLevel(ID, SourceLocation())); Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp +++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp @@ -1369,6 +1369,7 @@ Annotations Test("void x() { [[foo]](); }"); auto TU = TestTU::withCode(Test.code()); TU.Filename = "test.c"; + TU.ExtraArgs.push_back("-std=c99"); Symbol Sym = func("foo"); Sym.Flags |= Symbol::IndexedForCodeCompletion; Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -148,6 +148,12 @@ without a prototype and with no arguments is an invalid redeclaration of a function with a prototype. e.g., ``void f(int); void f() {}`` is now properly diagnosed. +- The ``-Wimplicit-function-declaration`` warning diagnostic now defaults to + an error in C11 and C17 language modes. Prior to C2x, it may be downgraded to + a warning with ``-Wno-error=implicit-function-declaration``, or disabled + entirely with ``-Wno-implicit-function-declaration``. As of C2x, support for + implicit function declarations has been removed, and the warning options will + have no effect. Non-comprehensive list of changes in this release ------------------------------------------------- @@ -218,6 +224,9 @@ - Implemented `WG14 N2775 Literal suffixes for bit-precise integers `_. - Implemented the `*_WIDTH` macros to complete support for `WG14 N2412 Two's complement sign representation for C2x `_. +- Removed support for implicit function declarations. This was a C89 feature + that was removed in C99, but cannot be supported in C2x because it requires + support for functions without prototypes, which no longer exist in C2x. C++ Language Changes in Clang ----------------------------- Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -417,9 +417,12 @@ def warn_implicit_function_decl : Warning< "implicit declaration of function %0">, InGroup, DefaultIgnore; -def ext_implicit_function_decl : ExtWarn< - "implicit declaration of function %0 is invalid in C99">, - InGroup; +def ext_implicit_function_decl_c99 : ExtWarn< + "implicit declaration of function %0 is invalid in C99 and later and " + "unsupported in C2x">, InGroup; +def ext_implicit_function_decl_c11 : ExtWarn< + ext_implicit_function_decl_c99.Text>, + InGroup, DefaultError; def note_function_suggestion : Note<"did you mean %0?">; def err_ellipsis_first_param : Error< Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -931,9 +931,12 @@ // // appeared. // - // We also allow this in C99 as an extension. - if (NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *Name, S)) - return NameClassification::NonType(D); + // We also allow this in C99 as an extension. However, this is not + // allowed in C2x as there are no functions without prototypes there. + if (!getLangOpts().C2x) { + if (NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *Name, S)) + return NameClassification::NonType(D); + } } if (getLangOpts().CPlusPlus20 && SS.isEmpty() && NextToken.is(tok::less)) { @@ -15219,6 +15222,9 @@ /// call, forming a call to an implicitly defined function (per C99 6.5.1p2). NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S) { + // It is not valid to implicitly define a function in C2x. + assert(!LangOpts.C2x && "Cannot implicitly define a function in C2x"); + // Find the scope in which the identifier is injected and the corresponding // DeclContext. // FIXME: C89 does not say what happens if there is no enclosing block scope. @@ -15264,8 +15270,10 @@ // OpenCL v2.0 s6.9.u - Implicit function declaration is not supported. else if (getLangOpts().OpenCL) diag_id = diag::err_opencl_implicit_function_decl; + else if (getLangOpts().C11) + diag_id = diag::ext_implicit_function_decl_c11; else if (getLangOpts().C99) - diag_id = diag::ext_implicit_function_decl; + diag_id = diag::ext_implicit_function_decl_c99; else diag_id = diag::warn_implicit_function_decl; @@ -15283,9 +15291,16 @@ } Diag(Loc, diag_id) << &II; - if (Corrected) - diagnoseTypo(Corrected, PDiag(diag::note_function_suggestion), - /*ErrorRecovery*/ false); + if (Corrected) { + // If the correction is going to suggest an implicitly defined function, + // skip the correction as not being a particularly good idea. + bool Diagnose = true; + if (const auto *D = Corrected.getCorrectionDecl()) + Diagnose = !D->isImplicit(); + if (Diagnose) + diagnoseTypo(Corrected, PDiag(diag::note_function_suggestion), + /*ErrorRecovery*/ false); + } // If we found a prior declaration of this function, don't bother building // another one. We've already pushed that one into scope, so there's nothing Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -2552,8 +2552,9 @@ return ExprError(); // This could be an implicitly declared function reference (legal in C90, - // extension in C99, forbidden in C++). - if (R.empty() && HasTrailingLParen && II && !getLangOpts().CPlusPlus) { + // extension in C99, forbidden in C++ and C2x). + if (R.empty() && HasTrailingLParen && II && !getLangOpts().CPlusPlus && + !getLangOpts().C2x) { NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *II, S); if (D) R.addDecl(D); } Index: clang/test/ARCMT/objcmt-arc-cf-annotations.m =================================================================== --- clang/test/ARCMT/objcmt-arc-cf-annotations.m +++ clang/test/ARCMT/objcmt-arc-cf-annotations.m @@ -80,6 +80,7 @@ extern const CFAllocatorRef kCFAllocatorDefault; extern CFTypeRef CFRetain(CFTypeRef cf); extern void CFRelease(CFTypeRef cf); +extern CFTypeRef CFAutorelease(CFTypeRef cf); extern CFTypeRef CFMakeCollectable(CFTypeRef cf); typedef struct { } Index: clang/test/ARCMT/objcmt-arc-cf-annotations.m.result =================================================================== --- clang/test/ARCMT/objcmt-arc-cf-annotations.m.result +++ clang/test/ARCMT/objcmt-arc-cf-annotations.m.result @@ -86,6 +86,7 @@ CF_IMPLICIT_BRIDGING_DISABLED +extern CFTypeRef CFAutorelease(CFTypeRef cf); extern CFTypeRef CFMakeCollectable(CFTypeRef cf); typedef struct { } Index: clang/test/Analysis/OSAtomic_mac.c =================================================================== --- clang/test/Analysis/OSAtomic_mac.c +++ clang/test/Analysis/OSAtomic_mac.c @@ -1,6 +1,8 @@ // RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection \ // RUN: -analyzer-output=text -verify %s +extern void clang_analyzer_eval(int); + int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **); int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **) { // There is some body in the actual header, Index: clang/test/Analysis/ObjCProperties.m =================================================================== --- clang/test/Analysis/ObjCProperties.m +++ clang/test/Analysis/ObjCProperties.m @@ -2,6 +2,7 @@ // RUN: -analyzer-checker=core,alpha.core,debug.ExprInspection #ifdef HEADER // A clever trick to avoid splitting up the test. +extern void clang_analyzer_eval(int); @interface NSObject @end Index: clang/test/Analysis/PR49642.c =================================================================== --- clang/test/Analysis/PR49642.c +++ clang/test/Analysis/PR49642.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -w -verify %s \ +// RUN: %clang_analyze_cc1 -std=c99 -w -verify %s \ // RUN: -analyzer-checker=core \ // RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions Index: clang/test/Analysis/diagnostics/no-store-func-path-notes.c =================================================================== --- clang/test/Analysis/diagnostics/no-store-func-path-notes.c +++ clang/test/Analysis/diagnostics/no-store-func-path-notes.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text\ +// RUN: %clang_analyze_cc1 -w -std=c99 -analyzer-checker=core -analyzer-output=text\ // RUN: -verify %s typedef __typeof(sizeof(int)) size_t; Index: clang/test/Analysis/misc-ps-region-store.m =================================================================== --- clang/test/Analysis/misc-ps-region-store.m +++ clang/test/Analysis/misc-ps-region-store.m @@ -1,5 +1,5 @@ -// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class -Wno-strict-prototypes %s -// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -DTEST_64 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class -Wno-strict-prototypes %s +// RUN: %clang_analyze_cc1 -std=c99 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class -Wno-strict-prototypes %s +// RUN: %clang_analyze_cc1 -std=c99 -triple x86_64-apple-darwin9 -DTEST_64 -analyzer-checker=core,alpha.core.CastToStruct,alpha.security.ReturnPtrRange,alpha.security.ArrayBound -analyzer-store=region -verify -fblocks -analyzer-opt-analyze-nested-blocks -Wno-objc-root-class -Wno-strict-prototypes %s typedef long unsigned int size_t; void *memcpy(void *, const void *, size_t); Index: clang/test/Analysis/novoidtypecrash.c =================================================================== --- clang/test/Analysis/novoidtypecrash.c +++ clang/test/Analysis/novoidtypecrash.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core %s +// RUN: %clang_analyze_cc1 -std=c89 -analyzer-checker=core %s x; y(void **z) { // no-crash *z = x; Index: clang/test/Analysis/plist-macros-with-expansion.c =================================================================== --- clang/test/Analysis/plist-macros-with-expansion.c +++ clang/test/Analysis/plist-macros-with-expansion.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core %s \ +// RUN: %clang_analyze_cc1 -std=c99 -analyzer-checker=core %s \ // RUN: -analyzer-output=plist -o %t.plist \ // RUN: -analyzer-config expand-macros=true -verify // Index: clang/test/CodeGen/2002-07-14-MiscTests3.c =================================================================== --- clang/test/CodeGen/2002-07-14-MiscTests3.c +++ clang/test/CodeGen/2002-07-14-MiscTests3.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null +// RUN: %clang_cc1 -std=c99 -w -emit-llvm %s -o /dev/null void *malloc(unsigned); int puts(const char *s); Index: clang/test/CodeGen/2002-07-31-SubregFailure.c =================================================================== --- clang/test/CodeGen/2002-07-31-SubregFailure.c +++ clang/test/CodeGen/2002-07-31-SubregFailure.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// RUN: %clang_cc1 -std=c99 -emit-llvm %s -o /dev/null typedef union { Index: clang/test/CodeGen/2003-08-18-SigSetJmp.c =================================================================== --- clang/test/CodeGen/2003-08-18-SigSetJmp.c +++ clang/test/CodeGen/2003-08-18-SigSetJmp.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o /dev/null +// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c99 -emit-llvm %s -o /dev/null #define _JBLEN ((9 * 2) + 3 + 16) typedef int sigjmp_buf[_JBLEN + 1]; Index: clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c =================================================================== --- clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c +++ clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c89 -emit-llvm %s -o - | FileCheck %s // There should not be an unresolved reference to func here. Believe it or not, // the "expected result" is a function named 'func' which is internal and Index: clang/test/CodeGen/2005-01-02-ConstantInits.c =================================================================== --- clang/test/CodeGen/2005-01-02-ConstantInits.c +++ clang/test/CodeGen/2005-01-02-ConstantInits.c @@ -5,6 +5,7 @@ // array subscripts. This corresponds to PR487. struct X { int a[2]; }; +extern int bar(); //. // CHECK: @test.i23 = internal global i32 4, align 4 Index: clang/test/CodeGen/2005-01-02-VAArgError-ICE.c =================================================================== --- clang/test/CodeGen/2005-01-02-VAArgError-ICE.c +++ clang/test/CodeGen/2005-01-02-VAArgError-ICE.c @@ -1,6 +1,6 @@ // This file is erroneous, but should not cause the compiler to ICE. // PR481 -// RUN: %clang_cc1 %s -emit-llvm -o /dev/null +// RUN: %clang_cc1 %s -std=c99 -emit-llvm -o /dev/null int flags(int a, int b, ...) { __builtin_va_list args; Index: clang/test/CodeGen/2006-01-13-StackSave.c =================================================================== --- clang/test/CodeGen/2006-01-13-StackSave.c +++ clang/test/CodeGen/2006-01-13-StackSave.c @@ -1,5 +1,5 @@ // PR691 -// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -no-opaque-pointers %s -std=c99 -emit-llvm -o - | FileCheck %s // CHECK: call i8* @llvm.stacksave() void test(int N) { Index: clang/test/CodeGen/2006-03-03-MissingInitializer.c =================================================================== --- clang/test/CodeGen/2006-03-03-MissingInitializer.c +++ clang/test/CodeGen/2006-03-03-MissingInitializer.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -std=c89 -o - | FileCheck %s struct X { int *XX; int Y;}; Index: clang/test/CodeGen/2008-05-12-TempUsedBeforeDef.c =================================================================== --- clang/test/CodeGen/2008-05-12-TempUsedBeforeDef.c +++ clang/test/CodeGen/2008-05-12-TempUsedBeforeDef.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -w -emit-llvm -o /dev/null %s +// RUN: %clang_cc1 -std=c89 -w -emit-llvm -o /dev/null %s // PR2264. unsigned foo = 8L; unsigned bar = 0L; Index: clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c =================================================================== --- clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c +++ clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o - %s +// RUN: %clang_cc1 -std=c89 -emit-llvm -o - %s // /* For posterity, the issue here begins initial "char []" decl for Index: clang/test/CodeGen/2008-08-19-cast-of-typedef.c =================================================================== --- clang/test/CodeGen/2008-08-19-cast-of-typedef.c +++ clang/test/CodeGen/2008-08-19-cast-of-typedef.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s +// RUN: %clang_cc1 -std=c89 -emit-llvm -o %t %s typedef short T[4]; struct s { Index: clang/test/CodeGen/2008-10-13-FrontendCrash.c =================================================================== --- clang/test/CodeGen/2008-10-13-FrontendCrash.c +++ clang/test/CodeGen/2008-10-13-FrontendCrash.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - +// RUN: %clang_cc1 %s -std=c89 -emit-llvm -o - // PR2797 unsigned int Index: clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c =================================================================== --- clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c +++ clang/test/CodeGen/PowerPC/builtins-ppc-p8vector.c @@ -131,11 +131,11 @@ // CHECK: @llvm.ppc.altivec.vaddecuq // CHECK-LE: @llvm.ppc.altivec.vaddecuq - /* vec_mergee */ + /* vec_mergee */ res_vbi = vec_mergee(vbi, vbi); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm - + res_vsi = vec_mergee(vsi, vsi); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm @@ -143,7 +143,7 @@ res_vui = vec_mergee(vui, vui); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm -// CHECK-PPC: warning: implicit declaration of function 'vec_mergee' +// CHECK-PPC: error: implicit declaration of function 'vec_mergee' res_vbll = vec_mergee(vbll, vbll); // CHECK: @llvm.ppc.altivec.vperm @@ -177,8 +177,8 @@ res_vui = vec_mergeo(vui, vui); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm -// CHECK-PPC: warning: implicit declaration of function 'vec_mergeo' - +// CHECK-PPC: error: implicit declaration of function 'vec_mergeo' + /* vec_cmpeq */ res_vbll = vec_cmpeq(vbll, vbll); // CHECK: @llvm.ppc.altivec.vcmpequd @@ -403,7 +403,7 @@ res_vsc = vec_cntlz(vsc); // CHECK: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) // CHECK-LE: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) -// CHECK-PPC: warning: implicit declaration of function 'vec_cntlz' is invalid in C99 +// CHECK-PPC: error: implicit declaration of function 'vec_cntlz' is invalid in C99 res_vuc = vec_cntlz(vuc); // CHECK: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) @@ -754,19 +754,19 @@ res_vsi = vec_vpksdss(vsll, vsll); // CHECK: llvm.ppc.altivec.vpksdss // CHECK-LE: llvm.ppc.altivec.vpksdss -// CHECK-PPC: warning: implicit declaration of function 'vec_vpksdss' +// CHECK-PPC: error: implicit declaration of function 'vec_vpksdss' /* vec_vpksdus */ res_vui = vec_vpksdus(vsll, vsll); // CHECK: llvm.ppc.altivec.vpksdus // CHECK-LE: llvm.ppc.altivec.vpksdus -// CHECK-PPC: warning: implicit declaration of function 'vec_vpksdus' +// CHECK-PPC: error: implicit declaration of function 'vec_vpksdus' /* vec_vpkudum */ res_vsi = vec_vpkudum(vsll, vsll); // CHECK: vperm // CHECK-LE: vperm -// CHECK-PPC: warning: implicit declaration of function 'vec_vpkudum' +// CHECK-PPC: error: implicit declaration of function 'vec_vpkudum' res_vui = vec_vpkudum(vull, vull); // CHECK: vperm @@ -775,13 +775,13 @@ res_vui = vec_vpkudus(vull, vull); // CHECK: llvm.ppc.altivec.vpkudus // CHECK-LE: llvm.ppc.altivec.vpkudus -// CHECK-PPC: warning: implicit declaration of function 'vec_vpkudus' +// CHECK-PPC: error: implicit declaration of function 'vec_vpkudus' /* vec_vupkhsw */ res_vsll = vec_vupkhsw(vsi); // CHECK: llvm.ppc.altivec.vupkhsw // CHECK-LE: llvm.ppc.altivec.vupklsw -// CHECK-PPC: warning: implicit declaration of function 'vec_vupkhsw' +// CHECK-PPC: error: implicit declaration of function 'vec_vupkhsw' res_vbll = vec_vupkhsw(vbi); // CHECK: llvm.ppc.altivec.vupkhsw @@ -791,7 +791,7 @@ res_vsll = vec_vupklsw(vsi); // CHECK: llvm.ppc.altivec.vupklsw // CHECK-LE: llvm.ppc.altivec.vupkhsw -// CHECK-PPC: warning: implicit declaration of function 'vec_vupklsw' +// CHECK-PPC: error: implicit declaration of function 'vec_vupklsw' res_vbll = vec_vupklsw(vbi); // CHECK: llvm.ppc.altivec.vupklsw @@ -845,20 +845,20 @@ // CHECK: xor <16 x i8> [[T1]], // CHECK-LE: [[T1:%.+]] = and <16 x i8> // CHECK-LE: xor <16 x i8> [[T1]], -// CHECK-PPC: warning: implicit declaration of function 'vec_nand' is invalid in C99 +// CHECK-PPC: error: implicit declaration of function 'vec_nand' is invalid in C99 res_vsc = vec_nand(vbc, vbc); // CHECK: [[T1:%.+]] = and <16 x i8> // CHECK: xor <16 x i8> [[T1]], // CHECK-LE: [[T1:%.+]] = and <16 x i8> // CHECK-LE: xor <16 x i8> [[T1]], - + res_vuc = vec_nand(vuc, vuc); // CHECK: [[T1:%.+]] = and <16 x i8> // CHECK: xor <16 x i8> [[T1]], // CHECK-LE: [[T1:%.+]] = and <16 x i8> // CHECK-LE: xor <16 x i8> [[T1]], - + res_vss = vec_nand(vss, vss); // CHECK: [[T1:%.+]] = and <8 x i16> // CHECK: xor <8 x i16> [[T1]], @@ -937,7 +937,7 @@ // CHECK: or <16 x i8> {{%.+}}, [[T1]] // CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, // CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] -// CHECK-PPC: warning: implicit declaration of function 'vec_orc' is invalid in C99 +// CHECK-PPC: error: implicit declaration of function 'vec_orc' is invalid in C99 res_vsc = vec_orc(vsc, vbc); // CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, @@ -1166,7 +1166,7 @@ res_vull = vec_vbpermq(vuc, vuc); // CHECK: llvm.ppc.altivec.vbpermq // CHECK-LE: llvm.ppc.altivec.vbpermq -// CHECK-PPC: warning: implicit declaration of function 'vec_vbpermq' +// CHECK-PPC: error: implicit declaration of function 'vec_vbpermq' /* vec_vgbbd */ res_vsc = vec_vgbbd(vsc); @@ -1176,12 +1176,12 @@ res_vuc = vec_vgbbd(vuc); // CHECK: llvm.ppc.altivec.vgbbd // CHECK-LE: llvm.ppc.altivec.vgbbd -// CHECK-PPC: warning: implicit declaration of function 'vec_vgbbd' +// CHECK-PPC: error: implicit declaration of function 'vec_vgbbd' res_vuc = vec_gb(vuc); // CHECK: llvm.ppc.altivec.vgbbd // CHECK-LE: llvm.ppc.altivec.vgbbd -// CHECK-PPC: warning: implicit declaration of function 'vec_gb' +// CHECK-PPC: error: implicit declaration of function 'vec_gb' res_vsll = vec_gbb(vsll); // CHECK: llvm.ppc.altivec.vgbbd Index: clang/test/CodeGen/X86/bmi2-builtins.c =================================================================== --- clang/test/CodeGen/X86/bmi2-builtins.c +++ clang/test/CodeGen/X86/bmi2-builtins.c @@ -19,14 +19,14 @@ return _pext_u32(__X, __Y); } +#ifdef __i386__ unsigned int test_mulx_u32(unsigned int __X, unsigned int __Y, unsigned int *__P) { - // CHECK: @test_mulx_u32 - // CHECK-NOT: mul i64 // B32: @test_mulx_u32 // B32: mul i64 return _mulx_u32(__X, __Y, __P); } +#endif #ifdef __x86_64__ unsigned long long test_bzhi_u64(unsigned long long __X, unsigned long long __Y) { Index: clang/test/CodeGen/aarch64-mops.c =================================================================== --- clang/test/CodeGen/aarch64-mops.c +++ clang/test/CodeGen/aarch64-mops.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -target-feature +mte -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-MOPS %s -// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOMOPS %s -// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mte -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOMOPS %s -// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOMOPS %s +// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -target-feature +mops -std=c99 -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOMOPS %s +// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -std=c99 -target-feature +mte -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOMOPS %s +// RUN: %clang_cc1 -triple aarch64-arm-unknown-eabi -std=c99 -w -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-NOMOPS %s #include #include Index: clang/test/CodeGen/aarch64-neon-sm4-sm3.c =================================================================== --- clang/test/CodeGen/aarch64-neon-sm4-sm3.c +++ clang/test/CodeGen/aarch64-neon-sm4-sm3.c @@ -2,7 +2,7 @@ // RUN: -target-feature +sm4 -S -emit-llvm -o - %s \ // RUN: | FileCheck %s -// RUN: not %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon \ +// RUN: not %clang_cc1 -std=c99 -triple aarch64-linux-gnu -target-feature +neon \ // RUN: -S -emit-llvm -o - %s 2>&1 | FileCheck --check-prefix=CHECK-NO-CRYPTO %s // REQUIRES: aarch64-registered-target || arm-registered-target Index: clang/test/CodeGen/arm_acle.c =================================================================== --- clang/test/CodeGen/arm_acle.c +++ clang/test/CodeGen/arm_acle.c @@ -1,6 +1,6 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py // RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple armv8a-none-eabi -target-feature +crc -target-feature +dsp -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch32 -// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +neon -target-feature +crc -target-feature +crypto -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64 +// RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -Wno-error=implicit-function-declaration -triple aarch64-none-eabi -target-feature +neon -target-feature +crc -target-feature +crypto -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64 // RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +v8.3a -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483 // RUN: %clang_cc1 -no-opaque-pointers -ffreestanding -triple aarch64-none-eabi -target-feature +v8.5a -target-feature +rand -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s -check-prefixes=ARM,AArch64,AArch6483,AArch6485 Index: clang/test/CodeGen/attribute_constructor.c =================================================================== --- clang/test/CodeGen/attribute_constructor.c +++ clang/test/CodeGen/attribute_constructor.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -emit-llvm -o - | grep llvm.global_ctors +extern int bar(); void foo(void) __attribute__((constructor)); void foo(void) { bar(); Index: clang/test/CodeGen/builtins-arm-microsoft.c =================================================================== --- clang/test/CodeGen/builtins-arm-microsoft.c +++ clang/test/CodeGen/builtins-arm-microsoft.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -emit-llvm -o - %s \ // RUN: | FileCheck %s -check-prefix CHECK-MSVC -// RUN: %clang_cc1 -triple armv7-eabi -emit-llvm %s -o - \ +// RUN: %clang_cc1 -std=c99 -triple armv7-eabi -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix CHECK-EABI // REQUIRES: arm-registered-target Index: clang/test/CodeGen/builtins-arm-msvc-compat-only.c =================================================================== --- clang/test/CodeGen/builtins-arm-msvc-compat-only.c +++ clang/test/CodeGen/builtins-arm-msvc-compat-only.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple thumbv7-windows -fms-extensions -emit-llvm -o - %s \ // RUN: | FileCheck %s -check-prefix CHECK-MSVC -// RUN: %clang_cc1 -triple armv7-eabi -emit-llvm %s -o /dev/null 2>&1 \ +// RUN: %clang_cc1 -std=c99 -triple armv7-eabi -emit-llvm %s -o /dev/null 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-EABI // REQUIRES: arm-registered-target Index: clang/test/CodeGen/cast-emit.c =================================================================== --- clang/test/CodeGen/cast-emit.c +++ clang/test/CodeGen/cast-emit.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +extern int f(); typedef union { int i; float f; Index: clang/test/CodeGen/debug-info-block-vars.c =================================================================== --- clang/test/CodeGen/debug-info-block-vars.c +++ clang/test/CodeGen/debug-info-block-vars.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -no-opaque-pointers -x c -fblocks -debug-info-kind=standalone -emit-llvm -O0 \ +// RUN: %clang_cc1 -no-opaque-pointers -x c -std=c89 -fblocks -debug-info-kind=standalone -emit-llvm -O0 \ // RUN: -triple x86_64-apple-darwin -o - %s | FileCheck %s -// RUN: %clang_cc1 -no-opaque-pointers -x c -fblocks -debug-info-kind=standalone -emit-llvm -O1 \ +// RUN: %clang_cc1 -no-opaque-pointers -x c -std=c89 -fblocks -debug-info-kind=standalone -emit-llvm -O1 \ // RUN: -triple x86_64-apple-darwin -o - %s \ // RUN: | FileCheck --check-prefix=CHECK-OPT %s Index: clang/test/CodeGen/debug-info-crash.c =================================================================== --- clang/test/CodeGen/debug-info-crash.c +++ clang/test/CodeGen/debug-info-crash.c @@ -1,5 +1,5 @@ // REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -debug-info-kind=limited -S %s -o - +// RUN: %clang_cc1 -std=c89 -triple i386-apple-darwin10 -fblocks -debug-info-kind=limited -S %s -o - // rdar://7590323 typedef struct dispatch_queue_s *dispatch_queue_t; Index: clang/test/CodeGen/decl.c =================================================================== --- clang/test/CodeGen/decl.c +++ clang/test/CodeGen/decl.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -w -fmerge-all-constants -emit-llvm < %s | FileCheck %s +// RUN: %clang_cc1 -no-opaque-pointers -std=c89 -w -fmerge-all-constants -emit-llvm < %s | FileCheck %s // CHECK: @test1.x = internal constant [12 x i32] [i32 1 // CHECK: @__const.test2.x = private unnamed_addr constant [13 x i32] [i32 1, Index: clang/test/CodeGen/init-with-member-expr.c =================================================================== --- clang/test/CodeGen/init-with-member-expr.c +++ clang/test/CodeGen/init-with-member-expr.c @@ -12,6 +12,7 @@ typedef struct mark_header_tag { unsigned char mark[7]; } mark_header_t; +extern int foo(); int is_rar_archive(int fd) { const mark_header_t rar_hdr[2] = {{0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00}, {'U', 'n', 'i', 'q', 'u', 'E', '!'}}; foo(rar_hdr); Index: clang/test/CodeGen/misaligned-param.c =================================================================== --- clang/test/CodeGen/misaligned-param.c +++ clang/test/CodeGen/misaligned-param.c @@ -1,7 +1,8 @@ -// RUN: %clang_cc1 %s -triple i386-apple-darwin -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -std=c89 -triple i386-apple-darwin -emit-llvm -o - | FileCheck %s // Misaligned parameter must be memcpy'd to correctly aligned temporary. struct s { int x; long double y; }; +int bar(struct s *, struct s *); long double foo(struct s x, int i, struct s y) { // CHECK: foo // CHECK: %x = alloca %struct.s, align 16 Index: clang/test/CodeGen/neon-crypto.c =================================================================== --- clang/test/CodeGen/neon-crypto.c +++ clang/test/CodeGen/neon-crypto.c @@ -5,7 +5,7 @@ // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \ // RUN: -target-feature +sha2 -target-feature +aes \ // RUN: -emit-llvm -O1 -o - %s | FileCheck %s -// RUN: not %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \ +// RUN: not %clang_cc1 -std=c99 -triple arm64-none-linux-gnu -target-feature +neon \ // RUN: -S -O3 -o - %s 2>&1 | FileCheck --check-prefix=CHECK-NO-CRYPTO %s // REQUIRES: aarch64-registered-target || arm-registered-target Index: clang/test/CodeGen/struct-comma.c =================================================================== --- clang/test/CodeGen/struct-comma.c +++ clang/test/CodeGen/struct-comma.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -emit-llvm -o - struct S {int a, b;} x; +extern int r(void); void a(struct S* b) {*b = (r(), x);} Index: clang/test/CodeGen/variable-array.c =================================================================== --- clang/test/CodeGen/variable-array.c +++ clang/test/CodeGen/variable-array.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm < %s | grep puts | count 4 +// RUN: %clang_cc1 -std=c99 -emit-llvm < %s | grep puts | count 4 // PR3248 int a(int x) Index: clang/test/Frontend/warning-mapping-2.c =================================================================== --- clang/test/Frontend/warning-mapping-2.c +++ clang/test/Frontend/warning-mapping-2.c @@ -1,5 +1,5 @@ // Check that -w takes precedence over -pedantic-errors. -// RUN: %clang_cc1 -verify -pedantic-errors -w %s +// RUN: %clang_cc1 -verify -std=c89 -pedantic-errors -w %s // Expect *not* to see a diagnostic for "implicit declaration of function" // expected-no-diagnostics Index: clang/test/Headers/arm-cmse-header-ns.c =================================================================== --- clang/test/Headers/arm-cmse-header-ns.c +++ clang/test/Headers/arm-cmse-header-ns.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple thumbv8m.base-eabi -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-c %s +// RUN: not %clang_cc1 -triple thumbv8m.base-eabi -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-c %s // RUN: not %clang_cc1 -triple thumbv8m.base-eabi -fsyntax-only -x c++ %s 2>&1 | FileCheck --check-prefix=CHECK-cpp %s #include @@ -16,10 +16,10 @@ cmse_TTAT(p); cmse_TTA_fptr(fptr); cmse_TTAT_fptr(fptr); -// CHECK-c: warning: implicit declaration of function 'cmse_TTA' -// CHECK-c: warning: implicit declaration of function 'cmse_TTAT' -// CHECK-c: warning: implicit declaration of function 'cmse_TTA_fptr' -// CHECK-c: warning: implicit declaration of function 'cmse_TTAT_fptr' +// CHECK-c: error: implicit declaration of function 'cmse_TTA' +// CHECK-c: error: implicit declaration of function 'cmse_TTAT' +// CHECK-c: error: implicit declaration of function 'cmse_TTA_fptr' +// CHECK-c: error: implicit declaration of function 'cmse_TTAT_fptr' // CHECK-cpp: error: use of undeclared identifier 'cmse_TTA' // CHECK-cpp: error: use of undeclared identifier 'cmse_TTAT' // CHECK-cpp: error: use of undeclared identifier 'cmse_TTA_fptr' Index: clang/test/Import/objc-arc/test-cleanup-object.m =================================================================== --- clang/test/Import/objc-arc/test-cleanup-object.m +++ clang/test/Import/objc-arc/test-cleanup-object.m @@ -5,6 +5,7 @@ // CHECK: ExprWithCleanups // CHECK-NEXT: cleanup CompoundLiteralExpr +extern int getObj(); void test(int c, id a) { (void)getObj(c, a); } Index: clang/test/Modules/config_macros.m =================================================================== --- clang/test/Modules/config_macros.m +++ clang/test/Modules/config_macros.m @@ -23,6 +23,6 @@ @import config; // expected-warning{{definition of configuration macro 'WANT_BAR' has no effect on the import of 'config'; pass '-DWANT_BAR=...' on the command line to configure the module}} // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -DWANT_FOO=1 %s -verify +// RUN: %clang_cc1 -std=c99 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -DWANT_FOO=1 -emit-module -fmodule-name=config %S/Inputs/module.map +// RUN: %clang_cc1 -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -DWANT_FOO=1 %s -verify Index: clang/test/Modules/modulemap-locations.m =================================================================== --- clang/test/Modules/modulemap-locations.m +++ clang/test/Modules/modulemap-locations.m @@ -12,7 +12,9 @@ void test(void) { will_be_found1(); - wont_be_found1(); // expected-warning{{implicit declaration of function 'wont_be_found1' is invalid in C99}} + wont_be_found1(); // expected-error{{implicit declaration of function 'wont_be_found1' is invalid in C99}} \ + expected-note {{did you mean 'will_be_found1'?}} \ + expected-note@Inputs/ModuleMapLocations/Module_ModuleMap/a.h:1 {{'will_be_found1' declared here}} will_be_found2(); - wont_be_found2(); // expected-warning{{implicit declaration of function 'wont_be_found2' is invalid in C99}} + wont_be_found2(); // expected-error{{implicit declaration of function 'wont_be_found2' is invalid in C99}} } Index: clang/test/OpenMP/declare_mapper_messages.c =================================================================== --- clang/test/OpenMP/declare_mapper_messages.c +++ clang/test/OpenMP/declare_mapper_messages.c @@ -42,9 +42,9 @@ {} #pragma omp target map(mapper:vv) // expected-error {{expected '(' after 'mapper'}} {} -#pragma omp target map(mapper( :vv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-warning {{implicit declaration of function 'mapper' is invalid in C99}} expected-note {{to match this '('}} +#pragma omp target map(mapper( :vv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-error {{implicit declaration of function 'mapper' is invalid in C99}} expected-note {{to match this '('}} {} -#pragma omp target map(mapper(aa :vv) // expected-error {{use of undeclared identifier 'aa'}} expected-error {{expected ')'}} expected-warning {{implicit declaration of function 'mapper' is invalid in C99}} expected-note {{to match this '('}} +#pragma omp target map(mapper(aa :vv) // expected-error {{use of undeclared identifier 'aa'}} expected-error {{expected ')'}} expected-error {{implicit declaration of function 'mapper' is invalid in C99}} expected-note {{to match this '('}} {} #pragma omp target map(mapper(ab) :vv) // expected-error {{missing map type}} expected-error {{cannot find a valid user-defined mapper for type 'struct vec' with name 'ab'}} {} Index: clang/test/PCH/chain-macro-override.c =================================================================== --- clang/test/PCH/chain-macro-override.c +++ clang/test/PCH/chain-macro-override.c @@ -2,15 +2,15 @@ // RUN: %clang_cc1 -include %S/Inputs/chain-macro-override1.h -include %S/Inputs/chain-macro-override2.h -fsyntax-only -verify -detailed-preprocessing-record %s // Test with pch. -// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h -detailed-preprocessing-record -// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -detailed-preprocessing-record +// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-macro-override1.h -detailed-preprocessing-record +// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-macro-override2.h -include-pch %t1 -detailed-preprocessing-record // RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s int foo(void) { f(); g(); h(); - h2(); // expected-warning{{implicit declaration of function 'h2' is invalid in C99}} + h2(); // expected-error {{implicit declaration of function 'h2' is invalid in C99}} h3(); return x; } Index: clang/test/Rewriter/rewrite-foreach-2.m =================================================================== --- clang/test/Rewriter/rewrite-foreach-2.m +++ clang/test/Rewriter/rewrite-foreach-2.m @@ -25,7 +25,7 @@ for (el in self) { LOOP(); for (id el1 in self) - INNER_LOOP(); + INNERLOOP(); END_LOOP(); } Index: clang/test/Rewriter/rewrite-try-catch.m =================================================================== --- clang/test/Rewriter/rewrite-try-catch.m +++ clang/test/Rewriter/rewrite-try-catch.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o - +// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -std=c99 %s -o - @interface Foo @end @interface GARF @end Index: clang/test/Sema/__try.c =================================================================== --- clang/test/Sema/__try.c +++ clang/test/Sema/__try.c @@ -50,7 +50,7 @@ } // expected-error{{expected '__except' or '__finally' block}} void TEST(void) { - __except (FilterExpression()) { // expected-warning{{implicit declaration of function '__except' is invalid in C99}} \ + __except (FilterExpression()) { // expected-error{{implicit declaration of function '__except' is invalid in C99}} \ // expected-error{{too few arguments to function call, expected 1, have 0}} \ // expected-error{{expected ';' after expression}} } Index: clang/test/Sema/aarch64-tme-errors.c =================================================================== --- clang/test/Sema/aarch64-tme-errors.c +++ clang/test/Sema/aarch64-tme-errors.c @@ -3,6 +3,6 @@ #include "arm_acle.h" void test_no_tme_funcs(void) { - __tstart(); // expected-warning{{implicit declaration of function '__tstart'}} + __tstart(); // expected-error{{implicit declaration of function '__tstart'}} __builtin_tstart(); // expected-error{{use of unknown builtin '__builtin_tstart'}} } Index: clang/test/Sema/arm-no-fp16.c =================================================================== --- clang/test/Sema/arm-no-fp16.c +++ clang/test/Sema/arm-no-fp16.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple thumbv7-none-eabi %s -target-feature +neon \ // RUN: -fallow-half-arguments-and-returns -target-feature -fp16 \ -// RUN: -fsyntax-only -verify +// RUN: -fsyntax-only -verify -std=c99 // REQUIRES: aarch64-registered-target || arm-registered-target Index: clang/test/Sema/bitfield.c =================================================================== --- clang/test/Sema/bitfield.c +++ clang/test/Sema/bitfield.c @@ -84,5 +84,5 @@ }; struct PR36157 { - int n : 1 ? 1 : implicitly_declare_function(); // expected-warning {{invalid in C99}} + int n : 1 ? 1 : implicitly_declare_function(); // expected-error {{invalid in C99}} }; Index: clang/test/Sema/builtin-setjmp.c =================================================================== --- clang/test/Sema/builtin-setjmp.c +++ clang/test/Sema/builtin-setjmp.c @@ -35,7 +35,7 @@ setjmp(0); #if NO_SETJMP // cxx-error@-2 {{undeclared identifier 'setjmp'}} - // c-warning@-3 {{implicit declaration of function 'setjmp' is invalid in C99}} + // c-error@-3 {{implicit declaration of function 'setjmp' is invalid in C99}} #elif ONLY_JMP_BUF // cxx-error@-5 {{undeclared identifier 'setjmp'}} // c-warning@-6 {{implicitly declaring library function 'setjmp' with type 'int (jmp_buf)' (aka 'int (int *)')}} Index: clang/test/Sema/builtins.c =================================================================== --- clang/test/Sema/builtins.c +++ clang/test/Sema/builtins.c @@ -2,7 +2,7 @@ // This test needs to set the target because it uses __builtin_ia32_vec_ext_v4si int test1(float a, int b) { - return __builtin_isless(a, b); // expected-note {{declared here}} + return __builtin_isless(a, b); } int test2(int a, int b) { return __builtin_islessequal(a, b); // expected-error {{floating point type}} @@ -97,8 +97,7 @@ } void test_unknown_builtin(int a, int b) { - __builtin_isles(a, b); // expected-error{{use of unknown builtin}} \ - // expected-note{{did you mean '__builtin_isless'?}} + __builtin_isles(a, b); // expected-error{{use of unknown builtin}} } int test13(void) { @@ -207,9 +206,9 @@ } void no_ms_builtins(void) { - __assume(1); // expected-warning {{implicit declaration}} - __noop(1); // expected-warning {{implicit declaration}} - __debugbreak(); // expected-warning {{implicit declaration}} + __assume(1); // expected-error {{implicit declaration}} + __noop(1); // expected-error {{implicit declaration}} + __debugbreak(); // expected-error {{implicit declaration}} } void unavailable(void) { @@ -234,7 +233,7 @@ strlcat(buf, b, sizeof(b)); // expected-warning {{size argument in 'strlcat' call appears to be size of the source; expected the size of the destination}} \ // expected-note {{change size argument to be the size of the destination}} - + __builtin___strlcat_chk(buf, b, sizeof(b), __builtin_object_size(buf, 0)); // expected-warning {{size argument in '__builtin___strlcat_chk' call appears to be size of the source; expected the size of the destination}} \ // expected-note {{change size argument to be the size of the destination}} \ // expected-warning {{'strlcat' will always overflow; destination buffer has size 20, but size argument is 40}} Index: clang/test/Sema/cxx-as-c.c =================================================================== --- clang/test/Sema/cxx-as-c.c +++ clang/test/Sema/cxx-as-c.c @@ -2,7 +2,7 @@ // PR36157 struct Foo { - Foo(int n) : n_(n) {} // expected-error 1+{{}} expected-warning 1+{{}} + Foo(int n) : n_(n) {} // expected-error 1+{{}} private: int n; }; Index: clang/test/Sema/implicit-builtin-decl.c =================================================================== --- clang/test/Sema/implicit-builtin-decl.c +++ clang/test/Sema/implicit-builtin-decl.c @@ -24,7 +24,7 @@ void f2() { fprintf(0, "foo"); // expected-warning{{declaration of built-in function 'fprintf' requires inclusion of the header }} \ - expected-warning {{implicit declaration of function 'fprintf' is invalid in C99}} + expected-error {{implicit declaration of function 'fprintf' is invalid in C99}} } // PR2892 Index: clang/test/Sema/implicit-decl.c =================================================================== --- clang/test/Sema/implicit-decl.c +++ clang/test/Sema/implicit-decl.c @@ -1,24 +1,36 @@ -// RUN: %clang_cc1 %s -verify -fsyntax-only -Werror=implicit-function-declaration +// RUN: %clang_cc1 %s -verify -fsyntax-only -Werror=implicit-function-declaration -std=c99 +// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11 +// RUN: %clang_cc1 %s -verify=c2x -fsyntax-only -std=c2x /// -Werror-implicit-function-declaration is a deprecated alias used by many projects. // RUN: %clang_cc1 %s -verify -fsyntax-only -Werror-implicit-function-declaration +// c2x-note@*:* {{'__builtin_va_list' declared here}} + typedef int int32_t; typedef unsigned char Boolean; -extern int printf(__const char *__restrict __format, ...); // expected-note{{'printf' declared here}} +extern int printf(__const char *__restrict __format, ...); // expected-note{{'printf' declared here}} \ + c2x-note {{'printf' declared here}} void func(void) { int32_t *vector[16]; const char compDesc[16 + 1]; int32_t compCount = 0; - if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-error {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}} expected-note {{previous implicit declaration}} + if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-error {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}} \ + expected-note {{previous implicit declaration}} \ + c2x-error {{use of undeclared identifier '_CFCalendarDecomposeAbsoluteTimeV'}} } printg("Hello, World!\n"); // expected-error{{implicit declaration of function 'printg' is invalid in C99}} \ - // expected-note{{did you mean 'printf'?}} - - __builtin_is_les(1, 3); // expected-error{{use of unknown builtin '__builtin_is_les'}} + expected-note{{did you mean 'printf'?}} \ + c2x-error {{use of undeclared identifier 'printg'; did you mean 'printf'?}} + + __builtin_is_les(1, 3); // expected-error{{use of unknown builtin '__builtin_is_les'}} \ + c2x-error {{unknown type name '__builtin_is_les'; did you mean '__builtin_va_list'?}} \ + c2x-error {{expected identifier or '('}} \ + c2x-error {{expected ')'}} \ + c2x-note {{to match this '('}} } Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **vector, int32_t count) { // expected-error {{conflicting types}} return 0; @@ -28,7 +40,16 @@ // Test the typo-correction callback in Sema::ImplicitlyDefineFunction extern int sformatf(char *str, __const char *__restrict __format, ...); // expected-note{{'sformatf' declared here}} void test_implicit(void) { - int formats = 0; + int formats = 0; // c2x-note {{'formats' declared here}} formatd("Hello, World!\n"); // expected-error{{implicit declaration of function 'formatd' is invalid in C99}} \ - // expected-note{{did you mean 'sformatf'?}} + expected-note{{did you mean 'sformatf'?}} \ + c2x-error {{use of undeclared identifier 'formatd'; did you mean 'formats'?}} \ + c2x-error {{called object type 'int' is not a function or function pointer}} +} + +void test_suggestion(void) { + bark(); // expected-error {{implicit declaration of function 'bark'}} \ + c2x-error {{use of undeclared identifier 'bark'}} + bork(); // expected-error {{implicit declaration of function 'bork'}} \ + c2x-error {{use of undeclared identifier 'bork'}} } Index: clang/test/Sema/implicit-ms-builtin-decl.c =================================================================== --- clang/test/Sema/implicit-ms-builtin-decl.c +++ clang/test/Sema/implicit-ms-builtin-decl.c @@ -38,7 +38,7 @@ #if defined(i386) void h(void) { - (void)__mulh(21LL, 2LL); // expected-warning{{implicit declaration of function '__mulh' is invalid}} - (void)__umulh(21ULL, 2ULL); // expected-warning{{implicit declaration of function '__umulh' is invalid}} + (void)__mulh(21LL, 2LL); // expected-error{{implicit declaration of function '__mulh' is invalid}} + (void)__umulh(21ULL, 2ULL); // expected-error{{implicit declaration of function '__umulh' is invalid}} } #endif Index: clang/test/Sema/typo-correction.c =================================================================== --- clang/test/Sema/typo-correction.c +++ clang/test/Sema/typo-correction.c @@ -37,7 +37,7 @@ typedef long long __m128i __attribute__((__vector_size__(16))); int PR23101(__m128i __x) { - return foo((__v2di)__x); // expected-warning {{implicit declaration of function 'foo'}} \ + return foo((__v2di)__x); // expected-error {{implicit declaration of function 'foo'}} \ // expected-error {{use of undeclared identifier '__v2di'}} } Index: clang/test/Sema/vla.c =================================================================== --- clang/test/Sema/vla.c +++ clang/test/Sema/vla.c @@ -22,11 +22,11 @@ extern int e1[2][m]; // expected-error {{variable length array declaration cannot have 'extern' linkage}} e1[0][0] = 0; - + } // PR2361 -int i; +int i; int c[][i]; // expected-error {{variably modified type declaration not allowed at file scope}} int d[i]; // expected-error {{variable length array declaration not allowed at file scope}} @@ -72,7 +72,7 @@ // PR36157 struct { int a[ // expected-error {{variable length array in struct}} - implicitly_declared() // expected-warning {{implicit declaration}} + implicitly_declared() // expected-error {{implicit declaration}} ]; }; int (*use_implicitly_declared)(void) = implicitly_declared; // ok, was implicitly declared at file scope Index: clang/test/Sema/warn-strict-prototypes.c =================================================================== --- clang/test/Sema/warn-strict-prototypes.c +++ clang/test/Sema/warn-strict-prototypes.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes -Wno-implicit-function-declaration -verify %s -// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -Wstrict-prototypes -Wno-implicit-function-declaration -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s // function definition with 0 params, no prototype, no preceding declaration. void foo0() {} // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} Index: clang/test/SemaOpenCL/arm-integer-dot-product.cl =================================================================== --- clang/test/SemaOpenCL/arm-integer-dot-product.cl +++ clang/test/SemaOpenCL/arm-integer-dot-product.cl @@ -9,11 +9,11 @@ int sr; ur = arm_dot(ua8, ub8); // expected-error{{implicit declaration of function 'arm_dot' is invalid in OpenCL}} sr = arm_dot(sa8, sb8); - ur = arm_dot_acc(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc' is invalid in OpenCL}} //expected-note{{'arm_dot_acc' declared here}} + ur = arm_dot_acc(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc' is invalid in OpenCL}} sr = arm_dot_acc(sa8, sb8, sr); ur = arm_dot_acc(ua16, ub16, ur); sr = arm_dot_acc(sa16, sb16, sr); - ur = arm_dot_acc_sat(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc_sat' is invalid in OpenCL}} //expected-note{{did you mean 'arm_dot_acc'?}} + ur = arm_dot_acc_sat(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc_sat' is invalid in OpenCL}} sr = arm_dot_acc_sat(sa8, sb8, sr); } Index: clang/test/SemaOpenCL/clang-builtin-version.cl =================================================================== --- clang/test/SemaOpenCL/clang-builtin-version.cl +++ clang/test/SemaOpenCL/clang-builtin-version.cl @@ -26,47 +26,30 @@ int tmp; foo(void); // expected-error{{implicit declaration of function 'foo' is invalid in OpenCL}} - // expected-note@-1{{'foo' declared here}} - // expected-error@-2{{expected expression}} + // expected-error@-1{{expected expression}} boo(); // expected-error{{implicit declaration of function 'boo' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'foo'?}} read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'read_pipe' is invalid in OpenCL}} write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'write_pipe' is invalid in OpenCL}} reserve_read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'reserve_read_pipe' is invalid in OpenCL}} - // expected-note@-1{{'reserve_read_pipe' declared here}} reserve_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'reserve_write_pipe' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'reserve_read_pipe'?}} work_group_reserve_read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'work_group_reserve_read_pipe' is invalid in OpenCL}} - // expected-note@-1 2{{'work_group_reserve_read_pipe' declared here}} work_group_reserve_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'work_group_reserve_write_pipe' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'work_group_reserve_read_pipe'?}} - // expected-note@-2{{'work_group_reserve_write_pipe' declared here}} sub_group_reserve_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'sub_group_reserve_write_pipe' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'work_group_reserve_write_pipe'?}} sub_group_reserve_read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'sub_group_reserve_read_pipe' is invalid in OpenCL}} commit_read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'commit_read_pipe' is invalid in OpenCL}} - // expected-note@-1{{'commit_read_pipe' declared here}} commit_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'commit_write_pipe' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'commit_read_pipe'?}} work_group_commit_read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'work_group_commit_read_pipe' is invalid in OpenCL}} - // expected-note@-1{{'work_group_commit_read_pipe' declared here}} - // expected-note@-2{{did you mean 'work_group_reserve_read_pipe'?}} work_group_commit_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'work_group_commit_write_pipe' is invalid in OpenCL}} - // expected-note@-1{{'work_group_commit_write_pipe' declared here}} - // expected-note@-2{{did you mean 'work_group_commit_read_pipe'?}} sub_group_commit_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'sub_group_commit_write_pipe' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'work_group_commit_write_pipe'?}} sub_group_commit_read_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'sub_group_commit_read_pipe' is invalid in OpenCL}} get_pipe_num_packets(tmp); // expected-error{{implicit declaration of function 'get_pipe_num_packets' is invalid in OpenCL}} - // expected-note@-1{{'get_pipe_num_packets' declared here}} get_pipe_max_packets(tmp); // expected-error{{implicit declaration of function 'get_pipe_max_packets' is invalid in OpenCL}} - // expected-note@-1{{did you mean 'get_pipe_num_packets'?}} } Index: clang/test/SemaOpenCL/to_addr_builtin.cl =================================================================== --- clang/test/SemaOpenCL/to_addr_builtin.cl +++ clang/test/SemaOpenCL/to_addr_builtin.cl @@ -63,10 +63,8 @@ #if (__OPENCL_C_VERSION__ < CL_VERSION_2_0) || (__OPENCL_C_VERSION__ >= CL_VERSION_3_0 && !defined(__opencl_c_generic_address_space)) // expected-error@-2{{implicit declaration of function 'to_local' is invalid in OpenCL}} // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__local int *__private' from 'int'}} - // expected-note@-4{{did you mean 'to_global'}} - // expected-note@15{{'to_global' declared here}} #else - // expected-warning@-7{{passing non-generic address space pointer to to_local may cause dynamic conversion affecting performance}} + // expected-warning@-5{{passing non-generic address space pointer to to_local may cause dynamic conversion affecting performance}} #endif priv = to_global(glob); Index: clang/test/VFS/module_missing_vfs.m =================================================================== --- clang/test/VFS/module_missing_vfs.m +++ clang/test/VFS/module_missing_vfs.m @@ -1,12 +1,12 @@ // RUN: rm -rf %t && mkdir -p %t // RUN: echo "void funcA(void);" >> %t/a.h -// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/mcp -I %S/Inputs/MissingVFS %s -fsyntax-only -ivfsoverlay %t/vfs.yaml 2>&1 | FileCheck %s -check-prefix=ERROR +// RUN: not %clang_cc1 -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/mcp -I %S/Inputs/MissingVFS %s -fsyntax-only -ivfsoverlay %t/vfs.yaml 2>&1 | FileCheck %s -check-prefix=ERROR // ERROR: virtual filesystem overlay file '{{.*}}' not found // RUN: find %t/mcp -name "A-*.pcm" | count 1 // RUN: sed -e "s@INPUT_DIR@%{/S:regex_replacement}/Inputs@g" -e "s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/MissingVFS/vfsoverlay.yaml > %t/vfs.yaml -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/mcp -I %S/Inputs/MissingVFS %s -fsyntax-only -ivfsoverlay %t/vfs.yaml +// RUN: %clang_cc1 -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/mcp -I %S/Inputs/MissingVFS %s -fsyntax-only -ivfsoverlay %t/vfs.yaml // RUN: find %t/mcp -name "A-*.pcm" | count 1 @import A; Index: compiler-rt/test/safestack/pthread-cleanup.c =================================================================== --- compiler-rt/test/safestack/pthread-cleanup.c +++ compiler-rt/test/safestack/pthread-cleanup.c @@ -17,6 +17,8 @@ return buffer; } +extern unsigned sleep(unsigned seconds); + int main(int argc, char **argv) { int arg = atoi(argv[1]);