From 3a9006e4ebf6ca1ad3b5fdcaeb9386edaba740c1 Mon Sep 17 00:00:00 2001 From: Buke Po Date: Wed, 7 Jun 2017 00:50:20 +0800 Subject: [PATCH] enable scan-build for all features (#1880) --- .travis/script.sh | 22 ++++++++++++++++++- src/core/meshcop/meshcop_tlvs.hpp | 8 +++++++ third_party/mbedtls/Makefile.am | 12 ++++++++++ .../patch/0002-Fix-warning-dead-store.patch | 14 ++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 third_party/mbedtls/patch/0002-Fix-warning-dead-store.patch diff --git a/.travis/script.sh b/.travis/script.sh index 9dbb84ac8..00cd39348 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -43,7 +43,27 @@ set -x [ $BUILD_TARGET != scan-build ] || { ./bootstrap || die - scan-build ./configure --with-examples=posix --enable-cli-app=all --enable-ncp-app=all --with-ncp-bus=uart || die + scan-build ./configure \ + --enable-cli-app=all \ + --enable-ncp-app=all \ + --with-ncp-bus=uart \ + --enable-diag \ + --enable-default-logging \ + --enable-raw-link-api=yes \ + --with-examples=posix \ + --with-platform-info=POSIX \ + --enable-application-coap \ + --enable-border-agent-proxy \ + --enable-cert-log \ + --enable-commissioner \ + --enable-dhcp6-client \ + --enable-dhcp6-server \ + --enable-dns-client \ + --enable-jam-detection \ + --enable-joiner \ + --enable-legacy \ + --enable-mac-whitelist \ + --enable-mtd-network-diagnostic || die scan-build --status-bugs -analyze-headers -v make || die } diff --git a/src/core/meshcop/meshcop_tlvs.hpp b/src/core/meshcop/meshcop_tlvs.hpp index 577c6c1bf..a49e52c0e 100644 --- a/src/core/meshcop/meshcop_tlvs.hpp +++ b/src/core/meshcop/meshcop_tlvs.hpp @@ -1804,6 +1804,14 @@ OT_TOOL_PACKED_BEGIN class VendorStackVersionTlv: public Tlv { public: + /** + * Default constructor. + * + */ + VendorStackVersionTlv(void) : + mBuildRevision(0), + mMinorMajor(0) {} + /** * This method initializes the TLV. * diff --git a/third_party/mbedtls/Makefile.am b/third_party/mbedtls/Makefile.am index eac98d9ce..b27d8324f 100644 --- a/third_party/mbedtls/Makefile.am +++ b/third_party/mbedtls/Makefile.am @@ -99,6 +99,7 @@ MBEDTLS_ABS_SRCDIR := $(abspath $(top_srcdir)/third_pa EXTRA_DIST += \ patch/0001-Fix-commissioning-problem-with-retransmissions.patch \ + patch/0002-Fix-warning-dead-store.patch \ $(NULL) repo/library/libmbedcrypto_a-ssl_tls.$(OBJEXT): $(MBEDTLS_SRCDIR)/library/ssl_tls.c.patched @@ -110,11 +111,22 @@ $(MBEDTLS_SRCDIR)/library/ssl_tls.c.patched: $(MBEDTLS_ABS_SRCDIR)/patch/0001-Fi patch $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_tls.c $< cp $(MBEDTLS_ABS_SRCDIR)/patch/0001-Fix-commissioning-problem-with-retransmissions.patch $@ +repo/library/libmbedcrypto_a-ssl_srv.$(OBJEXT): $(MBEDTLS_SRCDIR)/library/ssl_srv.c.patched + +$(MBEDTLS_SRCDIR)/library/ssl_srv.c.patched: $(MBEDTLS_ABS_SRCDIR)/patch/0002-Fix-warning-dead-store.patch + chmod u+w $(MBEDTLS_ABS_SRCDIR)/repo/library/ + chmod u+w $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_srv.c + if [ -e $@ ]; then patch -R $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_srv.c $@; fi + patch $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_srv.c $< + cp $(MBEDTLS_ABS_SRCDIR)/patch/0002-Fix-warning-dead-store.patch $@ + all-local: libmbedcrypto.a if [ -e $(MBEDTLS_SRCDIR)/library/ssl_tls.c.patched ]; then patch -R $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_tls.c $(MBEDTLS_ABS_SRCDIR)/patch/0001-Fix-commissioning-problem-with-retransmissions.patch; rm -f $(MBEDTLS_SRCDIR)/library/ssl_tls.c.patched; fi + if [ -e $(MBEDTLS_SRCDIR)/library/ssl_srv.c.patched ]; then patch -R $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_srv.c $(MBEDTLS_ABS_SRCDIR)/patch/0002-Fix-warning-dead-store.patch; rm -f $(MBEDTLS_SRCDIR)/library/ssl_srv.c.patched; fi clean-local: if [ -e $(MBEDTLS_SRCDIR)/library/ssl_tls.c.patched ]; then patch -R $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_tls.c $(MBEDTLS_ABS_SRCDIR)/patch/0001-Fix-commissioning-problem-with-retransmissions.patch; rm -f $(MBEDTLS_SRCDIR)/library/ssl_tls.c.patched; fi + if [ -e $(MBEDTLS_SRCDIR)/library/ssl_srv.c.patched ]; then patch -R $(MBEDTLS_ABS_SRCDIR)/repo/library/ssl_srv.c $(MBEDTLS_ABS_SRCDIR)/patch/0002-Fix-warning-dead-store.patch; rm -f $(MBEDTLS_SRCDIR)/library/ssl_srv.c.patched; fi endif # OPENTHREAD_ENABLE_DTLS diff --git a/third_party/mbedtls/patch/0002-Fix-warning-dead-store.patch b/third_party/mbedtls/patch/0002-Fix-warning-dead-store.patch new file mode 100644 index 000000000..1ac1ae37a --- /dev/null +++ b/third_party/mbedtls/patch/0002-Fix-warning-dead-store.patch @@ -0,0 +1,14 @@ +diff --git a/third_party/mbedtls/repo/library/ssl_srv.c b/third_party/mbedtls/repo/library/ssl_srv.c +index fc0d2d7b..fad54dd8 100644 +--- a/third_party/mbedtls/repo/library/ssl_srv.c ++++ b/third_party/mbedtls/repo/library/ssl_srv.c +@@ -3017,6 +3017,9 @@ curve_matching_done: + MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED || + MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */ + ++ // mask dead store of p ++ (void)p; ++ + ssl->out_msglen = 4 + n; + ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE; + ssl->out_msg[0] = MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE;