1tidy_errors = [
2    // https://clang.llvm.org/extra/clang-tidy/checks/list.html
3    // For many categories, the checks are too many to specify individually.
4    // Feel free to disable as needed - as warnings are generally ignored,
5    // we treat warnings as errors.
6    "android-*",
7    "bugprone-*",
8    "cert-*",
9    "clang-analyzer-security*",
10    "google-*",
11    "misc-*",
12    //"modernize-*",  // explicitly list the modernize as they can be subjective.
13    "modernize-avoid-bind",
14    //"modernize-avoid-c-arrays", // std::array<> can be verbose
15    "modernize-concat-nested-namespaces",
16    //"modernize-deprecated-headers", // C headers still ok even if there is C++ equivalent.
17    "modernize-deprecated-ios-base-aliases",
18    "modernize-loop-convert",
19    "modernize-make-shared",
20    "modernize-make-unique",
21    "modernize-pass-by-value",
22    "modernize-raw-string-literal",
23    "modernize-redundant-void-arg",
24    "modernize-replace-auto-ptr",
25    "modernize-replace-random-shuffle",
26    "modernize-return-braced-init-list",
27    "modernize-shrink-to-fit",
28    "modernize-unary-static-assert",
29    "modernize-use-auto",  // debatable - auto can obscure type
30    "modernize-use-bool-literals",
31    "modernize-use-default-member-init",
32    "modernize-use-emplace",
33    "modernize-use-equals-default",
34    "modernize-use-equals-delete",
35    "modernize-use-nodiscard",
36    "modernize-use-noexcept",
37    "modernize-use-nullptr",
38    "modernize-use-override",
39    //"modernize-use-trailing-return-type", // not necessarily more readable
40    "modernize-use-transparent-functors",
41    "modernize-use-uncaught-exceptions",
42    "modernize-use-using",
43    "performance-*",
44
45    // Remove some pedantic stylistic requirements.
46    "-google-readability-casting", // C++ casts not always necessary and may be verbose
47    "-google-readability-todo",    // do not require TODO(info)
48    "-google-build-using-namespace", // Reenable and fix later.
49]
50
51cc_defaults {
52    name: "soundpool_flags_defaults",
53    // https://clang.llvm.org/docs/UsersManual.html#command-line-options
54    // https://clang.llvm.org/docs/DiagnosticsReference.html
55    cflags: [
56        "-Wall",
57        "-Wdeprecated",
58        "-Werror",
59        "-Werror=implicit-fallthrough",
60        "-Werror=sometimes-uninitialized",
61        //"-Werror=conditional-uninitialized",
62        "-Wextra",
63        "-Wredundant-decls",
64        "-Wshadow",
65        "-Wstrict-aliasing",
66        "-fstrict-aliasing",
67        "-Wthread-safety",
68        //"-Wthread-safety-negative", // experimental - looks broken in R.
69        "-Wunreachable-code",
70        "-Wunreachable-code-break",
71        "-Wunreachable-code-return",
72        "-Wunused",
73        "-Wused-but-marked-unused",
74    ],
75    // https://clang.llvm.org/extra/clang-tidy/
76    tidy: true,
77    tidy_checks: tidy_errors,
78    tidy_checks_as_errors: tidy_errors,
79    tidy_flags: [
80      "-format-style='file'",
81      "--header-filter='frameworks/base/media/jni/soundpool'",
82    ],
83}
84
85cc_library_shared {
86    name: "libsoundpool",
87    defaults: [
88        "soundpool_flags_defaults",
89    ],
90
91    srcs: [
92        "android_media_SoundPool.cpp",
93        "Sound.cpp",
94        "SoundDecoder.cpp",
95        "SoundManager.cpp",
96        "SoundPool.cpp",
97        "Stream.cpp",
98        "StreamManager.cpp",
99    ],
100
101    header_libs: [
102        "libmedia_headers",
103        "libmediametrics_headers",
104    ],
105
106    shared_libs: [
107        "libaudioutils",
108        "liblog",
109        "libcutils",
110        "libutils",
111        "libandroid_runtime",
112        "libnativehelper",
113        "libaudioclient",
114        "libmediandk",
115        "libbinder",
116    ],
117
118    cflags: [
119        "-Wall",
120        "-Werror",
121        "-Wno-error=deprecated-declarations",
122        "-Wunused",
123        "-Wunreachable-code",
124    ],
125}
126