OSDN Git Service

Use -Werror and -Wno-error in external/openssh
authorChih-Hung Hsieh <chh@google.com>
Mon, 30 Oct 2017 17:57:15 +0000 (10:57 -0700)
committerChih-Hung Hsieh <chh@google.com>
Sat, 11 Nov 2017 02:44:13 +0000 (18:44 -0800)
* Suppress non-critical warnings.
* Keep other warnings to fix later.
* Some warnings cannot be suppressed so we added -Wno-error at the end.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I746ba8f7dc48232678af87749ef23789ee982aa7

Android.mk

index 2b59d0c..355f64c 100644 (file)
@@ -1,5 +1,26 @@
 LOCAL_PATH:= $(call my-dir)
 
+openssh_common_cflags := \
+    -Wall \
+    -Werror \
+    -Wno-error=implicit-function-declaration \
+    -Wno-pointer-sign \
+    -Wno-sign-compare \
+    -Wno-type-limits \
+    -Wno-unused-parameter \
+    -Wno-unused-variable \
+    -Wno-error \
+
+# Use -Wno-error to allow at least the following warnings:
+# (1) bsd-openpty.c calls to 'ptsname' declared with attribute warning:
+#     ptsname is not thread-safe; use ptsname_r instead [-Werror]
+# (2) external/boringssl/src/include/openssl/opensslfeatures.h:
+#     error: "OPENSSL_NO_BF" redefined [-Werror]
+
+openssh_common_clang_cflags := \
+    -Wno-incompatible-pointer-types \
+    -Wno-macro-redefined \
+
 ###################### libssh ######################
 include $(CLEAR_VARS)
 
@@ -123,7 +144,8 @@ LOCAL_SHARED_LIBRARIES += libssl libcrypto libdl libz
 
 LOCAL_MODULE := libssh
 
-LOCAL_CFLAGS+=-O3 -Wno-unused-parameter
+LOCAL_CFLAGS += -O3 $(openssh_common_cflags)
+LOCAL_CLANG_CFLAGS += $(openssh_common_clang_cflags)
 
 LOCAL_CFLAGS += -DGCE_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
 ifneq ($(filter gce_x86 gce_x86_64 calypso, $(TARGET_DEVICE)),)
@@ -149,7 +171,8 @@ LOCAL_SRC_FILES := \
 LOCAL_MODULE := ssh
 
 
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += $(openssh_common_cflags)
+LOCAL_CLANG_CFLAGS += $(openssh_common_clang_cflags)
 
 LOCAL_C_INCLUDES := \
     external/zlib \
@@ -171,7 +194,8 @@ LOCAL_SRC_FILES := \
 
 LOCAL_MODULE := sftp
 
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += $(openssh_common_cflags)
+LOCAL_CLANG_CFLAGS += $(openssh_common_clang_cflags)
 
 LOCAL_C_INCLUDES := \
     external/zlib \
@@ -193,7 +217,8 @@ LOCAL_SRC_FILES := \
 
 LOCAL_MODULE := scp
 
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += $(openssh_common_cflags)
+LOCAL_CLANG_CFLAGS += $(openssh_common_clang_cflags)
 
 LOCAL_C_INCLUDES := \
     external/zlib \
@@ -257,7 +282,8 @@ LOCAL_SRC_FILES := \
 
 LOCAL_MODULE := sshd
 
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += $(openssh_common_cflags)
+LOCAL_CLANG_CFLAGS += $(openssh_common_clang_cflags)
 ifneq ($(filter gce_x86 gce_x86_64 calypso, $(TARGET_DEVICE)),)
 LOCAL_CFLAGS += -DANDROID_GCE $(GCE_VERSION_CFLAGS)
 endif
@@ -282,7 +308,8 @@ LOCAL_SRC_FILES := \
 
 LOCAL_MODULE := ssh-keygen
 
-LOCAL_CFLAGS += -Wno-unused-parameter
+LOCAL_CFLAGS += $(openssh_common_cflags)
+LOCAL_CLANG_CFLAGS += $(openssh_common_clang_cflags)
 
 LOCAL_C_INCLUDES := \
     external/zlib \