1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-04 01:23:50 +03:00

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
This commit is contained in:
Earle F. Philhower, III
2019-07-05 22:31:50 -07:00
committed by GitHub
parent 8b1af68e3f
commit 6bd4b1c4f7
8 changed files with 23 additions and 4 deletions

View File

@ -6,6 +6,14 @@ git:
depth: 1 depth: 1
submodules: false submodules: false
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
- gcc-7
before_install: before_install:
- git submodule update --init # no recursive update - git submodule update --init # no recursive update
@ -80,6 +88,7 @@ jobs:
stage: build stage: build
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
install: sudo apt-get install valgrind lcov install: sudo apt-get install valgrind lcov
env: CC=gcc-7 CXX=g++-7
- name: "Docs" - name: "Docs"
stage: build stage: build
@ -96,6 +105,7 @@ jobs:
- name: "Mock trivial test" - name: "Mock trivial test"
stage: build stage: build
script: $TRAVIS_BUILD_DIR/tests/buildm.sh script: $TRAVIS_BUILD_DIR/tests/buildm.sh
env: CC=gcc-7 CXX=g++-7
- name: "Boards" - name: "Boards"
stage: build stage: build

View File

@ -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++); fragment = (int8_t)base64_decode_value_signed(*codechar++);
} while (fragment < 0); } while (fragment < 0);
*plainchar = (fragment & 0x03f) << 2; *plainchar = (fragment & 0x03f) << 2;
// falls through
case step_b: case step_b:
do { do {
if (codechar == code_in+length_in){ 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); } while (fragment < 0);
*plainchar++ |= (fragment & 0x030) >> 4; *plainchar++ |= (fragment & 0x030) >> 4;
*plainchar = (fragment & 0x00f) << 4; *plainchar = (fragment & 0x00f) << 4;
// falls through
case step_c: case step_c:
do { do {
if (codechar == code_in+length_in){ 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); } while (fragment < 0);
*plainchar++ |= (fragment & 0x03c) >> 2; *plainchar++ |= (fragment & 0x03c) >> 2;
*plainchar = (fragment & 0x003) << 6; *plainchar = (fragment & 0x003) << 6;
// falls through
case step_d: case step_d:
do { do {
if (codechar == code_in+length_in){ if (codechar == code_in+length_in){

View File

@ -50,6 +50,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
result = (fragment & 0x0fc) >> 2; result = (fragment & 0x0fc) >> 2;
*codechar++ = base64_encode_value(result); *codechar++ = base64_encode_value(result);
result = (fragment & 0x003) << 4; result = (fragment & 0x003) << 4;
// falls through
case step_B: case step_B:
if (plainchar == plaintextend){ if (plainchar == plaintextend){
state_in->result = result; 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; result |= (fragment & 0x0f0) >> 4;
*codechar++ = base64_encode_value(result); *codechar++ = base64_encode_value(result);
result = (fragment & 0x00f) << 2; result = (fragment & 0x00f) << 2;
// falls through
case step_C: case step_C:
if (plainchar == plaintextend){ if (plainchar == plaintextend){
state_in->result = result; state_in->result = result;

View File

@ -107,10 +107,9 @@ AVRISPState_t ESP8266AVRISP::serve() {
case AVRISP_STATE_IDLE: case AVRISP_STATE_IDLE:
// should not be called when idle, error? // should not be called when idle, error?
break; break;
case AVRISP_STATE_PENDING: { case AVRISP_STATE_PENDING:
_state = AVRISP_STATE_ACTIVE; _state = AVRISP_STATE_ACTIVE;
// fallthrough // falls through
}
case AVRISP_STATE_ACTIVE: { case AVRISP_STATE_ACTIVE: {
while (_client.available()) { while (_client.available()) {
avrisp(); avrisp();

View File

@ -153,6 +153,7 @@ FLAGS += -DLWIP_IPV6=0
FLAGS += -DHOST_MOCK=1 FLAGS += -DHOST_MOCK=1
FLAGS += -DNONOSDK221=1 FLAGS += -DNONOSDK221=1
FLAGS += $(MKFLAGS) FLAGS += $(MKFLAGS)
FLAGS += -Wimplicit-fallthrough=2 # allow "// fall through" comments to stop spurious warnings
CXXFLAGS += -std=c++11 -fno-rtti $(FLAGS) -funsigned-char CXXFLAGS += -std=c++11 -fno-rtti $(FLAGS) -funsigned-char
CFLAGS += -std=c99 $(FLAGS) -funsigned-char CFLAGS += -std=c99 $(FLAGS) -funsigned-char
LDFLAGS += -coverage $(OPTZ) -g $(M32) LDFLAGS += -coverage $(OPTZ) -g $(M32)

View File

@ -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) size_t mockUDPPeekBytes (int sock, char* dst, size_t usersize, int timeout_ms, char* ccinbuf, size_t& ccinbufsize)
{ {
(void) sock; (void) sock;
(void) timeout_ms;
if (usersize > CCBUFSIZE) if (usersize > CCBUFSIZE)
fprintf(stderr, MOCK "CCBUFSIZE(%d) should be increased by %zd bytes (-> %zd)\n", CCBUFSIZE, usersize - CCBUFSIZE, usersize); fprintf(stderr, MOCK "CCBUFSIZE(%d) should be increased by %zd bytes (-> %zd)\n", CCBUFSIZE, usersize - CCBUFSIZE, usersize);

View File

@ -258,6 +258,9 @@ public:
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 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"); mockverbose("TODO ClientContext::keepAlive()\n");
} }