There was infrastructure to export ninja variables to bazel. Now that
the bazel migration is cancelled, we don't need it anymore.
Bug: 315353489
Test: m nothing
Change-Id: I298cc2ac7ebd004557be3b30d75f7357cab0b7a0
These warnings are not critical. We can fix them later.
Bug: 285361108
Bug: 285356805
Bug: 285356799
Test: build with WITH_TIDY=1 using clang-r498229
Change-Id: I594279a10ffb4fda07dfc33350b44d09c42d3f97
We want to keep these flags in sync between Soong and Bazel, so we need
to export it to a variable that Bazel can read.
Test: CI
Bug: 255750565
Change-Id: Idf019fa6a85d2d6bb2341b6cb989a48e9ef27d2e
Some projects do not allow or fix tidy warnings to
avoid warnings-as-errors. They should not run
clang-tidy even with TIDY_EXTERNAL_VENDOR=1.
Bug: 244631413
Test: presubmit; TIDY_EXTERNAL_VENDOR=1 make tidy-external_subset
Change-Id: Id86a55c222fdad813c1c3434245c86bb97d0cad6
This will avoid suppressing all checks in user defined
.clang-tidy config files.
Bug: 252877310
Test: TIDY_EXTERNAL_VENDOR=1 make tidy-soong_subset
Change-Id: I99032300542e9b83cba60b00f8d328c63b5728e2
* This is a temporary work around until the RBE input processor
can handle those flags.
* It's okay to remove some cflags in clang-tidy command
if they do not affect tidy check results.
Bug: 248371171
Test: enable RBE; RBE_CLANG_TIDY_EXEC_STRATEGY=remote; make tidy-soong_subset
Change-Id: If499bd7e1f0f89ccc3b7f7df7d67cfc64dc67028
* Most tidy-external-* and tidy-vendor-* rules
are no longer generated. But external/bcc,
external/android-clat, and some vendor/...
projects still have tidy- rules because they
have explicitly set tidy:true in .bp files.
* Some hardware/* directories are third-party
projects and also disabled by default.
Bug: 244631413
Test: presubmit; make tidy-soong_subset
Change-Id: I17f625e6270de81a111d9cd382fbc39f34edf924
* Disable bugprone-unchecked-optional-access because it
crashed with some Android files.
* Allow misc-const-correctness and bugprone-assignment-in-if-condition
as warnings, not to stop build as errors.
Disable them in the global default check list.
* Allow/show clang deprecated* and array-parameter warnings for the NEXT version.
Bug: 241125373
Bug: 241819232
Bug: 241941550
Bug: 241601211
Bug: 241997913
Test: presubmit
Change-Id: Ifdc7a63c4e349b1ace4880bd002d14dc41054dcf
* Reject -warnings-as-errors in the tidy_flags.
* Fix one grammar error in comment.
Bug: 229801437
Test: WITH_TIDY=1 make; make tidy-soong_subset
Change-Id: I4fae229add65131b64cd5a1d06507d27198010ed
* A follow up CL will set const NoWarningsAsErrorsInTidyFlags
and make it an error to use -warnings-as-errors in tidy_flags.
* Append TidyGlobalNoChecks after local tidy_checks to disable some checks.
* Append TidyGlobalNoErrorChecks after local tidy_checks_as_errors
(-warnings-as-errors) to allow some warnings globally.
* Move bugprone-signed-char-misuse and bugprone-branch-clone to
globalNoErrorCheckList so we can find and fix some of those warnings.
Bug: 229801437
Test: WITH_TIDY=1 make; make tidy-soong_subset
Change-Id: I0128b859b7be6eb9bbda1916b89a6a471b052150
* Save repeated strings in TidyFlags of build.ninja rules.
* Some of these checks were disabled to upgrade clang-tidy.
They could later be moved to TidyDefaultGlobalChecks and
TidyExternalVendorChecks if not breaking the build.
Some projects can then enable those checks locally.
Test: WITH_TIDY=1 make; make tidy-soong_subset
Change-Id: I70e4218c929e3c88f766f2c68c56c51356110e72
Now only keep the ones that do not have thousands of warnings.
We can add more such checks locally or when more warnings
are fixed or suppressed in source files.
Bug: 112478838
Bug: 218759304
Test: make tidy-soong_subset
Change-Id: Iac93310441cdc64ed80e8c30159a08f95e1e9ebc
* This tidy check is too noisy,
with more than 5000 cases over many files.
Bug: 218759304
Test: make tidy_soong_subset
Change-Id: I8a4b2589ecafdfcd9c19e8a4d59ce1784d1be694
Too many warnings from this library.
Treat it the same as tidyExternalVendor projects.
Bug: 231626164
Test: make tidy-vendor-google_arc_subset
Change-Id: Ieaf748517390cb6dfac7e85500666dc9f49ffd52
This will suppress warning like:
system/chre/chpp/app.c:637:3: warning: Call to function 'memset' is insecure
as it does not provide security checks introduced in the C11 standard.
Replace with analogous functions that support length arguments or provides
boundary checks such as 'memset_s' in case of C11
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
Test: WITH_TIDY=1 CLANG_ANALYZER_CHECKS=1 make tidy-system-chre-chpp_subset
Change-Id: I87a7bba31aa10260fc408317a8cd54bf80c03152
We turned this off in local tidy flags, but didn't disable it on global
tidy builds. Let's remove this for now, since the upkeep cost is large
on it, and it also is currently crashing in some cases.
Bug: http://b/199534745
Bug: http://b/194865868
Test: WITH_TIDY=1 m
Change-Id: Ife39ab4949c5baf825efff66326b276c6a2a59f4
* Do not run expensive clang-analyzer-* checks with googletest/*,
which should be checked upstream.
Test: make WITH_TIDY=1 CLANG_ANALYZER_CHECKS=1
Bug: 198098397
Change-Id: Ic801ffa802b42d4d55ae89553073c926f9eaa351
Abseil is not available in Android, so these checks are not
actionable.
Test: Compiled frameworks/av, no more spurious warnings.
Change-Id: Ic573a3234a99b0fa1f63449e8d020a17a43a134c
* Default -header-filter will now contain only module directory.
* In a clean build of aosp_x86_64-eng, this change can reduce
the number of (duplicated) clang-tidy warnings by 77% or more.
* When compiled with WITH_TIDY=1, if DEFAULT_TIDY_HEADER_DIRS is
not set, warnings from a header file will be shown only if
the file is in a module's (sub)directory.
* Set DEFAULT_TIDY_HEADER_DIRS="bionic/|bootable/|build/|cts/|\
dalvik/|developers/|development/|frameworks/|\
libcore/|libnativehelper/|system/"
will get before this change's -header-filter.
* Fix a bug: Default header-filter was not added when
tidy_flags was defined in a module.
With this fix, some incorrectly hidden header file tidy warnings
will now show up.
Bug: 179530304
Test: make with WITH_TIDY=1 and various setting of DEFAULT_TIDY_HEADER_DIRS
Change-Id: Ia0c05349908a730862dae36be9a2dbe4f44fb6da
* Now CLANG_ANALYZER_CHECKS=1 simply enable all clang-analyzer-* checks.
Test: make with WITH_TIDY=1 CLANG_ANALYZER_CHECKS=1
Change-Id: Ib97a2c491df66088197805e979e4bec28f2f433c
* WITH_TIDY=1 should not include clang-analyzer-* checks
because they are too slow.
* Nightly builds will use both WITH_TIDY=1 and
CLANG_ANALYZER_CHECKS=1.
Bug: 173736193
Test: make with WITH_TIDY=1 and CLANG_ANALYZER_CHECKS=1
Change-Id: I3885fd0e20475ceee5e3798bffc11a61994ac113
* clang-analyzer is slow and enables clang-diagnostic-padded,
which cannot be suppressed yet.
Test: make with WITH_TIDY=1 for crosshatch-userdebug
Change-Id: I20193f0db3154b037d58c5ca012a9e753b176722
This reduces amount of warnings in default builds,
until we add noexcept to those move constructors.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: Iaa9e9480dbc72a7370ccbe10ed232b87dc8d6184
This variable is a space separated string of clang-tidy flags to be passed
to clang-tidy before any other system required extra flags.
Note that when this flag or local tidy_flags is defined,
the default -header-filter flag is suppressed.
Test: make with WITH_TIDY=1 WITH_TIDY_FLAGS="-extra-arg=-DABCD1=1 -extra-arg=-DABCD2=2"
Bug: 32668284
Change-Id: If7bd31c65404ef7fe6c3499d51f0f209a704efd9
This variable is a regular expression to be passed as
additional patterns to the -header-filter flag for clang-tidy.
For example, when make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|mydir/*"
for a project in external/xyz, clang-tidy will be called with additional flag
-header-filter=\"(external/xyz|d1/d2|mydir/*)\"
Test: make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|mydir/*"
Bug: 32668284
Change-Id: I6051f4f80bc6dbab882bd81435ccbc772772ac63
* Some flags are accepted by clang but not clang-tidy.
They could cause the diagnostic-unused-command-line-argument warning.
Flag -flto messed up the -I flags.
* Add clang-diagnostic-unused-command-line-argument to
default clang-tidy checks.
* Move CLANG_TIDY_UNKNOWN_CFLAGS to build/make/core/clang/tidy.mk.
Bug: 111850071
Bug: 111885396
Test: build with WITH_TIDY=1
Change-Id: Iabeeb27715acf83ef6aafe3e77206b9a01a0d889
Some flags stop clang-tidy to search included header files.
Bug: 111885396
Test: run with WITH_TIDY=1
Change-Id: Ie1ac37298793c015286db0f5caa252b67f4db365
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}. The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.
SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does. This requires
updating every Singleton to use the android-specific methods.
Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
This matches what Make did.
Bug: 32244182
Test: WITH_TIDY=1 m -j
Test: WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=* m -j
Test: WITH_TIDY=1 DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS=* m -j
Change-Id: I12ee413829d35e20f21f8ca49bb315ea831a6506
For every file which we can run clang-tidy (C/C++ clang-built), we add a
new build node that depends on the object file (since clang-tidy does
not export a depfile), and is depended on by the link step. This is
better than how we're doing it in make, since calling tidy can be turned
on or off without needing to rebuild the object files.
This does not attempt to port WITH_TIDY_ONLY from Make, since the way
that it works is broken (due to the lack of a depfile).
Bug: 32244182
Test: WITH_TIDY=true mmma -j bionic/libc
Test: ./soong (Setting ClangTidy: true)
Change-Id: I40bbb5bb00d292d72bf1c293b93080b5f9f6d8ea