Skip to content

Commit 6bd4b1c

Browse files
Clean up trivial gcc -wextra warnings (#6254)
After verifying that they really were spurious, clean up the warnings that gcc -wextra reports, except for LeaMDNS. Upgrade GCC to gcc-7 for host builds
1 parent 8b1af68 commit 6bd4b1c

File tree

8 files changed

+23
-4
lines changed

8 files changed

+23
-4
lines changed

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ git:
66
depth: 1
77
submodules: false
88

9+
addons:
10+
apt:
11+
sources:
12+
- ubuntu-toolchain-r-test
13+
packages:
14+
- g++-7
15+
- gcc-7
16+
917
before_install:
1018
- git submodule update --init # no recursive update
1119

@@ -80,6 +88,7 @@ jobs:
8088
stage: build
8189
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
8290
install: sudo apt-get install valgrind lcov
91+
env: CC=gcc-7 CXX=g++-7
8392

8493
- name: "Docs"
8594
stage: build
@@ -96,6 +105,7 @@ jobs:
96105
- name: "Mock trivial test"
97106
stage: build
98107
script: $TRAVIS_BUILD_DIR/tests/buildm.sh
108+
env: CC=gcc-7 CXX=g++-7
99109

100110
- name: "Boards"
101111
stage: build

cores/esp8266/libb64/cdecode.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static int base64_decode_block_signed(const int8_t* code_in, const int length_in
4343
fragment = (int8_t)base64_decode_value_signed(*codechar++);
4444
} while (fragment < 0);
4545
*plainchar = (fragment & 0x03f) << 2;
46+
// falls through
4647
case step_b:
4748
do {
4849
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
5455
} while (fragment < 0);
5556
*plainchar++ |= (fragment & 0x030) >> 4;
5657
*plainchar = (fragment & 0x00f) << 4;
58+
// falls through
5759
case step_c:
5860
do {
5961
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
6567
} while (fragment < 0);
6668
*plainchar++ |= (fragment & 0x03c) >> 2;
6769
*plainchar = (fragment & 0x003) << 6;
70+
// falls through
6871
case step_d:
6972
do {
7073
if (codechar == code_in+length_in){

cores/esp8266/libb64/cencode.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
5050
result = (fragment & 0x0fc) >> 2;
5151
*codechar++ = base64_encode_value(result);
5252
result = (fragment & 0x003) << 4;
53+
// falls through
5354
case step_B:
5455
if (plainchar == plaintextend){
5556
state_in->result = result;
@@ -60,6 +61,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
6061
result |= (fragment & 0x0f0) >> 4;
6162
*codechar++ = base64_encode_value(result);
6263
result = (fragment & 0x00f) << 2;
64+
// falls through
6365
case step_C:
6466
if (plainchar == plaintextend){
6567
state_in->result = result;

libraries/ESP8266AVRISP/src/ESP8266AVRISP.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,9 @@ AVRISPState_t ESP8266AVRISP::serve() {
107107
case AVRISP_STATE_IDLE:
108108
// should not be called when idle, error?
109109
break;
110-
case AVRISP_STATE_PENDING: {
110+
case AVRISP_STATE_PENDING:
111111
_state = AVRISP_STATE_ACTIVE;
112-
// fallthrough
113-
}
112+
// falls through
114113
case AVRISP_STATE_ACTIVE: {
115114
while (_client.available()) {
116115
avrisp();

libraries/ESP8266SdFat

tests/host/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ FLAGS += -DLWIP_IPV6=0
153153
FLAGS += -DHOST_MOCK=1
154154
FLAGS += -DNONOSDK221=1
155155
FLAGS += $(MKFLAGS)
156+
FLAGS += -Wimplicit-fallthrough=2 # allow "// fall through" comments to stop spurious warnings
156157
CXXFLAGS += -std=c++11 -fno-rtti $(FLAGS) -funsigned-char
157158
CFLAGS += -std=c99 $(FLAGS) -funsigned-char
158159
LDFLAGS += -coverage $(OPTZ) -g $(M32)

tests/host/common/UdpContextSocket.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ size_t mockUDPFillInBuf (int sock, char* ccinbuf, size_t& ccinbufsize, uint8_t&
155155
size_t mockUDPPeekBytes (int sock, char* dst, size_t usersize, int timeout_ms, char* ccinbuf, size_t& ccinbufsize)
156156
{
157157
(void) sock;
158+
(void) timeout_ms;
158159
if (usersize > CCBUFSIZE)
159160
fprintf(stderr, MOCK "CCBUFSIZE(%d) should be increased by %zd bytes (-> %zd)\n", CCBUFSIZE, usersize - CCBUFSIZE, usersize);
160161

tests/host/common/include/ClientContext.h

+3
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ class ClientContext
258258

259259
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)
260260
{
261+
(void) idle_sec;
262+
(void) intv_sec;
263+
(void) count;
261264
mockverbose("TODO ClientContext::keepAlive()\n");
262265
}
263266

0 commit comments

Comments
 (0)