Skip to content

Commit 7d644e1

Browse files
committed
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly declare a function that the user called but was never previously declared. The resulting function would be globally declared as extern int func(); -- a function without a prototype which accepts zero or more arguments. C99 removed support for this questionable feature due to severe security concerns. However, there was no deprecation period; C89 had the feature, C99 didn't. So Clang (and GCC) both supported the functionality as an extension in C99 and later modes. C2x no longer supports that function signature as it now requires all functions to have a prototype, and given the known security issues with the feature, continuing to support it as an extension is not tenable. This patch changes the diagnostic behavior for the -Wimplicit-function-declaration warning group depending on the language mode in effect. We continue to warn by default in C89 mode (due to the feature being dangerous to use). However, because this feature will not be supported in C2x mode, we've diagnosed it as being invalid for so long, the security concerns with the feature, and the trivial workaround for users (declare the function), we now default the extension warning to an error in C99-C17 mode. This still gives users an easy workaround if they are extensively using the extension in those modes (they can disable the warning or use -Wno-error to downgrade the error), but the new diagnostic makes it more clear that this feature is not supported and should be avoided. In C2x mode, we no longer allow an implicit function to be defined and treat the situation the same as any other lookup failure. Differential Revision: https://reviews.llvm.org/D122983
1 parent bf09a92 commit 7d644e1

File tree

301 files changed

+5113
-5010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+5113
-5010
lines changed

clang-tools-extra/clangd/IncludeFixer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ std::vector<Fix> IncludeFixer::fix(DiagnosticsEngine::Level DiagLevel,
197197
case diag::err_no_member_template:
198198
case diag::err_no_member_template_suggest:
199199
case diag::warn_implicit_function_decl:
200-
case diag::ext_implicit_function_decl:
200+
case diag::ext_implicit_function_decl_c99:
201201
case diag::err_opencl_implicit_function_decl:
202202
dlog("Unresolved name at {0}, last typo was {1}",
203203
Info.getLocation().printToString(Info.getSourceManager()),

clang-tools-extra/clangd/ParsedAST.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
428428
// this is an error. (The actual typo correction is nice too).
429429
// We restore the original severity in the level adjuster.
430430
// FIXME: It would be better to have a real API for this, but what?
431-
for (auto ID : {diag::ext_implicit_function_decl,
431+
for (auto ID : {diag::ext_implicit_function_decl_c99,
432+
diag::ext_implicit_lib_function_decl_c99,
432433
diag::warn_implicit_function_decl}) {
433434
OverriddenSeverity.try_emplace(
434435
ID, Clang->getDiagnostics().getDiagnosticLevel(ID, SourceLocation()));

clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ TEST(IncludeFixerTest, NoCrashOnTemplateInstantiations) {
14091409
TEST(IncludeFixerTest, HeaderNamedInDiag) {
14101410
Annotations Test(R"cpp(
14111411
$insert[[]]int main() {
1412-
[[printf]]("");
1412+
[[printf]](""); // error-ok
14131413
}
14141414
)cpp");
14151415
auto TU = TestTU::withCode(Test.code());
@@ -1420,16 +1420,19 @@ TEST(IncludeFixerTest, HeaderNamedInDiag) {
14201420
EXPECT_THAT(
14211421
*TU.build().getDiagnostics(),
14221422
ElementsAre(AllOf(
1423-
Diag(Test.range(), "implicitly declaring library function 'printf' "
1424-
"with type 'int (const char *, ...)'"),
1423+
Diag(Test.range(), "call to undeclared library function 'printf' "
1424+
"with type 'int (const char *, ...)'; ISO C99 "
1425+
"and later do not support implicit function "
1426+
"declarations"),
14251427
withFix(Fix(Test.range("insert"), "#include <stdio.h>\n",
14261428
"Include <stdio.h> for symbol printf")))));
14271429
}
14281430

14291431
TEST(IncludeFixerTest, CImplicitFunctionDecl) {
1430-
Annotations Test("void x() { [[foo]](); }");
1432+
Annotations Test("void x() { [[foo]](); /* error-ok */ }");
14311433
auto TU = TestTU::withCode(Test.code());
14321434
TU.Filename = "test.c";
1435+
TU.ExtraArgs.push_back("-std=c99");
14331436

14341437
Symbol Sym = func("foo");
14351438
Sym.Flags |= Symbol::IndexedForCodeCompletion;
@@ -1446,7 +1449,8 @@ TEST(IncludeFixerTest, CImplicitFunctionDecl) {
14461449
*TU.build().getDiagnostics(),
14471450
ElementsAre(AllOf(
14481451
Diag(Test.range(),
1449-
"implicit declaration of function 'foo' is invalid in C99"),
1452+
"call to undeclared function 'foo'; ISO C99 and later do not "
1453+
"support implicit function declarations"),
14501454
withFix(Fix(Range{}, "#include \"foo.h\"\n",
14511455
"Include \"foo.h\" for symbol foo")))));
14521456
}

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ Improvements to Clang's diagnostics
156156
without a prototype and with no arguments is an invalid redeclaration of a
157157
function with a prototype. e.g., ``void f(int); void f() {}`` is now properly
158158
diagnosed.
159+
- The ``-Wimplicit-function-declaration`` warning diagnostic now defaults to
160+
an error in C99 and later. Prior to C2x, it may be downgraded to a warning
161+
with ``-Wno-error=implicit-function-declaration``, or disabled entirely with
162+
``-Wno-implicit-function-declaration``. As of C2x, support for implicit
163+
function declarations has been removed, and the warning options will have no
164+
effect.
159165

160166
- ``-Wmisexpect`` warns when the branch weights collected during profiling
161167
conflict with those added by ``llvm.expect``.
@@ -230,6 +236,9 @@ C2x Feature Support
230236
- Implemented the `*_WIDTH` macros to complete support for
231237
`WG14 N2412 Two's complement sign representation for C2x <https://www9.open-std.org/jtc1/sc22/wg14/www/docs/n2412.pdf>`_.
232238
- Implemented `WG14 N2418 Adding the u8 character prefix <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2418.pdf>`_.
239+
- Removed support for implicit function declarations. This was a C89 feature
240+
that was removed in C99, but cannot be supported in C2x because it requires
241+
support for functions without prototypes, which no longer exist in C2x.
233242

234243
C++ Language Changes in Clang
235244
-----------------------------

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ def warn_return_value_udt_incomplete: Warning<
417417
def warn_implicit_function_decl : Warning<
418418
"implicit declaration of function %0">,
419419
InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
420-
def ext_implicit_function_decl : ExtWarn<
421-
"implicit declaration of function %0 is invalid in C99">,
422-
InGroup<ImplicitFunctionDeclare>;
420+
def ext_implicit_function_decl_c99 : ExtWarn<
421+
"call to undeclared function %0; ISO C99 and later do not support implicit "
422+
"function declarations">, InGroup<ImplicitFunctionDeclare>, DefaultError;
423423
def note_function_suggestion : Note<"did you mean %0?">;
424424

425425
def err_ellipsis_first_param : Error<
@@ -698,6 +698,10 @@ def note_unreachable_silence : Note<
698698
def ext_implicit_lib_function_decl : ExtWarn<
699699
"implicitly declaring library function '%0' with type %1">,
700700
InGroup<ImplicitFunctionDeclare>;
701+
def ext_implicit_lib_function_decl_c99 : ExtWarn<
702+
"call to undeclared library function '%0' with type %1; ISO C99 and later "
703+
"do not support implicit function declarations">,
704+
InGroup<ImplicitFunctionDeclare>, DefaultError;
701705
def note_include_header_or_declare : Note<
702706
"include the header <%0> or explicitly provide a declaration for '%1'">;
703707
def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;

clang/lib/Sema/SemaDecl.cpp

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -933,9 +933,12 @@ Sema::NameClassification Sema::ClassifyName(Scope *S, CXXScopeSpec &SS,
933933
//
934934
// appeared.
935935
//
936-
// We also allow this in C99 as an extension.
937-
if (NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *Name, S))
938-
return NameClassification::NonType(D);
936+
// We also allow this in C99 as an extension. However, this is not
937+
// allowed in C2x as there are no functions without prototypes there.
938+
if (!getLangOpts().C2x) {
939+
if (NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *Name, S))
940+
return NameClassification::NonType(D);
941+
}
939942
}
940943

941944
if (getLangOpts().CPlusPlus20 && SS.isEmpty() && NextToken.is(tok::less)) {
@@ -2302,7 +2305,8 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
23022305
if (!ForRedeclaration &&
23032306
(Context.BuiltinInfo.isPredefinedLibFunction(ID) ||
23042307
Context.BuiltinInfo.isHeaderDependentFunction(ID))) {
2305-
Diag(Loc, diag::ext_implicit_lib_function_decl)
2308+
Diag(Loc, LangOpts.C99 ? diag::ext_implicit_lib_function_decl_c99
2309+
: diag::ext_implicit_lib_function_decl)
23062310
<< Context.BuiltinInfo.getName(ID) << R;
23072311
if (const char *Header = Context.BuiltinInfo.getHeaderName(ID))
23082312
Diag(Loc, diag::note_include_header_or_declare)
@@ -15267,6 +15271,9 @@ void Sema::ActOnFinishDelayedAttribute(Scope *S, Decl *D,
1526715271
/// call, forming a call to an implicitly defined function (per C99 6.5.1p2).
1526815272
NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
1526915273
IdentifierInfo &II, Scope *S) {
15274+
// It is not valid to implicitly define a function in C2x.
15275+
assert(!LangOpts.C2x && "Cannot implicitly define a function in C2x");
15276+
1527015277
// Find the scope in which the identifier is injected and the corresponding
1527115278
// DeclContext.
1527215279
// FIXME: C89 does not say what happens if there is no enclosing block scope.
@@ -15305,15 +15312,15 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
1530515312
}
1530615313
}
1530715314

15308-
// Extension in C99. Legal in C90, but warn about it.
15315+
// Extension in C99 (defaults to error). Legal in C89, but warn about it.
1530915316
unsigned diag_id;
1531015317
if (II.getName().startswith("__builtin_"))
1531115318
diag_id = diag::warn_builtin_unknown;
1531215319
// OpenCL v2.0 s6.9.u - Implicit function declaration is not supported.
1531315320
else if (getLangOpts().OpenCL)
1531415321
diag_id = diag::err_opencl_implicit_function_decl;
1531515322
else if (getLangOpts().C99)
15316-
diag_id = diag::ext_implicit_function_decl;
15323+
diag_id = diag::ext_implicit_function_decl_c99;
1531715324
else
1531815325
diag_id = diag::warn_implicit_function_decl;
1531915326

@@ -15331,9 +15338,16 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc,
1533115338
}
1533215339

1533315340
Diag(Loc, diag_id) << &II;
15334-
if (Corrected)
15335-
diagnoseTypo(Corrected, PDiag(diag::note_function_suggestion),
15336-
/*ErrorRecovery*/ false);
15341+
if (Corrected) {
15342+
// If the correction is going to suggest an implicitly defined function,
15343+
// skip the correction as not being a particularly good idea.
15344+
bool Diagnose = true;
15345+
if (const auto *D = Corrected.getCorrectionDecl())
15346+
Diagnose = !D->isImplicit();
15347+
if (Diagnose)
15348+
diagnoseTypo(Corrected, PDiag(diag::note_function_suggestion),
15349+
/*ErrorRecovery*/ false);
15350+
}
1533715351

1533815352
// If we found a prior declaration of this function, don't bother building
1533915353
// another one. We've already pushed that one into scope, so there's nothing

clang/lib/Sema/SemaExpr.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,8 +2554,9 @@ Sema::ActOnIdExpression(Scope *S, CXXScopeSpec &SS,
25542554
return ExprError();
25552555

25562556
// This could be an implicitly declared function reference (legal in C90,
2557-
// extension in C99, forbidden in C++).
2558-
if (R.empty() && HasTrailingLParen && II && !getLangOpts().CPlusPlus) {
2557+
// extension in C99, forbidden in C++ and C2x).
2558+
if (R.empty() && HasTrailingLParen && II && !getLangOpts().CPlusPlus &&
2559+
!getLangOpts().C2x) {
25592560
NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *II, S);
25602561
if (D) R.addDecl(D);
25612562
}

clang/lib/Sema/SemaLookup.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -930,9 +930,11 @@ bool Sema::LookupBuiltin(LookupResult &R) {
930930

931931
// If this is a builtin on this (or all) targets, create the decl.
932932
if (unsigned BuiltinID = II->getBuiltinID()) {
933-
// In C++ and OpenCL (spec v1.2 s6.9.f), we don't have any predefined
934-
// library functions like 'malloc'. Instead, we'll just error.
935-
if ((getLangOpts().CPlusPlus || getLangOpts().OpenCL) &&
933+
// In C++, C2x, and OpenCL (spec v1.2 s6.9.f), we don't have any
934+
// predefined library functions like 'malloc'. Instead, we'll just
935+
// error.
936+
if ((getLangOpts().CPlusPlus || getLangOpts().OpenCL ||
937+
getLangOpts().C2x) &&
936938
Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
937939
return false;
938940

clang/test/ARCMT/objcmt-arc-cf-annotations.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static __inline__ __attribute__((always_inline)) CFRange CFRangeMake(CFIndex loc
8080
extern const CFAllocatorRef kCFAllocatorDefault;
8181
extern CFTypeRef CFRetain(CFTypeRef cf);
8282
extern void CFRelease(CFTypeRef cf);
83+
extern CFTypeRef CFAutorelease(CFTypeRef cf);
8384
extern CFTypeRef CFMakeCollectable(CFTypeRef cf);
8485
typedef struct {
8586
}

clang/test/ARCMT/objcmt-arc-cf-annotations.m.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ extern void CFRelease(CFTypeRef cf);
8686

8787
CF_IMPLICIT_BRIDGING_DISABLED
8888

89+
extern CFTypeRef CFAutorelease(CFTypeRef cf);
8990
extern CFTypeRef CFMakeCollectable(CFTypeRef cf);
9091
typedef struct {
9192
}

clang/test/Analysis/OSAtomic_mac.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection \
22
// RUN: -analyzer-output=text -verify %s
33

4+
extern void clang_analyzer_eval(int);
5+
46
int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **);
57
int OSAtomicCompareAndSwapPtrBarrier(void *, void *, void **) {
68
// There is some body in the actual header,

clang/test/Analysis/ObjCProperties.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// RUN: -analyzer-checker=core,alpha.core,debug.ExprInspection
33

44
#ifdef HEADER // A clever trick to avoid splitting up the test.
5+
extern void clang_analyzer_eval(int);
56

67
@interface NSObject
78
@end

clang/test/Analysis/PR49642.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -w -verify %s \
1+
// RUN: %clang_analyze_cc1 -Wno-implicit-function-declaration -w -verify %s \
22
// RUN: -analyzer-checker=core \
33
// RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions
44

clang/test/Analysis/dead-stores.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// RUN: -analyzer-config deadcode.DeadStores:ShowFixIts=true \
1313
// RUN: -verify=non-nested,nested
1414

15+
extern int printf(const char *, ...);
16+
1517
void f1(void) {
1618
int k, y; // non-nested-warning {{unused variable 'k'}}
1719
// non-nested-warning@-1 {{unused variable 'y'}}
@@ -30,8 +32,6 @@ void f2(void *b) {
3032
// CHECK-FIXES-NEXT: char *d;
3133

3234
printf("%s", c);
33-
// non-nested-warning@-1 {{implicitly declaring library function 'printf' with type 'int (const char *, ...)'}}
34-
// non-nested-note@-2 {{include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
3535
}
3636

3737
int f(void);

clang/test/Analysis/diagnostics/no-store-func-path-notes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -w -x c -analyzer-checker=core -analyzer-output=text\
1+
// RUN: %clang_analyze_cc1 -w -Wno-implicit-function-declaration -analyzer-checker=core -analyzer-output=text\
22
// RUN: -verify %s
33

44
typedef __typeof(sizeof(int)) size_t;

clang/test/Analysis/exercise-ps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 %s -verify \
1+
// RUN: %clang_analyze_cc1 %s -verify -Wno-error=implicit-function-declaration \
22
// RUN: -analyzer-checker=core \
33
// RUN: -analyzer-config core.CallAndMessage:ArgPointeeInitializedness=true
44
//
@@ -19,7 +19,7 @@ void_typedef f2_helper(void);
1919
static void f2(void *buf) {
2020
F12_typedef* x;
2121
x = f2_helper();
22-
memcpy((&x[1]), (buf), 1); // expected-warning{{implicitly declaring library function 'memcpy' with type 'void *(void *, const void *}} \
22+
memcpy((&x[1]), (buf), 1); // expected-warning{{call to undeclared library function 'memcpy' with type 'void *(void *, const void *}} \
2323
// expected-note{{include the header <string.h> or explicitly provide a declaration for 'memcpy'}}
2424
}
2525

clang/test/Analysis/malloc-three-arg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#define NULL ((void *)0)
77

88
void *malloc(size_t, void *, int);
9+
void free(void *);
910

1011
struct test {
1112
};

clang/test/Analysis/misc-ps-region-store.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// 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
2-
// 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
1+
// 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 -Wno-error=implicit-function-declaration %s
2+
// 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 -Wno-error=implicit-function-declaration %s
33

44
typedef long unsigned int size_t;
55
void *memcpy(void *, const void *, size_t);
@@ -1255,7 +1255,7 @@ void Rdar_9103310_E(Rdar_9103310_A * x, struct Rdar_9103310_C * b) { // expected
12551255
int i;
12561256
Rdar_9103310_B_t *y = (Rdar_9103310_B_t *) x;
12571257
for (i = 0; i < 101; i++) {
1258-
Rdar_9103310_F(b, "%2d%s ", (y->Rdar_9103310_C[i]) / 4, Rdar_9103310_D[(y->Rdar_9103310_C[i]) % 4]); // expected-warning {{implicit declaration of function 'Rdar_9103310_F' is invalid in C99}}
1258+
Rdar_9103310_F(b, "%2d%s ", (y->Rdar_9103310_C[i]) / 4, Rdar_9103310_D[(y->Rdar_9103310_C[i]) % 4]); // expected-warning {{call to undeclared function 'Rdar_9103310_F'; ISO C99 and later do not support implicit function declarations}}
12591259
}
12601260
}
12611261

clang/test/Analysis/novoidtypecrash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s
1+
// RUN: %clang_analyze_cc1 -std=c89 -analyzer-checker=core %s
22
x;
33
y(void **z) { // no-crash
44
*z = x;

clang/test/Analysis/plist-macros-with-expansion.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core %s \
1+
// RUN: %clang_analyze_cc1 -Wno-error=implicit-function-declaration -analyzer-checker=core %s \
22
// RUN: -analyzer-output=plist -o %t.plist \
33
// RUN: -analyzer-config expand-macros=true -verify
44
//
@@ -8,7 +8,7 @@
88
void test_strange_macro_expansion(void) {
99
char *path;
1010
STRANGE_FN(path); // no-crash
11-
// expected-warning@-1 {{implicit declaration of function}}
11+
// expected-warning@-1 {{call to undeclared function}}
1212
// expected-warning@-2 {{1st function call argument is an uninitialized value}}
1313
}
1414

clang/test/CodeGen/2002-07-14-MiscTests3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null
1+
// RUN: %clang_cc1 -Wno-implicit-function-declaration -w -emit-llvm %s -o /dev/null
22

33
void *malloc(unsigned);
44
int puts(const char *s);

clang/test/CodeGen/2002-07-31-SubregFailure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
1+
// RUN: %clang_cc1 -Wno-implicit-function-declaration -emit-llvm %s -o /dev/null
22

33

44
typedef union {

clang/test/CodeGen/2003-08-18-SigSetJmp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _JBLEN ((9 * 2) + 3 + 16)
44
typedef int sigjmp_buf[_JBLEN + 1];
55
int sigsetjmp(sigjmp_buf env, int savemask);
6+
void bar(void);
67
sigjmp_buf B;
78
int foo(void) {
89
sigsetjmp(B, 1);

clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
1+
// RUN: %clang_cc1 -std=c89 -emit-llvm %s -o - | FileCheck %s
22

33
// There should not be an unresolved reference to func here. Believe it or not,
44
// the "expected result" is a function named 'func' which is internal and

clang/test/CodeGen/2005-01-02-ConstantInits.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// array subscripts. This corresponds to PR487.
66

77
struct X { int a[2]; };
8+
extern int bar();
89

910
//.
1011
// CHECK: @test.i23 = internal global i32 4, align 4

clang/test/CodeGen/2005-01-02-VAArgError-ICE.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file is erroneous, but should not cause the compiler to ICE.
22
// PR481
3-
// RUN: %clang_cc1 %s -emit-llvm -o /dev/null
3+
// RUN: %clang_cc1 %s -Wno-implicit-function-declaration -emit-llvm -o /dev/null
44

55
int flags(int a, int b, ...) {
66
__builtin_va_list args;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %clang_cc1 %s -o /dev/null -emit-llvm
22

3+
double creal(_Complex double);
4+
35
int foo(__complex float c) {
46
return creal(c);
57
}

clang/test/CodeGen/2006-01-13-StackSave.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - | FileCheck %s
33
// CHECK: call i8* @llvm.stacksave()
44

5+
extern void external(int[*]);
6+
57
void test(int N) {
68
int i;
79
for (i = 0; i < N; ++i) {

clang/test/CodeGen/2006-03-03-MissingInitializer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
1+
// RUN: %clang_cc1 %s -emit-llvm -std=c89 -o - | FileCheck %s
22

33
struct X { int *XX; int Y;};
44

0 commit comments

Comments
 (0)