From 4c5cc17e9d5b62ba87b86feee55817299505e4e1 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Wed, 3 Jul 2019 20:38:16 -0700 Subject: [PATCH 1/5] Clean up trivial gcc -wextra warnings After verifying that they really were spurious, clean up the warnings that gcc -wextra reports, except for LeaMDNS. --- cores/esp8266/libb64/cdecode.cpp | 3 +++ cores/esp8266/libb64/cencode.cpp | 2 ++ libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp | 1 + libraries/ESP8266SdFat | 2 +- tests/host/common/include/ClientContext.h | 3 +++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/libb64/cdecode.cpp b/cores/esp8266/libb64/cdecode.cpp index fcd6f0401a..cc03c08231 100755 --- a/cores/esp8266/libb64/cdecode.cpp +++ b/cores/esp8266/libb64/cdecode.cpp @@ -43,6 +43,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in fragment = (int8_t)base64_decode_value_signed(*codechar++); } while (fragment < 0); *plainchar = (fragment & 0x03f) << 2; + __attribute__ ((fallthrough)); case step_b: do { if (codechar == code_in+length_in){ @@ -54,6 +55,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in } while (fragment < 0); *plainchar++ |= (fragment & 0x030) >> 4; *plainchar = (fragment & 0x00f) << 4; + __attribute__ ((fallthrough)); case step_c: do { if (codechar == code_in+length_in){ @@ -65,6 +67,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in } while (fragment < 0); *plainchar++ |= (fragment & 0x03c) >> 2; *plainchar = (fragment & 0x003) << 6; + __attribute__ ((fallthrough)); case step_d: do { if (codechar == code_in+length_in){ diff --git a/cores/esp8266/libb64/cencode.cpp b/cores/esp8266/libb64/cencode.cpp index 69272faeca..3a90520a9e 100755 --- a/cores/esp8266/libb64/cencode.cpp +++ b/cores/esp8266/libb64/cencode.cpp @@ -50,6 +50,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, result = (fragment & 0x0fc) >> 2; *codechar++ = base64_encode_value(result); result = (fragment & 0x003) << 4; + __attribute__ ((fallthrough)); case step_B: if (plainchar == plaintextend){ state_in->result = result; @@ -60,6 +61,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, result |= (fragment & 0x0f0) >> 4; *codechar++ = base64_encode_value(result); result = (fragment & 0x00f) << 2; + __attribute__ ((fallthrough)); case step_C: if (plainchar == plaintextend){ state_in->result = result; diff --git a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp index 187c917530..e9c208cfe1 100644 --- a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp +++ b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp @@ -110,6 +110,7 @@ AVRISPState_t ESP8266AVRISP::serve() { case AVRISP_STATE_PENDING: { _state = AVRISP_STATE_ACTIVE; // fallthrough + __attribute__ ((fallthrough)); } case AVRISP_STATE_ACTIVE: { while (_client.available()) { diff --git a/libraries/ESP8266SdFat b/libraries/ESP8266SdFat index 2499d4e0c6..6326c71ff1 160000 --- a/libraries/ESP8266SdFat +++ b/libraries/ESP8266SdFat @@ -1 +1 @@ -Subproject commit 2499d4e0c60db1a67a47532fc44c17d2d5116e4c +Subproject commit 6326c71ff1f6294756b6e348edaf723bfe7be3e7 diff --git a/tests/host/common/include/ClientContext.h b/tests/host/common/include/ClientContext.h index f9e4a9e3d5..31366ac0dd 100644 --- a/tests/host/common/include/ClientContext.h +++ b/tests/host/common/include/ClientContext.h @@ -258,6 +258,9 @@ class ClientContext void keepAlive (uint16_t idle_sec = TCP_DEFAULT_KEEPALIVE_IDLE_SEC, uint16_t intv_sec = TCP_DEFAULT_KEEPALIVE_INTERVAL_SEC, uint8_t count = TCP_DEFAULT_KEEPALIVE_COUNT) { + (void) idle_sec; + (void) intv_sec; + (void) count; mockverbose("TODO ClientContext::keepAlive()\n"); } From a65ac94188d736ddca2e6076d098cf6ebd793a95 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 4 Jul 2019 16:21:18 -0700 Subject: [PATCH 2/5] Use fall through comment to support gcc<7 --- cores/esp8266/libb64/cdecode.cpp | 6 +++--- cores/esp8266/libb64/cencode.cpp | 4 ++-- libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp | 3 +-- libraries/ESP8266SdFat | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cores/esp8266/libb64/cdecode.cpp b/cores/esp8266/libb64/cdecode.cpp index cc03c08231..b7a99e451e 100755 --- a/cores/esp8266/libb64/cdecode.cpp +++ b/cores/esp8266/libb64/cdecode.cpp @@ -43,7 +43,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in fragment = (int8_t)base64_decode_value_signed(*codechar++); } while (fragment < 0); *plainchar = (fragment & 0x03f) << 2; - __attribute__ ((fallthrough)); + // fall through case step_b: do { if (codechar == code_in+length_in){ @@ -55,7 +55,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in } while (fragment < 0); *plainchar++ |= (fragment & 0x030) >> 4; *plainchar = (fragment & 0x00f) << 4; - __attribute__ ((fallthrough)); + // fall through case step_c: do { if (codechar == code_in+length_in){ @@ -67,7 +67,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in } while (fragment < 0); *plainchar++ |= (fragment & 0x03c) >> 2; *plainchar = (fragment & 0x003) << 6; - __attribute__ ((fallthrough)); + // fall through case step_d: do { if (codechar == code_in+length_in){ diff --git a/cores/esp8266/libb64/cencode.cpp b/cores/esp8266/libb64/cencode.cpp index 3a90520a9e..57aaea5779 100755 --- a/cores/esp8266/libb64/cencode.cpp +++ b/cores/esp8266/libb64/cencode.cpp @@ -50,7 +50,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, result = (fragment & 0x0fc) >> 2; *codechar++ = base64_encode_value(result); result = (fragment & 0x003) << 4; - __attribute__ ((fallthrough)); + // fall through case step_B: if (plainchar == plaintextend){ state_in->result = result; @@ -61,7 +61,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, result |= (fragment & 0x0f0) >> 4; *codechar++ = base64_encode_value(result); result = (fragment & 0x00f) << 2; - __attribute__ ((fallthrough)); + // fall through case step_C: if (plainchar == plaintextend){ state_in->result = result; diff --git a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp index e9c208cfe1..2f7ed09ed5 100644 --- a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp +++ b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp @@ -109,8 +109,7 @@ AVRISPState_t ESP8266AVRISP::serve() { break; case AVRISP_STATE_PENDING: { _state = AVRISP_STATE_ACTIVE; - // fallthrough - __attribute__ ((fallthrough)); + // fall through } case AVRISP_STATE_ACTIVE: { while (_client.available()) { diff --git a/libraries/ESP8266SdFat b/libraries/ESP8266SdFat index 6326c71ff1..2499d4e0c6 160000 --- a/libraries/ESP8266SdFat +++ b/libraries/ESP8266SdFat @@ -1 +1 @@ -Subproject commit 6326c71ff1f6294756b6e348edaf723bfe7be3e7 +Subproject commit 2499d4e0c60db1a67a47532fc44c17d2d5116e4c From 8d2360e99021bdd395ae4a1a697c69723b66c2eb Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 4 Jul 2019 16:35:23 -0700 Subject: [PATCH 3/5] One more try to make fall thru compat w/gcc 4~9 --- cores/esp8266/libb64/cdecode.cpp | 6 +++--- cores/esp8266/libb64/cencode.cpp | 4 ++-- libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp | 5 ++--- libraries/ESP8266SdFat | 2 +- tests/host/Makefile | 1 + tests/host/common/UdpContextSocket.cpp | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cores/esp8266/libb64/cdecode.cpp b/cores/esp8266/libb64/cdecode.cpp index b7a99e451e..47c5919dea 100755 --- a/cores/esp8266/libb64/cdecode.cpp +++ b/cores/esp8266/libb64/cdecode.cpp @@ -43,7 +43,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in fragment = (int8_t)base64_decode_value_signed(*codechar++); } while (fragment < 0); *plainchar = (fragment & 0x03f) << 2; - // fall through + // falls through case step_b: do { if (codechar == code_in+length_in){ @@ -55,7 +55,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in } while (fragment < 0); *plainchar++ |= (fragment & 0x030) >> 4; *plainchar = (fragment & 0x00f) << 4; - // fall through + // falls through case step_c: do { if (codechar == code_in+length_in){ @@ -67,7 +67,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in } while (fragment < 0); *plainchar++ |= (fragment & 0x03c) >> 2; *plainchar = (fragment & 0x003) << 6; - // fall through + // falls through case step_d: do { if (codechar == code_in+length_in){ diff --git a/cores/esp8266/libb64/cencode.cpp b/cores/esp8266/libb64/cencode.cpp index 57aaea5779..ae8f90a831 100755 --- a/cores/esp8266/libb64/cencode.cpp +++ b/cores/esp8266/libb64/cencode.cpp @@ -50,7 +50,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, result = (fragment & 0x0fc) >> 2; *codechar++ = base64_encode_value(result); result = (fragment & 0x003) << 4; - // fall through + // falls through case step_B: if (plainchar == plaintextend){ state_in->result = result; @@ -61,7 +61,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, result |= (fragment & 0x0f0) >> 4; *codechar++ = base64_encode_value(result); result = (fragment & 0x00f) << 2; - // fall through + // falls through case step_C: if (plainchar == plaintextend){ state_in->result = result; diff --git a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp index 2f7ed09ed5..0c8aa8451d 100644 --- a/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp +++ b/libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp @@ -107,10 +107,9 @@ AVRISPState_t ESP8266AVRISP::serve() { case AVRISP_STATE_IDLE: // should not be called when idle, error? break; - case AVRISP_STATE_PENDING: { + case AVRISP_STATE_PENDING: _state = AVRISP_STATE_ACTIVE; - // fall through - } + // falls through case AVRISP_STATE_ACTIVE: { while (_client.available()) { avrisp(); diff --git a/libraries/ESP8266SdFat b/libraries/ESP8266SdFat index 2499d4e0c6..6326c71ff1 160000 --- a/libraries/ESP8266SdFat +++ b/libraries/ESP8266SdFat @@ -1 +1 @@ -Subproject commit 2499d4e0c60db1a67a47532fc44c17d2d5116e4c +Subproject commit 6326c71ff1f6294756b6e348edaf723bfe7be3e7 diff --git a/tests/host/Makefile b/tests/host/Makefile index fd506d3574..6bd73ea61e 100644 --- a/tests/host/Makefile +++ b/tests/host/Makefile @@ -153,6 +153,7 @@ FLAGS += -DLWIP_IPV6=0 FLAGS += -DHOST_MOCK=1 FLAGS += -DNONOSDK221=1 FLAGS += $(MKFLAGS) +FLAGS += -Wimplicit-fallthrough=2 # allow "// fall through" comments to stop spurious warnings CXXFLAGS += -std=c++11 -fno-rtti $(FLAGS) -funsigned-char CFLAGS += -std=c99 $(FLAGS) -funsigned-char LDFLAGS += -coverage $(OPTZ) -g $(M32) diff --git a/tests/host/common/UdpContextSocket.cpp b/tests/host/common/UdpContextSocket.cpp index 13c9b2d31c..347c760d80 100644 --- a/tests/host/common/UdpContextSocket.cpp +++ b/tests/host/common/UdpContextSocket.cpp @@ -155,6 +155,7 @@ size_t mockUDPFillInBuf (int sock, char* ccinbuf, size_t& ccinbufsize, uint8_t& size_t mockUDPPeekBytes (int sock, char* dst, size_t usersize, int timeout_ms, char* ccinbuf, size_t& ccinbufsize) { (void) sock; + (void) timeout_ms; if (usersize > CCBUFSIZE) fprintf(stderr, MOCK "CCBUFSIZE(%d) should be increased by %zd bytes (-> %zd)\n", CCBUFSIZE, usersize - CCBUFSIZE, usersize); From 61b0f63eeec96aabe20e8860d877b552b7f7ed96 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 5 Jul 2019 21:34:41 -0700 Subject: [PATCH 4/5] Upgrade GCC to gcc-7 for host builds --- .travis.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.travis.yml b/.travis.yml index 498739f1cc..e3e701d5b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,56 @@ git: depth: 1 submodules: false +# From https://docs.travis-ci.com/user/languages/cpp/ - to get less ancient GCC/G++ +matrix: + include: + # works on Precise and Trusty + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.9 + env: + - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + + # works on Precise and Trusty + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + env: + - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" + + # works on Precise and Trusty + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 + env: + - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" + + # works on Precise and Trusty + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + env: + - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" + before_install: - git submodule update --init # no recursive update + - eval "${MATRIX_EVAL}" cache: directories: From 71533b1f812e2f25f24e7ec0e38f7b365abdf36f Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 5 Jul 2019 21:43:01 -0700 Subject: [PATCH 5/5] Another try at Travis... --- .travis.yml | 56 +++++++++-------------------------------------------- 1 file changed, 9 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3e701d5b6..36bab4ecf1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,56 +6,16 @@ git: depth: 1 submodules: false -# From https://docs.travis-ci.com/user/languages/cpp/ - to get less ancient GCC/G++ -matrix: - include: - # works on Precise and Trusty - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.9 - env: - - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" - - # works on Precise and Trusty - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-5 - env: - - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" - - # works on Precise and Trusty - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 - env: - - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" - - # works on Precise and Trusty - - os: linux - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-7 - env: - - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + - gcc-7 before_install: - git submodule update --init # no recursive update - - eval "${MATRIX_EVAL}" cache: directories: @@ -128,6 +88,7 @@ jobs: stage: build script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh install: sudo apt-get install valgrind lcov + env: CC=gcc-7 CXX=g++-7 - name: "Docs" stage: build @@ -144,6 +105,7 @@ jobs: - name: "Mock trivial test" stage: build script: $TRAVIS_BUILD_DIR/tests/buildm.sh + env: CC=gcc-7 CXX=g++-7 - name: "Boards" stage: build