Skip to content

Commit 2cb2cd2

Browse files
committed
Change the behavior of implicit int diagnostics
C89 allowed a type specifier to be elided with the resulting type being int, aka implicit int behavior. This feature was subsequently removed in C99 without a deprecation period, so implementations continued to support the feature. Now, as with implicit function declarations, is a good time to reevaluate the need for this support. This patch allows -Wimplicit-int to issue warnings in C89 mode (off by default), defaults the warning to an error in C99 through C17, and disables support for the feature entirely in C2x. It also removes a warning about missing declaration specifiers that really was just an implicit int warning in disguise and other minor related cleanups.
1 parent b540ee5 commit 2cb2cd2

File tree

108 files changed

+361
-320
lines changed

Some content is hidden

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

108 files changed

+361
-320
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,8 +1492,8 @@ TEST(DiagsInHeaders, DiagInsideHeader) {
14921492
TU.AdditionalFiles = {{"a.h", std::string(Header.code())}};
14931493
EXPECT_THAT(*TU.build().getDiagnostics(),
14941494
UnorderedElementsAre(AllOf(
1495-
Diag(Main.range(), "in included file: C++ requires a "
1496-
"type specifier for all declarations"),
1495+
Diag(Main.range(), "in included file: a type specifier is "
1496+
"required for all declarations"),
14971497
withNote(Diag(Header.range(), "error occurred here")))));
14981498
}
14991499

@@ -1506,8 +1506,8 @@ TEST(DiagsInHeaders, DiagInTransitiveInclude) {
15061506
{"b.h", "no_type_spec; // error-ok"}};
15071507
EXPECT_THAT(*TU.build().getDiagnostics(),
15081508
UnorderedElementsAre(
1509-
Diag(Main.range(), "in included file: C++ requires a "
1510-
"type specifier for all declarations")));
1509+
Diag(Main.range(), "in included file: a type specifier is "
1510+
"required for all declarations")));
15111511
}
15121512

15131513
TEST(DiagsInHeaders, DiagInMultipleHeaders) {
@@ -1520,10 +1520,10 @@ TEST(DiagsInHeaders, DiagInMultipleHeaders) {
15201520
{"b.h", "no_type_spec; // error-ok"}};
15211521
EXPECT_THAT(*TU.build().getDiagnostics(),
15221522
UnorderedElementsAre(
1523-
Diag(Main.range("a"), "in included file: C++ requires a type "
1524-
"specifier for all declarations"),
1525-
Diag(Main.range("b"), "in included file: C++ requires a type "
1526-
"specifier for all declarations")));
1523+
Diag(Main.range("a"), "in included file: a type specifier is "
1524+
"required for all declarations"),
1525+
Diag(Main.range("b"), "in included file: a type specifier is "
1526+
"required for all declarations")));
15271527
}
15281528

15291529
TEST(DiagsInHeaders, PreferExpansionLocation) {
@@ -1537,8 +1537,8 @@ TEST(DiagsInHeaders, PreferExpansionLocation) {
15371537
{"b.h", "#ifndef X\n#define X\nno_type_spec; // error-ok\n#endif"}};
15381538
EXPECT_THAT(*TU.build().getDiagnostics(),
15391539
UnorderedElementsAre(Diag(Main.range(),
1540-
"in included file: C++ requires a type "
1541-
"specifier for all declarations")));
1540+
"in included file: a type specifier is "
1541+
"required for all declarations")));
15421542
}
15431543

15441544
TEST(DiagsInHeaders, PreferExpansionLocationMacros) {
@@ -1555,8 +1555,8 @@ TEST(DiagsInHeaders, PreferExpansionLocationMacros) {
15551555
{"c.h", "#ifndef X\n#define X\nno_type_spec; // error-ok\n#endif"}};
15561556
EXPECT_THAT(*TU.build().getDiagnostics(),
15571557
UnorderedElementsAre(
1558-
Diag(Main.range(), "in included file: C++ requires a "
1559-
"type specifier for all declarations")));
1558+
Diag(Main.range(), "in included file: a type specifier is "
1559+
"required for all declarations")));
15601560
}
15611561

15621562
TEST(DiagsInHeaders, LimitDiagsOutsideMainFile) {
@@ -1584,8 +1584,8 @@ TEST(DiagsInHeaders, LimitDiagsOutsideMainFile) {
15841584
#endif)cpp"}};
15851585
EXPECT_THAT(*TU.build().getDiagnostics(),
15861586
UnorderedElementsAre(
1587-
Diag(Main.range(), "in included file: C++ requires a "
1588-
"type specifier for all declarations")));
1587+
Diag(Main.range(), "in included file: a type specifier is "
1588+
"required for all declarations")));
15891589
}
15901590

15911591
TEST(DiagsInHeaders, OnlyErrorOrFatal) {
@@ -1599,8 +1599,8 @@ TEST(DiagsInHeaders, OnlyErrorOrFatal) {
15991599
TU.AdditionalFiles = {{"a.h", std::string(Header.code())}};
16001600
EXPECT_THAT(*TU.build().getDiagnostics(),
16011601
UnorderedElementsAre(AllOf(
1602-
Diag(Main.range(), "in included file: C++ requires "
1603-
"a type specifier for all declarations"),
1602+
Diag(Main.range(), "in included file: a type specifier is "
1603+
"required for all declarations"),
16041604
withNote(Diag(Header.range(), "error occurred here")))));
16051605
}
16061606

clang-tools-extra/test/clang-tidy/checkers/altera-struct-pack-align-invalid-decl-no-crash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
struct Foo {
44
member; // no-crash
55
};
6-
// CHECK-MESSAGES: :[[@LINE-2]]:3: error: C++ requires a type specifier for all declarations [clang-diagnostic-error]
6+
// CHECK-MESSAGES: :[[@LINE-2]]:3: error: a type specifier is required for all declarations [clang-diagnostic-error]

clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct Foo {
2020
// CHECK-MESSAGES: -input.cpp:3:7: error: 'a' declared as an array with a negative size [clang-diagnostic-error]
2121
// CHECK-MESSAGES: -input.cpp:4:7: warning: zero size arrays are an extension [clang-diagnostic-zero-length-array]
2222
// CHECK-MESSAGES: -input.cpp:6:11: error: unknown type name 'x' [clang-diagnostic-error]
23-
// CHECK-MESSAGES: -input.cpp:8:3: error: C++ requires a type specifier for all declarations [clang-diagnostic-error]
23+
// CHECK-MESSAGES: -input.cpp:8:3: error: a type specifier is required for all declarations [clang-diagnostic-error]
2424

2525
// CHECK-YAML: ---
2626
// CHECK-YAML-NEXT: MainSourceFile: '{{.*}}-input.cpp'
@@ -88,7 +88,7 @@ struct Foo {
8888
// CHECK-YAML-NEXT: BuildDirectory: '{{.*}}'
8989
// CHECK-YAML-NEXT: - DiagnosticName: clang-diagnostic-error
9090
// CHECK-YAML-NEXT: DiagnosticMessage:
91-
// CHECK-YAML-NEXT: Message: 'C++ requires a type specifier for all declarations'
91+
// CHECK-YAML-NEXT: Message: a type specifier is required for all declarations
9292
// CHECK-YAML-NEXT: FilePath: '{{.*}}-input.cpp'
9393
// CHECK-YAML-NEXT: FileOffset: 86
9494
// CHECK-YAML-NEXT: Replacements: []

clang/docs/ReleaseNotes.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,17 @@ Improvements to Clang's diagnostics
170170
``-Wno-implicit-function-declaration``. As of C2x, support for implicit
171171
function declarations has been removed, and the warning options will have no
172172
effect.
173-
173+
- The ``-Wimplicit-int`` warning diagnostic now defaults to an error in C99 and
174+
later. Prior to C2x, it may be downgraded to a warning with
175+
``-Wno-error=implicit-int``, or disabled entirely with ``-Wno-implicit-int``.
176+
As of C2x, support for implicit int has been removed, and the warning options
177+
will have no effect. Specifying ``-Wimplicit-int`` in C89 mode will now issue
178+
warnings instead of being a noop.
179+
- No longer issue a "declaration specifiers missing, defaulting to int"
180+
diagnostic in C89 mode because it is not an extension in C89, it was valid
181+
code. The diagnostic has been removed entirely as it did not have a
182+
diagnostic group to disable it, but it can be covered wholly by
183+
``-Wimplicit-int``.
174184
- ``-Wmisexpect`` warns when the branch weights collected during profiling
175185
conflict with those added by ``llvm.expect``.
176186

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ def err_enum_template : Error<"enumeration cannot be a template">;
123123
def warn_cxx20_compat_consteval : Warning<
124124
"'consteval' specifier is incompatible with C++ standards before C++20">,
125125
InGroup<CXX20Compat>, DefaultIgnore;
126-
126+
def warn_missing_type_specifier : Warning<
127+
"type specifier missing, defaults to 'int'">,
128+
InGroup<ImplicitInt>, DefaultIgnore;
127129
}
128130

129131
let CategoryName = "Nullability Issue" in {

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4341,8 +4341,9 @@ def err_void_param_qualified : Error<
43414341
"'void' as parameter must not have type qualifiers">;
43424342
def err_ident_list_in_fn_declaration : Error<
43434343
"a parameter list without types is only allowed in a function definition">;
4344-
def ext_param_not_declared : Extension<
4345-
"parameter %0 was not declared, defaulting to type 'int'">;
4344+
def ext_param_not_declared : ExtWarn<
4345+
"parameter %0 was not declared, defaults to 'int'; ISO C99 and later do not "
4346+
"support implicit int">, InGroup<ImplicitInt>, DefaultError;
43464347
def err_param_default_argument : Error<
43474348
"C does not support default arguments">;
43484349
def err_param_default_argument_redefinition : Error<
@@ -9997,15 +9998,13 @@ def warn_receiver_forward_class : Warning<
99979998
"receiver %0 is a forward class and corresponding @interface may not exist">,
99989999
InGroup<ForwardClassReceiver>;
999910000
def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
10000-
def ext_missing_declspec : ExtWarn<
10001-
"declaration specifier missing, defaulting to 'int'">;
1000210001
def ext_missing_type_specifier : ExtWarn<
10003-
"type specifier missing, defaults to 'int'">,
10004-
InGroup<ImplicitInt>;
10002+
"type specifier missing, defaults to 'int'; ISO C99 and later do not support "
10003+
"implicit int">, InGroup<ImplicitInt>, DefaultError;
10004+
def err_missing_type_specifier : Error<
10005+
"a type specifier is required for all declarations">;
1000510006
def err_decimal_unsupported : Error<
1000610007
"GNU decimal type extension not supported">;
10007-
def err_missing_type_specifier : Error<
10008-
"C++ requires a type specifier for all declarations">;
1000910008
def err_objc_array_of_interfaces : Error<
1001010009
"array of interface %0 is invalid (probably should be an array of pointers)">;
1001110010
def ext_c99_array_usage : Extension<

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode")
120120
LANGOPT(GNUMode , 1, 1, "GNU extensions")
121121
LANGOPT(GNUKeywords , 1, 1, "GNU keywords")
122122
VALUE_LANGOPT(GNUCVersion , 32, 0, "GNU C compatibility version")
123-
BENIGN_LANGOPT(ImplicitInt, 1, 0, "C89 implicit 'int'")
124123
LANGOPT(DisableKNRFunctions, 1, 0, "require function types to have a prototype")
125124
LANGOPT(Digraphs , 1, 0, "digraphs")
126125
BENIGN_LANGOPT(HexFloats , 1, 0, "C99 hexadecimal float constants")

clang/include/clang/Basic/LangOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@ class LangOptions : public LangOptionsBase {
537537
return !requiresStrictPrototypes() && !OpenCL;
538538
}
539539

540+
/// Returns true if implicit int is part of the language requirements.
541+
bool isImplicitIntRequired() const { return !CPlusPlus && !C99; }
542+
543+
/// Returns true if implicit int is supported at all.
544+
bool isImplicitIntAllowed() const { return !CPlusPlus && !C2x; }
545+
540546
/// Check if return address signing is enabled.
541547
bool hasSignReturnAddress() const {
542548
return getSignReturnAddressScope() != SignReturnAddressScopeKind::None;

clang/include/clang/Basic/LangStandard.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ enum LangFeatures {
5959
Digraphs = (1 << 11),
6060
GNUMode = (1 << 12),
6161
HexFloat = (1 << 13),
62-
ImplicitInt = (1 << 14),
63-
OpenCL = (1 << 15),
64-
HLSL = (1 << 16)
62+
OpenCL = (1 << 14),
63+
HLSL = (1 << 15)
6564
};
6665

6766
/// LangStandard - Information about the properties of a particular language
@@ -131,9 +130,6 @@ struct LangStandard {
131130
/// hasHexFloats - Language supports hexadecimal float constants.
132131
bool hasHexFloats() const { return Flags & HexFloat; }
133132

134-
/// hasImplicitInt - Language allows variables to be typed as int implicitly.
135-
bool hasImplicitInt() const { return Flags & ImplicitInt; }
136-
137133
/// isOpenCL - Language is a OpenCL variant.
138134
bool isOpenCL() const { return Flags & OpenCL; }
139135

clang/include/clang/Basic/LangStandards.def

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,17 @@
3636

3737
// C89-ish modes.
3838
LANGSTANDARD(c89, "c89",
39-
C, "ISO C 1990",
40-
ImplicitInt)
39+
C, "ISO C 1990", 0)
4140
LANGSTANDARD_ALIAS(c89, "c90")
4241
LANGSTANDARD_ALIAS(c89, "iso9899:1990")
4342

4443
LANGSTANDARD(c94, "iso9899:199409",
4544
C, "ISO C 1990 with amendment 1",
46-
Digraphs | ImplicitInt)
45+
Digraphs)
4746

4847
LANGSTANDARD(gnu89, "gnu89",
4948
C, "ISO C 1990 with GNU extensions",
50-
LineComment | Digraphs | GNUMode | ImplicitInt)
49+
LineComment | Digraphs | GNUMode)
5150
LANGSTANDARD_ALIAS(gnu89, "gnu90")
5251

5352
// C99-ish modes

clang/lib/Basic/LangOptions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
113113
Opts.GNUMode = Std.isGNUMode();
114114
Opts.GNUCVersion = 0;
115115
Opts.HexFloats = Std.hasHexFloats();
116-
Opts.ImplicitInt = Std.hasImplicitInt();
117116
Opts.WChar = Std.isCPlusPlus();
118117
Opts.Digraphs = Std.hasDigraphs();
119118

clang/lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,8 +2637,8 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS,
26372637
// error, do lookahead to try to do better recovery. This never applies
26382638
// within a type specifier. Outside of C++, we allow this even if the
26392639
// language doesn't "officially" support implicit int -- we support
2640-
// implicit int as an extension in C99 and C11.
2641-
if (!isTypeSpecifier(DSC) && !getLangOpts().CPlusPlus &&
2640+
// implicit int as an extension in some language modes.
2641+
if (!isTypeSpecifier(DSC) && getLangOpts().isImplicitIntAllowed() &&
26422642
isValidAfterIdentifierInDeclarator(NextToken())) {
26432643
// If this token is valid for implicit int, e.g. "static x = 4", then
26442644
// we just avoid eating the identifier, so it will be parsed as the

clang/lib/Parse/Parser.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,10 +1195,12 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
11951195
const DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
11961196
TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);
11971197

1198-
// If this is C90 and the declspecs were completely missing, fudge in an
1198+
// If this is C89 and the declspecs were completely missing, fudge in an
11991199
// implicit int. We do this here because this is the only place where
12001200
// declaration-specifiers are completely optional in the grammar.
1201-
if (getLangOpts().ImplicitInt && D.getDeclSpec().isEmpty()) {
1201+
if (getLangOpts().isImplicitIntRequired() && D.getDeclSpec().isEmpty()) {
1202+
Diag(D.getIdentifierLoc(), diag::warn_missing_type_specifier)
1203+
<< D.getDeclSpec().getSourceRange();
12021204
const char *PrevSpec;
12031205
unsigned DiagID;
12041206
const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy();

clang/lib/Sema/SemaDecl.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14317,18 +14317,28 @@ void Sema::ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
1431714317
SourceLocation LocAfterDecls) {
1431814318
DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
1431914319

14320-
// Verify 6.9.1p6: 'every identifier in the identifier list shall be declared'
14321-
// for a K&R function.
14320+
// C99 6.9.1p6 "If a declarator includes an identifier list, each declaration
14321+
// in the declaration list shall have at least one declarator, those
14322+
// declarators shall only declare identifiers from the identifier list, and
14323+
// every identifier in the identifier list shall be declared.
14324+
//
14325+
// C89 3.7.1p5 "If a declarator includes an identifier list, only the
14326+
// identifiers it names shall be declared in the declaration list."
14327+
//
14328+
// This is why we only diagnose in C99 and later. Note, the other conditions
14329+
// listed are checked elsewhere.
1432214330
if (!FTI.hasPrototype) {
1432314331
for (int i = FTI.NumParams; i != 0; /* decrement in loop */) {
1432414332
--i;
1432514333
if (FTI.Params[i].Param == nullptr) {
14326-
SmallString<256> Code;
14327-
llvm::raw_svector_ostream(Code)
14328-
<< " int " << FTI.Params[i].Ident->getName() << ";\n";
14329-
Diag(FTI.Params[i].IdentLoc, diag::ext_param_not_declared)
14330-
<< FTI.Params[i].Ident
14331-
<< FixItHint::CreateInsertion(LocAfterDecls, Code);
14334+
if (getLangOpts().C99) {
14335+
SmallString<256> Code;
14336+
llvm::raw_svector_ostream(Code)
14337+
<< " int " << FTI.Params[i].Ident->getName() << ";\n";
14338+
Diag(FTI.Params[i].IdentLoc, diag::ext_param_not_declared)
14339+
<< FTI.Params[i].Ident
14340+
<< FixItHint::CreateInsertion(LocAfterDecls, Code);
14341+
}
1433214342

1433314343
// Implicitly declare the argument as type 'int' for lack of a better
1433414344
// type.

clang/lib/Sema/SemaType.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,35 +1343,34 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
13431343
// allowed to be completely missing a declspec. This is handled in the
13441344
// parser already though by it pretending to have seen an 'int' in this
13451345
// case.
1346-
if (S.getLangOpts().ImplicitInt) {
1347-
// In C89 mode, we only warn if there is a completely missing declspec
1348-
// when one is not allowed.
1349-
if (DS.isEmpty()) {
1350-
S.Diag(DeclLoc, diag::ext_missing_declspec)
1351-
<< DS.getSourceRange()
1352-
<< FixItHint::CreateInsertion(DS.getBeginLoc(), "int");
1353-
}
1346+
if (S.getLangOpts().isImplicitIntRequired()) {
1347+
S.Diag(DeclLoc, diag::warn_missing_type_specifier)
1348+
<< DS.getSourceRange()
1349+
<< FixItHint::CreateInsertion(DS.getBeginLoc(), "int");
13541350
} else if (!DS.hasTypeSpecifier()) {
13551351
// C99 and C++ require a type specifier. For example, C99 6.7.2p2 says:
13561352
// "At least one type specifier shall be given in the declaration
13571353
// specifiers in each declaration, and in the specifier-qualifier list in
13581354
// each struct declaration and type name."
1359-
if (S.getLangOpts().CPlusPlus && !DS.isTypeSpecPipe()) {
1355+
if (!S.getLangOpts().isImplicitIntAllowed() && !DS.isTypeSpecPipe()) {
13601356
S.Diag(DeclLoc, diag::err_missing_type_specifier)
1361-
<< DS.getSourceRange();
1357+
<< DS.getSourceRange();
13621358

1363-
// When this occurs in C++ code, often something is very broken with the
1364-
// value being declared, poison it as invalid so we don't get chains of
1359+
// When this occurs, often something is very broken with the value
1360+
// being declared, poison it as invalid so we don't get chains of
13651361
// errors.
13661362
declarator.setInvalidType(true);
13671363
} else if (S.getLangOpts().getOpenCLCompatibleVersion() >= 200 &&
13681364
DS.isTypeSpecPipe()) {
13691365
S.Diag(DeclLoc, diag::err_missing_actual_pipe_type)
1370-
<< DS.getSourceRange();
1366+
<< DS.getSourceRange();
13711367
declarator.setInvalidType(true);
13721368
} else {
1369+
assert(S.getLangOpts().isImplicitIntAllowed() &&
1370+
"implicit int is disabled?");
13731371
S.Diag(DeclLoc, diag::ext_missing_type_specifier)
1374-
<< DS.getSourceRange();
1372+
<< DS.getSourceRange()
1373+
<< FixItHint::CreateInsertion(DS.getBeginLoc(), "int");
13751374
}
13761375
}
13771376

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 -Wno-implicit-function-declaration -w -verify %s \
1+
// RUN: %clang_analyze_cc1 -Wno-implicit-function-declaration -Wno-implicit-int -w -verify %s \
22
// RUN: -analyzer-checker=core \
33
// RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions
44

clang/test/Analysis/inline-unique-reports.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -o %t > /dev/null 2>&1
1+
// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -o %t > /dev/null 2>&1
22
// RUN: %normalize_plist <%t | diff -ub %S/Inputs/expected-plists/inline-unique-reports.c.plist -
33

44
static inline bug(int *p) {

clang/test/Analysis/malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -Wno-strict-prototypes -analyzer-store=region -verify %s \
1+
// RUN: %clang_analyze_cc1 -Wno-strict-prototypes -Wno-error=implicit-int -analyzer-store=region -verify %s \
22
// RUN: -analyzer-checker=core \
33
// RUN: -analyzer-checker=alpha.deadcode.UnreachableCode \
44
// RUN: -analyzer-checker=alpha.core.CastSize \

clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct S {
77

88
// Note, this is not permitted: conversion-declarator cannot have a trailing return type.
99
// FIXME: don't issue the second diagnostic for this.
10-
operator auto(*)()->int(); // expected-error{{'auto' not allowed in conversion function type}} expected-error {{C++ requires a type specifier}}
10+
operator auto(*)()->int(); // expected-error{{'auto' not allowed in conversion function type}} expected-error {{a type specifier is required}}
1111
};
1212

1313
typedef auto Fun(int a) -> decltype(a + a);

clang/test/CXX/drs/dr2xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ namespace dr298 { // dr298: yes
10941094
struct B b; // expected-error {{typedef 'B' cannot be referenced with a struct specifier}}
10951095
struct C c; // expected-error {{typedef 'C' cannot be referenced with a struct specifier}}
10961096

1097-
B::B() {} // expected-error {{requires a type specifier}}
1097+
B::B() {} // expected-error {{a type specifier is required}}
10981098
B::A() {} // ok
10991099
C::~C() {} // expected-error {{destructor cannot be declared using a typedef 'dr298::C' (aka 'const dr298::A') of the class name}}
11001100

clang/test/CXX/drs/dr4xx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ namespace dr484 { // dr484: yes
10541054
struct N::DT {}; // expected-error {{conflicts with typedef}}
10551055

10561056
typedef struct {
1057-
S(); // expected-error {{requires a type}}
1057+
S(); // expected-error {{a type specifier is required}}
10581058
} S;
10591059
}
10601060

0 commit comments

Comments
 (0)