Merge branch 'bugfix/gcc8_complation_errors' into 'master'

Warnings and errors detected by GCC8

See merge request idf/esp-idf!2703
This commit is contained in:
Anton Maklakov 2018-07-09 22:55:52 +08:00
commit 27311811e0
17 changed files with 53 additions and 17 deletions

View file

@ -20,7 +20,6 @@
#include "rom/ets_sys.h" #include "rom/ets_sys.h"
#include "esp_app_trace.h" #include "esp_app_trace.h"
#define LOG_LOCAL_LEVEL ESP_LOG_ERROR
#include "esp_log.h" #include "esp_log.h"
const static char *TAG = "segger_rtt"; const static char *TAG = "segger_rtt";
@ -125,7 +124,7 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
uint8_t event_id = *pbuf; uint8_t event_id = *pbuf;
if (NumBytes > SYSVIEW_EVENTS_BUF_SZ) { if (NumBytes > SYSVIEW_EVENTS_BUF_SZ) {
ESP_LOGE(TAG, "Too large event %d bytes!", NumBytes); ESP_LOGE(TAG, "Too large event %u bytes!", NumBytes);
return 0; return 0;
} }
if (xPortGetCoreID()) { // dual core specific code if (xPortGetCoreID()) { // dual core specific code

View file

@ -12,3 +12,5 @@ COMPONENT_SUBMODULES += libcoap
libcoap/src/debug.o: CFLAGS += -Wno-write-strings libcoap/src/debug.o: CFLAGS += -Wno-write-strings
libcoap/src/pdu.o: CFLAGS += -Wno-write-strings libcoap/src/pdu.o: CFLAGS += -Wno-write-strings
# Temporary suppress "fallthrough" warnings until they are fixed in libcoap repo
libcoap/src/option.o: CFLAGS += -Wno-implicit-fallthrough

View file

@ -374,8 +374,8 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
} }
/* local interface for IPv4 */ /* local interface for IPv4 */
(*packet)->src.size = sizeof((*packet)->src.addr); (*packet)->src.size = sizeof((*packet)->src.addr.sa);
memcpy(&(*packet)->src.addr.sa, &soc_srcipaddr, (*packet)->src.size); memcpy(&((*packet)->src.addr.sa), &soc_srcipaddr, (*packet)->src.size);
if (len > coap_get_max_packetlength(*packet)) { if (len > coap_get_max_packetlength(*packet)) {
/* FIXME: we might want to send back a response */ /* FIXME: we might want to send back a response */

View file

@ -3071,6 +3071,7 @@ static int trex_charnode(TRex *exp,TRexBool isclass)
exp->_p++; exp->_p++;
return node; return node;
} //else default } //else default
/* falls through */
default: default:
t = *exp->_p; exp->_p++; t = *exp->_p; exp->_p++;
return trex_newnode(exp,t); return trex_newnode(exp,t);

View file

@ -13,12 +13,23 @@ extern "C" void __cxx_fatal_exception(void)
abort(); abort();
} }
extern "C" bool __cxx_fatal_exception_bool(void)
{
__cxx_fatal_exception();
return false;
}
extern "C" void __cxx_fatal_exception_message(const char *msg) extern "C" void __cxx_fatal_exception_message(const char *msg)
{ {
printf("%s%s\n", FATAL_EXCEPTION, msg); printf("%s%s\n", FATAL_EXCEPTION, msg);
abort(); abort();
} }
extern "C" void __cxx_fatal_exception_message_va(const char *msg, ...)
{
__cxx_fatal_exception_message(msg);
}
extern "C" void __cxx_fatal_exception_int(int i) extern "C" void __cxx_fatal_exception_int(int i)
{ {
printf("%s (%d)\n", FATAL_EXCEPTION, i); printf("%s (%d)\n", FATAL_EXCEPTION, i);
@ -43,7 +54,7 @@ void std::__throw_length_error(const char*) __attribute__((alias("__cxx_fatal_ex
void std::__throw_out_of_range(const char*) __attribute__((alias("__cxx_fatal_exception_message"))); void std::__throw_out_of_range(const char*) __attribute__((alias("__cxx_fatal_exception_message")));
void std::__throw_out_of_range_fmt(const char*, ...) __attribute__((alias("__cxx_fatal_exception_message"))); void std::__throw_out_of_range_fmt(const char*, ...) __attribute__((alias("__cxx_fatal_exception_message_va")));
void std::__throw_runtime_error(const char*) __attribute__((alias("__cxx_fatal_exception_message"))); void std::__throw_runtime_error(const char*) __attribute__((alias("__cxx_fatal_exception_message")));
@ -84,6 +95,6 @@ extern "C" void __cxa_rethrow(void) __attribute__((alias("__cxx_fatal_exception"
extern "C" void __cxa_throw(void) __attribute__((alias("__cxx_fatal_exception"))); extern "C" void __cxa_throw(void) __attribute__((alias("__cxx_fatal_exception")));
extern "C" void __cxa_call_terminate(void) __attribute__((alias("__cxx_fatal_exception"))); extern "C" void __cxa_call_terminate(void) __attribute__((alias("__cxx_fatal_exception")));
bool std::uncaught_exception() __attribute__((alias("__cxx_fatal_exception"))); bool std::uncaught_exception() __attribute__((alias("__cxx_fatal_exception_bool")));
#endif // CONFIG_CXX_EXCEPTIONS #endif // CONFIG_CXX_EXCEPTIONS

View file

@ -98,12 +98,12 @@ In ADC2, there're two locks used for different cases:
adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock. adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
*/ */
//prevent ADC2 being used by wifi and other tasks at the same time. //prevent ADC2 being used by wifi and other tasks at the same time.
static _lock_t adc2_wifi_lock = NULL; static _lock_t adc2_wifi_lock;
//prevent ADC2 being used by tasks (regardless of WIFI) //prevent ADC2 being used by tasks (regardless of WIFI)
portMUX_TYPE adc2_spinlock = portMUX_INITIALIZER_UNLOCKED; portMUX_TYPE adc2_spinlock = portMUX_INITIALIZER_UNLOCKED;
//prevent ADC1 being used by I2S dma and other tasks at the same time. //prevent ADC1 being used by I2S dma and other tasks at the same time.
static _lock_t adc1_i2s_lock = NULL; static _lock_t adc1_i2s_lock;
typedef struct { typedef struct {
TimerHandle_t timer; TimerHandle_t timer;

View file

@ -277,7 +277,7 @@ static inline uint8_t* sdio_ringbuf_offset_ptr(sdio_ringbuf_t *buf, sdio_ringbuf
static esp_err_t sdio_ringbuf_send(sdio_ringbuf_t* buf, esp_err_t (*copy_callback)(uint8_t*, void*), void* arg, TickType_t wait) static esp_err_t sdio_ringbuf_send(sdio_ringbuf_t* buf, esp_err_t (*copy_callback)(uint8_t*, void*), void* arg, TickType_t wait)
{ {
portBASE_TYPE ret = xSemaphoreTake(buf->remain_cnt, wait); portBASE_TYPE ret = xSemaphoreTake(buf->remain_cnt, wait);
if (ret != pdTRUE) return NULL; if (ret != pdTRUE) return ESP_ERR_TIMEOUT;
portENTER_CRITICAL(&buf->write_spinlock); portENTER_CRITICAL(&buf->write_spinlock);
uint8_t* get_ptr = sdio_ringbuf_offset_ptr(buf, ringbuf_write_ptr, buf->item_size); uint8_t* get_ptr = sdio_ringbuf_offset_ptr(buf, ringbuf_write_ptr, buf->item_size);

View file

@ -88,7 +88,7 @@ void esp_clk_init(void)
break; break;
default: default:
freq_mhz = 80; freq_mhz = 80;
/* no break */ /* falls through */
case 80: case 80:
freq = RTC_CPU_FREQ_80M; freq = RTC_CPU_FREQ_80M;
break; break;

View file

@ -607,7 +607,7 @@ typedef void (*esp_uuid_gen_mac_addr_t)(const unsigned char *mac_addr, unsigned
* @brief free the message after finish DH * @brief free the message after finish DH
* *
*/ */
typedef void * (*esp_dh5_free_t)(void *ctx); typedef void (*esp_dh5_free_t)(void *ctx);
/** /**
* @brief Build WPS IE for (Re)Association Request * @brief Build WPS IE for (Re)Association Request

View file

@ -6,4 +6,5 @@ COMPONENT_ADD_INCLUDEDIRS := port/include include/expat
COMPONENT_SRCDIRS := library port COMPONENT_SRCDIRS := library port
CFLAGS += -Wno-unused-function -DHAVE_EXPAT_CONFIG_H CFLAGS += -Wno-unused-function -DHAVE_EXPAT_CONFIG_H
# Temporary suppress "fallthrough" warnings until they are fixed in expat repo
CFLAGS += -Wno-implicit-fallthrough

View file

@ -1554,6 +1554,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
errorCode = XML_ERROR_NO_MEMORY; errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR; return XML_STATUS_ERROR;
} }
/* falls through */
default: default:
ps_parsing = XML_PARSING; ps_parsing = XML_PARSING;
} }
@ -1680,6 +1681,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
errorCode = XML_ERROR_NO_MEMORY; errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR; return XML_STATUS_ERROR;
} }
/* falls through */
default: default:
ps_parsing = XML_PARSING; ps_parsing = XML_PARSING;
} }
@ -4266,8 +4268,8 @@ doProlog(XML_Parser parser,
return XML_ERROR_NO_MEMORY; return XML_ERROR_NO_MEMORY;
declEntity->publicId = NULL; declEntity->publicId = NULL;
} }
/* fall through */
#endif /* XML_DTD */ #endif /* XML_DTD */
/* falls through */
case XML_ROLE_ENTITY_SYSTEM_ID: case XML_ROLE_ENTITY_SYSTEM_ID:
if (dtd->keepProcessing && declEntity) { if (dtd->keepProcessing && declEntity) {
declEntity->systemId = poolStoreString(&dtd->pool, enc, declEntity->systemId = poolStoreString(&dtd->pool, enc,

View file

@ -47,6 +47,7 @@
*nextTokPtr = ptr; \ *nextTokPtr = ptr; \
return XML_TOK_INVALID; \ return XML_TOK_INVALID; \
} \ } \
/* fall through */ \
case BT_NMSTRT: \ case BT_NMSTRT: \
case BT_HEX: \ case BT_HEX: \
case BT_DIGIT: \ case BT_DIGIT: \
@ -75,6 +76,7 @@
*nextTokPtr = ptr; \ *nextTokPtr = ptr; \
return XML_TOK_INVALID; \ return XML_TOK_INVALID; \
} \ } \
/* fall through */ \
case BT_NMSTRT: \ case BT_NMSTRT: \
case BT_HEX: \ case BT_HEX: \
ptr += MINBPC(enc); \ ptr += MINBPC(enc); \
@ -575,7 +577,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_INVALID; return XML_TOK_INVALID;
} }
} }
/* fall through */ /* fall through */
case BT_EQUALS: case BT_EQUALS:
{ {
int open; int open;
@ -1403,6 +1405,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
case BT_NMSTRT: case BT_NMSTRT:
if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f))
break; break;
/* fall through */
default: default:
switch (BYTE_TO_ASCII(enc, ptr)) { switch (BYTE_TO_ASCII(enc, ptr)) {
case 0x24: /* $ */ case 0x24: /* $ */

View file

@ -16,7 +16,7 @@
#if (CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE > 0) #if (CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE > 0)
#define NO_OF_QUEUES_PER_CORE ((int)((CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE - 3)/portNUM_PROCESSORS)) //Save space for some preallocated tasks #define NO_OF_QUEUES_PER_CORE ((int)((CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE - 3)/portNUM_PROCESSORS)) //Save space for some preallocated tasks
#define NO_OF_QUEUES_TOTAL (NO_OF_QUEUES_PER_CORE * portNUM_PROCESSORS) #define NO_OF_QUEUES_TOTAL (NO_OF_QUEUES_PER_CORE * portNUM_PROCESSORS)
#define QUEUE_NAME_MAX_LENGTH 10 #define QUEUE_NAME_MAX_LENGTH 30
static SemaphoreHandle_t start_sem[portNUM_PROCESSORS]; static SemaphoreHandle_t start_sem[portNUM_PROCESSORS];
static SemaphoreHandle_t done_sem = NULL; static SemaphoreHandle_t done_sem = NULL;

View file

@ -86,3 +86,7 @@ CFLAGS += -DNATIVE_LITTLE_ENDIAN -DHAVE_WEAK_SYMBOLS -D__STDC_LIMIT_MACROS -D__
# randombytes.c needs to pull in platform-specific implementation # randombytes.c needs to pull in platform-specific implementation
$(LSRC)/randombytes/randombytes.o: CFLAGS+=-DRANDOMBYTES_DEFAULT_IMPLEMENTATION $(LSRC)/randombytes/randombytes.o: CFLAGS+=-DRANDOMBYTES_DEFAULT_IMPLEMENTATION
# Temporary suppress "fallthrough" warnings until they are fixed in libsodium repo
$(LSRC)/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.o: CFLAGS += -Wno-implicit-fallthrough
$(LSRC)/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.o: CFLAGS += -Wno-implicit-fallthrough

View file

@ -34,12 +34,16 @@ void mbedtls_esp_enable_debug_log(mbedtls_ssl_config *conf, int threshold)
switch(threshold) { switch(threshold) {
case 1: case 1:
level = ESP_LOG_WARN; level = ESP_LOG_WARN;
break;
case 2: case 2:
level = ESP_LOG_INFO; level = ESP_LOG_INFO;
break;
case 3: case 3:
level = ESP_LOG_DEBUG; level = ESP_LOG_DEBUG;
break;
case 4: case 4:
level = ESP_LOG_VERBOSE; level = ESP_LOG_VERBOSE;
break;
} }
esp_log_level_set(TAG, level); esp_log_level_set(TAG, level);
} }
@ -76,6 +80,7 @@ static void mbedtls_esp_debug(void *ctx, int level,
break; break;
case 3: case 3:
ESP_LOGD(TAG, "%s:%d %s", file, line, str); ESP_LOGD(TAG, "%s:%d %s", file, line, str);
break;
case 4: case 4:
ESP_LOGV(TAG, "%s:%d %s", file, line, str); ESP_LOGV(TAG, "%s:%d %s", file, line, str);
break; break;

View file

@ -1814,7 +1814,7 @@ reexecute:
case 2: case 2:
parser->upgrade = 1; parser->upgrade = 1;
/* falls through */
case 1: case 1:
parser->flags |= F_SKIPBODY; parser->flags |= F_SKIPBODY;
break; break;
@ -2374,7 +2374,7 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect,
case s_req_server_with_at: case s_req_server_with_at:
found_at = 1; found_at = 1;
/* FALLTROUGH */ /* falls through */
case s_req_server: case s_req_server:
uf = UF_HOST; uf = UF_HOST;
break; break;

View file

@ -494,20 +494,28 @@ static char * x509_name_attr_str(enum x509_name_attr_type type)
switch (type) { switch (type) {
case X509_NAME_ATTR_NOT_USED: case X509_NAME_ATTR_NOT_USED:
strcpy(name_attr, "[N/A]"); strcpy(name_attr, "[N/A]");
break;
case X509_NAME_ATTR_DC: case X509_NAME_ATTR_DC:
strcpy(name_attr, "DC"); strcpy(name_attr, "DC");
break;
case X509_NAME_ATTR_CN: case X509_NAME_ATTR_CN:
strcpy(name_attr, "CN"); strcpy(name_attr, "CN");
break;
case X509_NAME_ATTR_C: case X509_NAME_ATTR_C:
strcpy(name_attr, "C"); strcpy(name_attr, "C");
break;
case X509_NAME_ATTR_L: case X509_NAME_ATTR_L:
strcpy(name_attr, "L"); strcpy(name_attr, "L");
break;
case X509_NAME_ATTR_ST: case X509_NAME_ATTR_ST:
strcpy(name_attr, "ST"); strcpy(name_attr, "ST");
break;
case X509_NAME_ATTR_O: case X509_NAME_ATTR_O:
strcpy(name_attr, "O"); strcpy(name_attr, "O");
break;
case X509_NAME_ATTR_OU: case X509_NAME_ATTR_OU:
strcpy(name_attr, "OU"); strcpy(name_attr, "OU");
break;
default : default :
strcpy(name_attr, "?"); strcpy(name_attr, "?");
} }