[all-commits] [llvm/llvm-project] 12f78e: [Clang] [NFC] Fix unintended `-Wreturn-type` warni...
Sirraide via All-commits
all-commits at lists.llvm.org
Sat Jan 18 10:16:54 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 12f78e740c5419f7d1fbcf8f2106e7a40cd1d6f7
https://github.com/llvm/llvm-project/commit/12f78e740c5419f7d1fbcf8f2106e7a40cd1d6f7
Author: Sirraide <aeternalmail at gmail.com>
Date: 2025-01-18 (Sat, 18 Jan 2025)
Changed paths:
M clang/test/ARCMT/autoreleases.m
M clang/test/ARCMT/autoreleases.m.result
M clang/test/ARCMT/retains.m
M clang/test/ARCMT/retains.m.result
M clang/test/AST/ast-dump-cxx2b-deducing-this.cpp
M clang/test/AST/ast-dump-special-member-functions.cpp
M clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist
M clang/test/Analysis/const-method-call.cpp
M clang/test/Analysis/inline-unique-reports.c
M clang/test/Analysis/malloc.c
M clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m
M clang/test/Analysis/novoidtypecrash.c
M clang/test/Analysis/plist-output.m
M clang/test/Analysis/plist-stats-output.c
M clang/test/Analysis/scopes-cfg-output.cpp
M clang/test/Analysis/structured_bindings.cpp
M clang/test/CXX/drs/cwg605.cpp
M clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
M clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
M clang/test/CodeGen/2003-06-26-CFECrash.c
M clang/test/CodeGen/2003-08-18-SigSetJmp.c
M clang/test/CodeGen/2003-08-23-LocalUnionTest.c
M clang/test/CodeGen/2003-10-29-AsmRename.c
M clang/test/CodeGen/2003-11-20-ComplexDivision.c
M clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c
M clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c
M clang/test/CodeGen/2005-01-02-VAArgError-ICE.c
M clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c
M clang/test/CodeGen/2007-01-06-KNR-Proto.c
M clang/test/CodeGen/2008-05-06-CFECrash.c
M clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
M clang/test/CodeGen/2008-10-13-FrontendCrash.c
M clang/test/CodeGen/2009-01-21-InvalidIterator.c
M clang/test/CodeGen/2009-05-04-EnumInreg.c
M clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c
M clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c
M clang/test/CodeGen/X86/avx512fp16-abi.c
M clang/test/CodeGen/X86/x86_64-atomic-128.c
M clang/test/CodeGen/align-local.c
M clang/test/CodeGen/arm-cmse-nonsecure.c
M clang/test/CodeGen/arm-cmse-secure.c
M clang/test/CodeGen/attr-noinline.cpp
M clang/test/CodeGen/attr-noreturn.c
M clang/test/CodeGen/block-copy.c
M clang/test/CodeGen/builtin-memfns.c
M clang/test/CodeGen/catch-undef-behavior.c
M clang/test/CodeGen/cfi-unrelated-cast.cpp
M clang/test/CodeGen/const-label-addr.c
M clang/test/CodeGen/debug-info-crash.c
M clang/test/CodeGen/debug-info.c
M clang/test/CodeGen/empty-union-init.c
M clang/test/CodeGen/exceptions-seh.c
M clang/test/CodeGen/exprs.c
M clang/test/CodeGen/ext-int-cc.c
M clang/test/CodeGen/implicit-arg.c
M clang/test/CodeGen/msan-param-retval.c
M clang/test/CodeGen/msan-param-retval.cpp
M clang/test/CodeGen/object-size.c
M clang/test/CodeGen/sparcv8-abi.c
M clang/test/CodeGen/sret.c
M clang/test/CodeGen/static-order.c
M clang/test/CodeGen/staticinit.c
M clang/test/CodeGen/struct.c
M clang/test/CodeGen/ubsan-debuglog-return.c
M clang/test/CodeGen/union.c
M clang/test/CodeGen/ve-abi.c
M clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
M clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
M clang/test/CodeGenCXX/2007-10-01-StructResize.cpp
M clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp
M clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp
M clang/test/CodeGenCXX/address-space-cast-coerce.cpp
M clang/test/CodeGenCXX/array-value-initialize.cpp
M clang/test/CodeGenCXX/attr.cpp
M clang/test/CodeGenCXX/c-linkage.cpp
M clang/test/CodeGenCXX/catch-undef-behavior.cpp
M clang/test/CodeGenCXX/conditional-gnu-ext.cpp
M clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp
M clang/test/CodeGenCXX/debug-info-cxx0x.cpp
M clang/test/CodeGenCXX/debug-info-scoped-class.cpp
M clang/test/CodeGenCXX/debug-lambda-this.cpp
M clang/test/CodeGenCXX/expr.cpp
M clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
M clang/test/CodeGenCXX/mangle-exprs.cpp
M clang/test/CodeGenCXX/mangle-variadic-templates.cpp
M clang/test/CodeGenCXX/mangle.cpp
M clang/test/CodeGenCXX/matrix-type-operators.cpp
M clang/test/CodeGenCXX/matrix-type.cpp
M clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp
M clang/test/CodeGenCXX/new-alias.cpp
M clang/test/CodeGenCXX/nrvo.cpp
M clang/test/CodeGenCXX/reference-field.cpp
M clang/test/CodeGenCXX/return.cpp
M clang/test/CodeGenCXX/template-instantiation.cpp
M clang/test/CodeGenCXX/trap-fnattr.cpp
M clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp
M clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m
M clang/test/CodeGenObjC/2008-11-25-Blocks.m
M clang/test/CodeGenObjC/debug-info-crash.m
M clang/test/CodeGenObjC/encode-test.m
M clang/test/CodeGenObjC/message-arrays.m
M clang/test/CodeGenObjC/metadata-symbols-32.m
M clang/test/CodeGenObjC/metadata-symbols-64.m
M clang/test/CodeGenObjC/objc2-weak-compare.m
M clang/test/CodeGenObjC/objc2-write-barrier-2.m
M clang/test/CodeGenObjC/protocols-lazy.m
M clang/test/CodeGenObjC/strong-in-c-struct.m
M clang/test/CodeGenObjCXX/debug-info-line.mm
M clang/test/CodeGenObjCXX/instantiate-return.mm
M clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm
M clang/test/CodeGenObjCXX/property-dot-reference.mm
M clang/test/CodeGenObjCXX/return.mm
M clang/test/CoverageMapping/switch.cpp
M clang/test/Driver/cc-log-diagnostics.c
M clang/test/FixIt/fixit-availability-maccatalyst.m
M clang/test/FixIt/fixit-c++11.cpp
M clang/test/Frontend/absolute-paths.c
M clang/test/Frontend/ast-codegen.c
M clang/test/Frontend/ast-main.cpp
M clang/test/Misc/serialized-diags-stable.c
M clang/test/Modules/pr61067.cppm
M clang/test/Modules/redecl-merge.m
M clang/test/PCH/irgen-rdar13114142.mm
M clang/test/PCH/late-parsed-instantiations.cpp
M clang/test/PCH/pr4489.c
M clang/test/PCH/va_arg.c
M clang/test/PCH/va_arg.h
M clang/test/Parser/promote_types_in_proto.c
M clang/test/Rewriter/rewrite-extern-c.mm
M clang/test/Sema/freemain.c
M clang/test/Sema/return-type-mismatch.c
M clang/test/SemaCXX/attr-noreturn.cpp
M clang/test/SemaCXX/constant-expression-cxx14.cpp
M clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp
A clang/test/SemaCXX/err-missing-noreturn-1.cpp
A clang/test/SemaCXX/err-missing-noreturn-2.cpp
M clang/test/SemaCXX/return-noreturn.cpp
M clang/test/SemaCXX/warn-missing-noreturn.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp
M clang/test/SemaObjC/return-noreturn.m
M clang/test/SemaObjC/try-catch.m
M clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp
M clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
M clang/unittests/Tooling/ASTSelectionTest.cpp
M clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp
M clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
Log Message:
-----------
[Clang] [NFC] Fix unintended `-Wreturn-type` warnings everywhere in the test suite (#123464)
In preparation of making `-Wreturn-type` default to an error (as there
is virtually no situation where you’d *want* to fall off the end of a
function that is supposed to return a value), this patch fixes tests
that have relied on this being only a warning, of which there seem
to be 3 kinds:
1. Tests which for no apparent reason have a function that triggers the
warning.
I suspect that a lot of these were on accident (or from before the
warning was introduced), since a lot of people will open issues w/ their
problematic code in the `main` function (which is the one case where you
don’t need to return from a non-void function, after all...), which
someone will then copy, possibly into a namespace, possibly renaming it,
the end result of that being that you end up w/ something that
definitely is not `main` anymore, but which still is declared as
returning `int`, and which still has no return statement (another reason
why I think this might apply to a lot of these is because usually the
actual return type of such problematic functions is quite literally
`int`).
A lot of these are really old tests that don’t use `-verify`, which is
why no-one noticed or had to care about the extra warning that was
already being emitted by them until now.
2. Tests which test either `-Wreturn-type`, `[[noreturn]]`, or what
codegen and sanitisers do whenever you do fall off the end of a
function.
3. Tests where I struggle to figure out what is even being tested
(usually because they’re Objective-C tests, and I don’t know
Objective-C), whether falling off the end of a function matters in the
first place, and tests where actually spelling out an expression to
return would be rather cumbersome (e.g. matrix types currently don’t
support list initialisation, so I can’t write e.g. `return {}`).
For tests that fall into categories 2 and 3, I just added
`-Wno-error=return-type` to the `RUN` lines and called it a day. This
was especially necessary for the former since `-Wreturn-type` is an
analysis-based warning, meaning that it is currently impossible to test
for more than one occurrence of it in the same compilation if it
defaults to an error since the analysis pass is skipped for subsequent
functions as soon as an error is emitted.
I’ve also added `-Werror=return-type` to a few tests that I had already
updated as this patch was previously already making the warning an error
by default, but we’ve decided to split that into two patches instead.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list