forked from KarthikTunga/impala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMPALA-3676: Use clang as a static analysis tool
This patch adds a script to run clang-tidy over the whole code base. It is a first step towards running clang-tidy over patches as a tool to help users spot bugs before code review. Because of the number of clang-tidy checks, this patch only addresses some of them. In particular, only checks starting with 'clang' are considered. Many of them which are flaky or not part of our style are excluded from the analysis. This patch also exlcudes some checks which are part of our current style but which would be too laborious to fix over the entire codebase, like using nullptr rather than NULL. This patch also fixes a number of small bugs found by clang-tidy. Finally, this patch adds the class AlignedNew, the purpose of which is to provide correct alignment on heap-allocated data. The global new operator only guarantees 16-byte alignment. A class that includes a member variable that must be aligned on a k-byte boundary for k>16 can inherit from AlignedNew<k> to ensure correct alignment on the heap, quieting clang's -Wover-aligned warning. (Static and stack allocation are required by the standard to respect the alignment of the type and its member variables, so no extra code is needed for allocation in those places.) Change-Id: I4ed168488cb30ddeccd0087f3840541d858f9c06 Reviewed-on: http://gerrit.cloudera.org:8080/4758 Reviewed-by: Jim Apple <[email protected]> Tested-by: Internal Jenkins
- Loading branch information
1 parent
3220904
commit 9f5c6a5
Showing
114 changed files
with
565 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
--- | ||
Checks: "-*,clang*,\ | ||
-clang-analyzer-alpha*,\ | ||
-clang-analyzer-core.CallAndMessage,\ | ||
-clang-analyzer-core.NonNullParamChecker,\ | ||
-clang-analyzer-core.NullDereference,\ | ||
-clang-analyzer-core.UndefinedBinaryOperatorResult,\ | ||
-clang-analyzer-core.uninitialized.ArraySubscript,\ | ||
-clang-analyzer-core.uninitialized.Assign,\ | ||
-clang-analyzer-core.uninitialized.Branch,\ | ||
-clang-analyzer-deadcode.DeadStores,\ | ||
-clang-analyzer-unix.Malloc,\ | ||
-clang-analyzer-unix.MallocSizeof,\ | ||
-clang-diagnostic-c++98*,\ | ||
-clang-diagnostic-cast-align,\ | ||
-clang-diagnostic-class-varargs,\ | ||
-clang-diagnostic-conversion,\ | ||
-clang-diagnostic-covered-switch-default,\ | ||
-clang-diagnostic-disabled-macro-expansion,\ | ||
-clang-diagnostic-documentation-html,\ | ||
-clang-diagnostic-documentation-unknown-command,\ | ||
-clang-diagnostic-double-promotion,\ | ||
-clang-diagnostic-exit-time-destructors,\ | ||
-clang-diagnostic-float-conversion,\ | ||
-clang-diagnostic-float-equal,\ | ||
-clang-diagnostic-global-constructors,\ | ||
-clang-diagnostic-gnu-anonymous-struct,\ | ||
-clang-diagnostic-header-hygiene,\ | ||
-clang-diagnostic-implicit-fallthrough,\ | ||
-clang-diagnostic-mismatched-tags,\ | ||
-clang-diagnostic-missing-prototypes,\ | ||
-clang-diagnostic-missing-variable-declarations,\ | ||
-clang-diagnostic-nested-anon-types,\ | ||
-clang-diagnostic-old-style-cast,\ | ||
-clang-diagnostic-overlength-strings,\ | ||
-clang-diagnostic-packed,\ | ||
-clang-diagnostic-padded,\ | ||
-clang-diagnostic-return-type-c-linkage,\ | ||
-clang-diagnostic-shadow,\ | ||
-clang-diagnostic-shorten-64-to-32,\ | ||
-clang-diagnostic-sign-compare,\ | ||
-clang-diagnostic-sign-conversion,\ | ||
-clang-diagnostic-switch-enum,\ | ||
-clang-diagnostic-undefined-reinterpret-cast,\ | ||
-clang-diagnostic-unreachable-code,\ | ||
-clang-diagnostic-unreachable-code-return,\ | ||
-clang-diagnostic-unused-command-line-argument,\ | ||
-clang-diagnostic-unused-local-typedef,\ | ||
-clang-diagnostic-unused-parameter,\ | ||
-clang-diagnostic-used-but-marked-unused,\ | ||
-clang-diagnostic-vla-extension,\ | ||
-clang-diagnostic-weak-vtables" | ||
|
||
# Ignore warnings in gutil | ||
|
||
HeaderFilterRegex: "be/src/\ | ||
(benchmarks\ | ||
|bufferpool\ | ||
|catalog\ | ||
|codegen\ | ||
|common\ | ||
|exec\ | ||
|experiments\ | ||
|exprs\ | ||
|resourcebroker\ | ||
|rpc\ | ||
|runtime\ | ||
|scheduling\ | ||
|service\ | ||
|statestore\ | ||
|testutil\ | ||
|thirdparty\ | ||
|transport\ | ||
|udf\ | ||
|udf_samples\ | ||
|util)" | ||
|
||
AnalyzeTemporaryDtors: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.