Use -Werror in frameworks/native/cmds
* Remove or comment out unused variables/functions.
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I15a463eb9a20bc12787c104f671063ceeafaa1cc
diff --git a/cmds/atrace/Android.bp b/cmds/atrace/Android.bp
index 5548699..e06f937 100644
--- a/cmds/atrace/Android.bp
+++ b/cmds/atrace/Android.bp
@@ -3,6 +3,10 @@
cc_binary {
name: "atrace",
srcs: ["atrace.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
shared_libs: [
"libbinder",
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index a07bfef..be2f1bc 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -216,8 +216,11 @@
static const char* k_traceBufferSizePath =
"buffer_size_kb";
+#if 0
+// TODO: Re-enable after stabilization
static const char* k_traceCmdlineSizePath =
"saved_cmdlines_size";
+#endif
static const char* k_tracingOverwriteEnablePath =
"options/overwrite";
@@ -240,9 +243,6 @@
static const char* k_funcgraphFlatPath =
"options/funcgraph-flat";
-static const char* k_funcgraphDurationPath =
- "options/funcgraph-duration";
-
static const char* k_ftraceFilterPath =
"set_ftrace_filter";
@@ -431,7 +431,6 @@
static bool setTraceBufferSizeKB(int size)
{
char str[32] = "1";
- int len;
if (size < 1) {
size = 1;
}
@@ -439,6 +438,8 @@
return writeStr(k_traceBufferSizePath, str);
}
+#if 0
+// TODO: Re-enable after stabilization
// Set the default size of cmdline hashtable
static bool setCmdlineSize()
{
@@ -447,6 +448,7 @@
}
return true;
}
+#endif
// Set the clock to the best available option while tracing. Use 'boot' if it's
// available; otherwise, use 'mono'. If neither are available use 'global'.
diff --git a/cmds/bugreport/Android.bp b/cmds/bugreport/Android.bp
index 139e4b2..24044a6 100644
--- a/cmds/bugreport/Android.bp
+++ b/cmds/bugreport/Android.bp
@@ -1,6 +1,6 @@
cc_binary {
name: "bugreport",
srcs: ["bugreport.cpp"],
- cflags: ["-Wall"],
+ cflags: ["-Wall", "-Werror"],
shared_libs: ["libcutils"],
}
diff --git a/cmds/dumpsys/tests/Android.bp b/cmds/dumpsys/tests/Android.bp
index 127e0f3..39fcb80 100644
--- a/cmds/dumpsys/tests/Android.bp
+++ b/cmds/dumpsys/tests/Android.bp
@@ -4,6 +4,7 @@
test_suites: ["device-tests"],
srcs: ["dumpsys_test.cpp"],
+ cflags: ["-Wall", "-Werror"],
shared_libs: [
"libbase",
diff --git a/cmds/installd/tests/Android.bp b/cmds/installd/tests/Android.bp
index 630c1f3..c6ebb24 100644
--- a/cmds/installd/tests/Android.bp
+++ b/cmds/installd/tests/Android.bp
@@ -3,6 +3,7 @@
name: "installd_utils_test",
clang: true,
srcs: ["installd_utils_test.cpp"],
+ cflags: ["-Wall", "-Werror"],
shared_libs: [
"libbase",
"liblog",
@@ -19,6 +20,7 @@
name: "installd_cache_test",
clang: true,
srcs: ["installd_cache_test.cpp"],
+ cflags: ["-Wall", "-Werror"],
shared_libs: [
"libbase",
"libbinder",
@@ -38,6 +40,7 @@
name: "installd_service_test",
clang: true,
srcs: ["installd_service_test.cpp"],
+ cflags: ["-Wall", "-Werror"],
shared_libs: [
"libbase",
"libbinder",
diff --git a/cmds/lshal/Android.bp b/cmds/lshal/Android.bp
index 6cbe7e2..409c206 100644
--- a/cmds/lshal/Android.bp
+++ b/cmds/lshal/Android.bp
@@ -34,6 +34,10 @@
"TextTable.cpp",
"utils.cpp",
],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
}
cc_defaults {
@@ -44,7 +48,8 @@
"libhidltransport",
"liblshal",
"libutils",
- ]
+ ],
+ cflags: ["-Wall", "-Werror"],
}
cc_binary {
diff --git a/cmds/lshal/Lshal.h b/cmds/lshal/Lshal.h
index 9f8eeaa..690f30e 100644
--- a/cmds/lshal/Lshal.h
+++ b/cmds/lshal/Lshal.h
@@ -62,7 +62,6 @@
Status parseArgs(const Arg &arg);
std::string mCommand;
- Arg mCmdArgs;
NullableOStream<std::ostream> mOut;
NullableOStream<std::ostream> mErr;
diff --git a/cmds/lshal/PipeRelay.cpp b/cmds/lshal/PipeRelay.cpp
index 54d19f6..fc40749 100644
--- a/cmds/lshal/PipeRelay.cpp
+++ b/cmds/lshal/PipeRelay.cpp
@@ -57,8 +57,7 @@
////////////////////////////////////////////////////////////////////////////////
PipeRelay::PipeRelay(std::ostream &os)
- : mOutStream(os),
- mInitCheck(NO_INIT) {
+ : mInitCheck(NO_INIT) {
int res = socketpair(AF_UNIX, SOCK_STREAM, 0 /* protocol */, mFds);
if (res < 0) {
diff --git a/cmds/lshal/PipeRelay.h b/cmds/lshal/PipeRelay.h
index 76b2b23..8dc3093 100644
--- a/cmds/lshal/PipeRelay.h
+++ b/cmds/lshal/PipeRelay.h
@@ -42,7 +42,6 @@
private:
struct RelayThread;
- std::ostream &mOutStream;
status_t mInitCheck;
int mFds[2];
sp<RelayThread> mThread;
diff --git a/cmds/service/Android.bp b/cmds/service/Android.bp
index b703ed4..9513ec1 100644
--- a/cmds/service/Android.bp
+++ b/cmds/service/Android.bp
@@ -8,7 +8,11 @@
"libbinder",
],
- cflags: ["-DXP_UNIX"],
+ cflags: [
+ "-DXP_UNIX",
+ "-Wall",
+ "-Werror",
+ ],
}
cc_binary {
@@ -22,5 +26,10 @@
"libbinder",
],
- cflags: ["-DXP_UNIX", "-DVENDORSERVICES"],
+ cflags: [
+ "-DXP_UNIX",
+ "-DVENDORSERVICES",
+ "-Wall",
+ "-Werror",
+ ],
}