OSDN Git Service

Eliminate warnings, add -Wall and -Werror to all projects.
authorSharvil Nanavati <sharvil@google.com>
Fri, 18 Apr 2014 05:32:05 +0000 (22:32 -0700)
committerSharvil Nanavati <sharvil@google.com>
Fri, 18 Apr 2014 05:43:41 +0000 (05:43 +0000)
This change enables all warnings and treats warnings as errors. As
a result, nobody should be able to submit new code to bluedroid
that contains compiler warnings. Instead, they should fix the warnings
before submitting.

This change has already caught a type mismatch bug in
stack/avrc/avrc_api.c where an integer was being stored in a boolean.

Change-Id: Ic41960754b39a1a6aa37f1c1095003195f466183

Android.mk
gki/Android.mk
stack/avrc/avrc_api.c
test/bluedroidtest/bluedroidtest.c
utils/Android.mk

index 5f2d274..f0f6970 100644 (file)
@@ -9,6 +9,8 @@ else
   bdroid_CFLAGS := -DHAS_NO_BDROID_BUILDCFG
 endif
 
+bdroid_CFLAGS += -Wall -Werror
+
 include $(call all-subdir-makefiles)
 
 # Cleanup our locals
index 4520e45..ec4546a 100644 (file)
@@ -11,7 +11,7 @@ LOCAL_C_INCLUDES:= $(LOCAL_PATH)/common \
                    $(LOCAL_PATH)/../utils/include \
                    $(bdroid_C_INCLUDES) \
 
-LOCAL_CFLAGS += -Werror -Wno-error=unused-parameter $(bdroid_CFLAGS) -std=c99
+LOCAL_CFLAGS += -Wno-error=unused-parameter $(bdroid_CFLAGS) -std=c99
 
 ifeq ($(BOARD_HAVE_BLUETOOTH_BCM),true)
 LOCAL_CFLAGS += \
index c572f94..09f167a 100644 (file)
@@ -528,7 +528,7 @@ static void avrc_msg_cback(UINT8 handle, UINT8 label, UINT8 cr,
     tAVRC_MSG   msg;
     UINT8       *p_data;
     UINT8       *p_begin;
-    BOOLEAN     drop = FALSE;
+    UINT8       drop = 0;
     BOOLEAN     free = TRUE;
     BT_HDR      *p_rsp = NULL;
     UINT8       *p_rsp_data;
index 2b517df..8ec0e1e 100644 (file)
@@ -58,6 +58,8 @@
 
 #define CASE_RETURN_STR(const) case const: return #const;
 
+#define UNUSED __attribute__((unused))
+
 /************************************************************************************
 **  Local type definitions
 ************************************************************************************/
@@ -469,7 +471,7 @@ static void adapter_state_changed(bt_state_t state)
     }
 }
 
-static void dut_mode_recv(uint16_t opcode, uint8_t *buf, uint8_t len)
+static void dut_mode_recv(uint16_t UNUSED opcode, uint8_t UNUSED *buf, uint8_t UNUSED len)
 {
     bdt_log("DUT MODE RECV : NOT IMPLEMENTED");
 }
@@ -611,7 +613,7 @@ void bdt_cleanup(void)
  ** Console commands
  *******************************************************************************/
 
-void do_help(char *p)
+void do_help(char UNUSED *p)
 {
     int i = 0;
     int max = 0;
@@ -626,7 +628,7 @@ void do_help(char *p)
     }
 }
 
-void do_quit(char *p)
+void do_quit(char UNUSED *p)
 {
     bdt_shutdown();
 }
@@ -639,17 +641,17 @@ void do_quit(char *p)
  *
 */
 
-void do_init(char *p)
+void do_init(char UNUSED *p)
 {
     bdt_init();
 }
 
-void do_enable(char *p)
+void do_enable(char UNUSED *p)
 {
     bdt_enable();
 }
 
-void do_disable(char *p)
+void do_disable(char UNUSED *p)
 {
     bdt_disable();
 }
@@ -663,7 +665,7 @@ void do_le_test_mode(char *p)
     bdt_le_test_mode(p);
 }
 
-void do_cleanup(char *p)
+void do_cleanup(char UNUSED *p)
 {
     bdt_cleanup();
 }
@@ -731,7 +733,7 @@ static void process_cmd(char *p, unsigned char is_job)
     do_help(NULL);
 }
 
-int main (int argc, char * argv[])
+int main (int UNUSED argc, char UNUSED *argv[])
 {
     int opt;
     char cmd[128];
index 4589e5c..d0327e9 100644 (file)
@@ -6,7 +6,7 @@ LOCAL_C_INCLUDES:= $(LOCAL_PATH)/include \
                    $(LOCAL_PATH)/../gki/ulinux \
                    $(bdroid_C_INCLUDES)
 
-LOCAL_CFLAGS += -Werror $(bdroid_CFLAGS) -std=c99
+LOCAL_CFLAGS += $(bdroid_CFLAGS) -std=c99
 
 LOCAL_PRELINK_MODULE:=false
 LOCAL_SRC_FILES:= \