Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6035317 authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

Merge "Add bluetooth_tidy default" into main am: bd8c0a69

parents a60757e4 bd8c0a69
Loading
Loading
Loading
Loading

.clang-tidy

0 → 100644
+4 −0
Original line number Diff line number Diff line
---
CheckOptions:
  - key:             misc-include-cleaner.IgnoreHeaders
    value:           (fmt/.*|bits/pthread_types\.h)
+21 −0
Original line number Diff line number Diff line
@@ -75,6 +75,27 @@ cc_defaults {
    cpp_std: "c++20",
}

// List of tidy checks that are enabled for cc targets.
// Note that the goal is not to enable all checks, many of them will
// appear as noise especially in the modernize-* range.
bluetooth_tidy_checks = [
    "-*",
    "misc-*",

    // This check implements detection of local variables which could be declared
    // as const but are not.
    "-misc-const-correctness",
]

// This default tidy checks that will be run against all the cc targets
// developed by the Bluetooth team.
cc_defaults {
    name: "bluetooth_tidy",
    tidy: true,
    tidy_checks: bluetooth_tidy_checks,
    tidy_checks_as_errors: bluetooth_tidy_checks,
}

java_defaults {
    name: "bluetooth_errorprone_rules",
    errorprone: {
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ cc_defaults {
    name: "fluoride_defaults",
    defaults: [
        "bluetooth_cflags",
        "bluetooth_tidy",
    ],
    cflags: [
        "-DEXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
+1 −53
Original line number Diff line number Diff line
@@ -12,9 +12,7 @@ cc_defaults {
    name: "gd_defaults",
    defaults: [
        "bluetooth_cflags",
    ],
    tidy_checks: [
        "-performance-unnecessary-value-param",
        "bluetooth_tidy",
    ],
    target: {
        android: {
@@ -39,56 +37,6 @@ cc_defaults {
    header_libs: ["jni_headers"],
}

cc_defaults {
    name: "gd_clang_tidy",
    tidy: true,
    tidy_checks: [
        "-bugprone*",
        "-cert-dcl21-cpp", // warning: overloaded returns a non-constant object instead of a constant object type
        "-cert-dcl59-cpp", // warning: do not use unnamed namespaces in header files
        "-cert-msc30-c", // warning: rand() has limited randomness; use C++11 random library instead
        "-cert-msc50-cpp", // warning: rand() has limited randomness; use C++11 random library instead
        "-cert-oop54-cpp", // warning: operator=() does not handle self-assignment properly
        "-google*",
        "-performance*",
        "clang-analyzer-core.CallAndMessage",
        "clang-analyzer-optin.cplusplus.UninitializedObject",
    ],
    tidy_checks_as_errors: [
        "clang-analyzer-core.CallAndMessage",
        "clang-analyzer-optin.cplusplus.UninitializedObject",
        "cppcoreguidelines-pro-type-member-init",
    ],
    tidy_flags: [
        "--header-filter=^.*packages/modules/Bluetooth/system/.*.h$",

        "--extra-arg-before=-Xclang",
        "--extra-arg-before=-analyzer-config",

        "--extra-arg-before=-Xclang",
        "--extra-arg-before=optin.cplusplus.UninitializedObject:Pedantic=true",

        "--extra-arg-before=-Xclang",
        "--extra-arg-before=-analyzer-config",

        "--extra-arg-before=-Xclang",
        "--extra-arg-before=optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true",

    ],
}

// Clang is targeted for android core libraries but other base libraries
// may not support clang tidy recommendations (e.g. MacOS)
cc_defaults {
    name: "gd_clang_tidy_ignore_android",
    tidy: true,
    tidy_checks: [
        "-android-cloexec-accept", // warning: prefer accept4() to accept() because accept4() allows SOCK_CLOEXEC
        "-android-cloexec-pipe2", //  warning: 'pipe2' should use O_CLOEXEC where possible
        "-android-cloexec-socket", // warning: 'pipe2' should use O_CLOEXEC where possible
    ],
}

soong_config_module_type {
    name: "mgmt_cc_defaults",
    module_type: "cc_defaults",
+0 −3
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ cc_library {
    name: "libbluetooth-dumpsys",
    host_supported: true,
    defaults: [
        "gd_clang_tidy",
        "gd_defaults",
    ],
    generated_sources: [
@@ -171,7 +170,6 @@ cc_library {
    name: "libbluetooth-dumpsys-test",
    host_supported: true,
    defaults: [
        "gd_clang_tidy",
        "gd_defaults",
    ],
    generated_sources: [
@@ -183,7 +181,6 @@ cc_library {
    name: "libbluetooth-dumpsys-unittest",
    host_supported: true,
    defaults: [
        "gd_clang_tidy",
        "gd_defaults",
    ],
    generated_headers: [