From c7f344e9a9070c748bc885a5e60edbd256ffffd5 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 26 Oct 2017 11:19:43 -0700 Subject: [PATCH] Use -Werror in system/core/libpixelflinger * Remove unused local variables. * Suppress/fix warning of unused functions, conditionally used variables. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: If92bc79f15a0486364da0389defbb2d43b3bd6ea --- libpixelflinger/Android.mk | 2 ++ libpixelflinger/codeflinger/Arm64Assembler.cpp | 6 +++--- libpixelflinger/codeflinger/GGLAssembler.cpp | 3 --- libpixelflinger/codeflinger/load_store.cpp | 1 - libpixelflinger/codeflinger/texturing.cpp | 11 +---------- .../include/private/pixelflinger/ggl_fixed.h | 1 - libpixelflinger/raster.cpp | 1 - libpixelflinger/scanline.cpp | 1 - libpixelflinger/tests/arch-arm64/assembler/Android.mk | 2 ++ .../tests/arch-arm64/col32cb16blend/Android.mk | 2 ++ .../tests/arch-arm64/disassembler/Android.mk | 2 ++ .../tests/arch-arm64/t32cb16blend/Android.mk | 2 ++ libpixelflinger/tests/codegen/Android.mk | 2 ++ libpixelflinger/tests/codegen/codegen.cpp | 10 ++++++---- libpixelflinger/tests/gglmul/Android.mk | 2 ++ libpixelflinger/trap.cpp | 2 -- 16 files changed, 24 insertions(+), 26 deletions(-) diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk index 55891db99..c7306cd5e 100644 --- a/libpixelflinger/Android.mk +++ b/libpixelflinger/Android.mk @@ -25,6 +25,8 @@ PIXELFLINGER_SRC_FILES:= \ buffer.cpp PIXELFLINGER_CFLAGS := -fstrict-aliasing -fomit-frame-pointer +PIXELFLINGER_CFLAGS += -Wall -Werror +PIXELFLINGER_CFLAGS += -Wno-unused-function PIXELFLINGER_SRC_FILES_arm := \ codeflinger/ARMAssembler.cpp \ diff --git a/libpixelflinger/codeflinger/Arm64Assembler.cpp b/libpixelflinger/codeflinger/Arm64Assembler.cpp index bff87bbac..aebc129bf 100644 --- a/libpixelflinger/codeflinger/Arm64Assembler.cpp +++ b/libpixelflinger/codeflinger/Arm64Assembler.cpp @@ -151,11 +151,11 @@ namespace android { -static const char* shift_codes[] = +static __unused const char* shift_codes[] = { "LSL", "LSR", "ASR", "ROR" }; -static const char *cc_codes[] = +static __unused const char *cc_codes[] = { "EQ", "NE", "CS", "CC", "MI", "PL", "VS", "VC", "HI", "LS", @@ -984,7 +984,7 @@ uint32_t ArmToArm64Assembler::reg_post(int /*Rm*/) // A64 instructions // ---------------------------------------------------------------------------- -static const char * dataTransferOpName[] = +static __unused const char * dataTransferOpName[] = { "LDR","LDRB","LDRH","STR","STRB","STRH" }; diff --git a/libpixelflinger/codeflinger/GGLAssembler.cpp b/libpixelflinger/codeflinger/GGLAssembler.cpp index 91fbd53cf..04e285d1b 100644 --- a/libpixelflinger/codeflinger/GGLAssembler.cpp +++ b/libpixelflinger/codeflinger/GGLAssembler.cpp @@ -94,8 +94,6 @@ int GGLAssembler::scanline(const needs_t& needs, context_t const* c) int GGLAssembler::scanline_core(const needs_t& needs, context_t const* c) { - int64_t duration = ggl_system_time(); - mBlendFactorCached = 0; mBlending = 0; mMasking = 0; @@ -353,7 +351,6 @@ void GGLAssembler::build_scanline_prolog( fragment_parts_t& parts, const needs_t& needs) { Scratch scratches(registerFile()); - int Rctx = mBuilderContext.Rctx; // compute count comment("compute ct (# of pixels to process)"); diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp index da21e1d97..4db0a4948 100644 --- a/libpixelflinger/codeflinger/load_store.cpp +++ b/libpixelflinger/codeflinger/load_store.cpp @@ -232,7 +232,6 @@ void GGLAssembler::expand(integer_t& dst, const integer_t& src, int dbits) void GGLAssembler::downshift( pixel_t& d, int component, component_t s, const reg_t& dither) { - const needs_t& needs = mBuilderContext.needs; Scratch scratches(registerFile()); int sh = s.h; diff --git a/libpixelflinger/codeflinger/texturing.cpp b/libpixelflinger/codeflinger/texturing.cpp index 4c357af83..e6997bd4b 100644 --- a/libpixelflinger/codeflinger/texturing.cpp +++ b/libpixelflinger/codeflinger/texturing.cpp @@ -41,7 +41,6 @@ namespace android { void GGLAssembler::init_iterated_color(fragment_parts_t& parts, const reg_t& x) { context_t const* c = mBuilderContext.c; - const needs_t& needs = mBuilderContext.needs; if (mSmooth) { // NOTE: we could take this case in the mDithering + !mSmooth case, @@ -324,9 +323,7 @@ void GGLAssembler::init_textures( tex_coord_t* coords, const reg_t& x, const reg_t& y) { - context_t const* c = mBuilderContext.c; const needs_t& needs = mBuilderContext.needs; - int Rctx = mBuilderContext.Rctx; int Rx = x.reg; int Ry = y.reg; @@ -402,10 +399,6 @@ void GGLAssembler::init_textures( void GGLAssembler::build_textures( fragment_parts_t& parts, Scratch& regs) { - context_t const* c = mBuilderContext.c; - const needs_t& needs = mBuilderContext.needs; - int Rctx = mBuilderContext.Rctx; - // We don't have a way to spill registers automatically // spill depth and AA regs, when we know we may have to. // build the spill list... @@ -434,7 +427,6 @@ void GGLAssembler::build_textures( fragment_parts_t& parts, Spill spill(registerFile(), *this, spill_list); - const bool multiTexture = mTextureMachine.activeUnits > 1; for (int i=0 ; i 1; for (int i=0 ; istate.buffers.color.s; c->procs.activeTexture(c, tmu); c->procs.disable(c, GGL_W_LERP); diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp index c6cf5bffe..4cc23c773 100644 --- a/libpixelflinger/scanline.cpp +++ b/libpixelflinger/scanline.cpp @@ -2144,7 +2144,6 @@ void scanline_t32cb16(context_t* c) const int32_t u = (c->state.texture[0].shade.is0>>16) + x; const int32_t v = (c->state.texture[0].shade.it0>>16) + y; uint32_t *src = reinterpret_cast(tex->data)+(u+(tex->stride*v)); - int sR, sG, sB; uint32_t s, d; if (ct==1 || uintptr_t(dst)&2) { diff --git a/libpixelflinger/tests/arch-arm64/assembler/Android.mk b/libpixelflinger/tests/arch-arm64/assembler/Android.mk index bd0f24b3e..db5dc4df9 100644 --- a/libpixelflinger/tests/arch-arm64/assembler/Android.mk +++ b/libpixelflinger/tests/arch-arm64/assembler/Android.mk @@ -14,6 +14,8 @@ LOCAL_C_INCLUDES := \ LOCAL_MODULE:= test-pixelflinger-arm64-assembler-test +LOCAL_CFLAGS := -Wall -Werror + LOCAL_MODULE_TAGS := tests LOCAL_MULTILIB := 64 diff --git a/libpixelflinger/tests/arch-arm64/col32cb16blend/Android.mk b/libpixelflinger/tests/arch-arm64/col32cb16blend/Android.mk index 3368eb017..3096232b8 100644 --- a/libpixelflinger/tests/arch-arm64/col32cb16blend/Android.mk +++ b/libpixelflinger/tests/arch-arm64/col32cb16blend/Android.mk @@ -11,6 +11,8 @@ LOCAL_C_INCLUDES := LOCAL_MODULE:= test-pixelflinger-arm64-col32cb16blend +LOCAL_CFLAGS := -Wall -Werror + LOCAL_MODULE_TAGS := tests LOCAL_MULTILIB := 64 diff --git a/libpixelflinger/tests/arch-arm64/disassembler/Android.mk b/libpixelflinger/tests/arch-arm64/disassembler/Android.mk index d8f7e699f..78f12af9d 100644 --- a/libpixelflinger/tests/arch-arm64/disassembler/Android.mk +++ b/libpixelflinger/tests/arch-arm64/disassembler/Android.mk @@ -9,6 +9,8 @@ LOCAL_SHARED_LIBRARIES := LOCAL_MODULE:= test-pixelflinger-arm64-disassembler-test +LOCAL_CFLAGS := -Wall -Werror + LOCAL_MODULE_TAGS := tests LOCAL_MULTILIB := 64 diff --git a/libpixelflinger/tests/arch-arm64/t32cb16blend/Android.mk b/libpixelflinger/tests/arch-arm64/t32cb16blend/Android.mk index 8e5ec5e01..664347f50 100644 --- a/libpixelflinger/tests/arch-arm64/t32cb16blend/Android.mk +++ b/libpixelflinger/tests/arch-arm64/t32cb16blend/Android.mk @@ -11,6 +11,8 @@ LOCAL_C_INCLUDES := LOCAL_MODULE:= test-pixelflinger-arm64-t32cb16blend +LOCAL_CFLAGS := -Wall -Werror + LOCAL_MODULE_TAGS := tests LOCAL_MULTILIB := 64 diff --git a/libpixelflinger/tests/codegen/Android.mk b/libpixelflinger/tests/codegen/Android.mk index 2f9ca2f9a..72d71efd3 100644 --- a/libpixelflinger/tests/codegen/Android.mk +++ b/libpixelflinger/tests/codegen/Android.mk @@ -13,6 +13,8 @@ LOCAL_C_INCLUDES := \ LOCAL_MODULE:= test-opengl-codegen +LOCAL_CFLAGS:= -Wall -Werror + LOCAL_MODULE_TAGS := tests include $(BUILD_NATIVE_TEST) diff --git a/libpixelflinger/tests/codegen/codegen.cpp b/libpixelflinger/tests/codegen/codegen.cpp index efa6d87bf..dce4ed72c 100644 --- a/libpixelflinger/tests/codegen/codegen.cpp +++ b/libpixelflinger/tests/codegen/codegen.cpp @@ -40,9 +40,9 @@ public: const AssemblyKey& key() const { return mKey; } }; +#if ANDROID_ARM_CODEGEN static void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1) { -#if ANDROID_ARM_CODEGEN GGLContext* c; gglInit(&c); needs_t needs; @@ -73,10 +73,12 @@ static void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1) printf("error %08x (%s)\n", err, strerror(-err)); } gglUninit(c); -#else - printf("This test runs only on ARM, Arm64 or MIPS\n"); -#endif } +#else +static void ggl_test_codegen(uint32_t, uint32_t, uint32_t, uint32_t) { + printf("This test runs only on ARM, Arm64 or MIPS\n"); +} +#endif int main(int argc, char** argv) { diff --git a/libpixelflinger/tests/gglmul/Android.mk b/libpixelflinger/tests/gglmul/Android.mk index 75bd39ef5..67f358fc5 100644 --- a/libpixelflinger/tests/gglmul/Android.mk +++ b/libpixelflinger/tests/gglmul/Android.mk @@ -11,6 +11,8 @@ LOCAL_C_INCLUDES := \ LOCAL_MODULE:= test-pixelflinger-gglmul +LOCAL_CFLAGS:= -Wall -Werror + LOCAL_MODULE_TAGS := tests include $(BUILD_NATIVE_TEST) diff --git a/libpixelflinger/trap.cpp b/libpixelflinger/trap.cpp index 234bfdde1..06ad2373c 100644 --- a/libpixelflinger/trap.cpp +++ b/libpixelflinger/trap.cpp @@ -349,7 +349,6 @@ void linex_validate(void *con, const GGLcoord* v0, const GGLcoord* v1, GGLcoord static void linex(void *con, const GGLcoord* v0, const GGLcoord* v1, GGLcoord width) { - GGL_CONTEXT(c, con); GGLcoord v[4][2]; v[0][0] = v0[0]; v[0][1] = v0[1]; v[1][0] = v1[0]; v[1][1] = v1[1]; @@ -377,7 +376,6 @@ static void linex(void *con, const GGLcoord* v0, const GGLcoord* v1, GGLcoord wi static void aa_linex(void *con, const GGLcoord* v0, const GGLcoord* v1, GGLcoord width) { - GGL_CONTEXT(c, con); GGLcoord v[4][2]; v[0][0] = v0[0]; v[0][1] = v0[1]; v[1][0] = v1[0]; v[1][1] = v1[1];