Skip to content

Commit

Permalink
Merge branch 'bugfix/gcc8_complation_errors' into 'master'
Browse files Browse the repository at this point in the history
Warnings and errors detected by GCC8

See merge request idf/esp-idf!2703
  • Loading branch information
antmak committed Jul 9, 2018
2 parents 3e7a5c4 + c2dc093 commit 2731181
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 17 deletions.
3 changes: 1 addition & 2 deletions components/app_trace/sys_view/esp32/SEGGER_RTT_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "rom/ets_sys.h"
#include "esp_app_trace.h"

#define LOG_LOCAL_LEVEL ESP_LOG_ERROR
#include "esp_log.h"
const static char *TAG = "segger_rtt";

Expand Down Expand Up @@ -125,7 +124,7 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
uint8_t event_id = *pbuf;

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;
}
if (xPortGetCoreID()) { // dual core specific code
Expand Down
2 changes: 2 additions & 0 deletions components/coap/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ COMPONENT_SUBMODULES += libcoap

libcoap/src/debug.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
4 changes: 2 additions & 2 deletions components/coap/port/coap_io_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ coap_network_read(coap_endpoint_t *ep, coap_packet_t **packet) {
}

/* local interface for IPv4 */
(*packet)->src.size = sizeof((*packet)->src.addr);
memcpy(&(*packet)->src.addr.sa, &soc_srcipaddr, (*packet)->src.size);
(*packet)->src.size = sizeof((*packet)->src.addr.sa);
memcpy(&((*packet)->src.addr.sa), &soc_srcipaddr, (*packet)->src.size);

if (len > coap_get_max_packetlength(*packet)) {
/* FIXME: we might want to send back a response */
Expand Down
1 change: 1 addition & 0 deletions components/console/argtable3/argtable3.c
Original file line number Diff line number Diff line change
Expand Up @@ -3071,6 +3071,7 @@ static int trex_charnode(TRex *exp,TRexBool isclass)
exp->_p++;
return node;
} //else default
/* falls through */
default:
t = *exp->_p; exp->_p++;
return trex_newnode(exp,t);
Expand Down
15 changes: 13 additions & 2 deletions components/cxx/cxx_exception_stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,23 @@ extern "C" void __cxx_fatal_exception(void)
abort();
}

extern "C" bool __cxx_fatal_exception_bool(void)
{
__cxx_fatal_exception();
return false;
}

extern "C" void __cxx_fatal_exception_message(const char *msg)
{
printf("%s%s\n", FATAL_EXCEPTION, msg);
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)
{
printf("%s (%d)\n", FATAL_EXCEPTION, i);
Expand All @@ -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_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")));

Expand Down Expand Up @@ -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_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
4 changes: 2 additions & 2 deletions components/driver/rtc_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
//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)
portMUX_TYPE adc2_spinlock = portMUX_INITIALIZER_UNLOCKED;

//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 {
TimerHandle_t timer;
Expand Down
2 changes: 1 addition & 1 deletion components/driver/sdio_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
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);
uint8_t* get_ptr = sdio_ringbuf_offset_ptr(buf, ringbuf_write_ptr, buf->item_size);
Expand Down
2 changes: 1 addition & 1 deletion components/esp32/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void esp_clk_init(void)
break;
default:
freq_mhz = 80;
/* no break */
/* falls through */
case 80:
freq = RTC_CPU_FREQ_80M;
break;
Expand Down
2 changes: 1 addition & 1 deletion components/esp32/include/esp_wifi_crypto_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
*/
typedef void * (*esp_dh5_free_t)(void *ctx);
typedef void (*esp_dh5_free_t)(void *ctx);

/**
* @brief Build WPS IE for (Re)Association Request
Expand Down
3 changes: 2 additions & 1 deletion components/expat/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ COMPONENT_ADD_INCLUDEDIRS := port/include include/expat
COMPONENT_SRCDIRS := library port

CFLAGS += -Wno-unused-function -DHAVE_EXPAT_CONFIG_H

# Temporary suppress "fallthrough" warnings until they are fixed in expat repo
CFLAGS += -Wno-implicit-fallthrough
4 changes: 3 additions & 1 deletion components/expat/library/xmlparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR;
}
/* falls through */
default:
ps_parsing = XML_PARSING;
}
Expand Down Expand Up @@ -1680,6 +1681,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR;
}
/* falls through */
default:
ps_parsing = XML_PARSING;
}
Expand Down Expand Up @@ -4266,8 +4268,8 @@ doProlog(XML_Parser parser,
return XML_ERROR_NO_MEMORY;
declEntity->publicId = NULL;
}
/* fall through */
#endif /* XML_DTD */
/* falls through */
case XML_ROLE_ENTITY_SYSTEM_ID:
if (dtd->keepProcessing && declEntity) {
declEntity->systemId = poolStoreString(&dtd->pool, enc,
Expand Down
5 changes: 4 additions & 1 deletion components/expat/library/xmltok_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
*nextTokPtr = ptr; \
return XML_TOK_INVALID; \
} \
/* fall through */ \
case BT_NMSTRT: \
case BT_HEX: \
case BT_DIGIT: \
Expand Down Expand Up @@ -75,6 +76,7 @@
*nextTokPtr = ptr; \
return XML_TOK_INVALID; \
} \
/* fall through */ \
case BT_NMSTRT: \
case BT_HEX: \
ptr += MINBPC(enc); \
Expand Down Expand Up @@ -575,7 +577,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_INVALID;
}
}
/* fall through */
/* fall through */
case BT_EQUALS:
{
int open;
Expand Down Expand Up @@ -1403,6 +1405,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
case BT_NMSTRT:
if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f))
break;
/* fall through */
default:
switch (BYTE_TO_ASCII(enc, ptr)) {
case 0x24: /* $ */
Expand Down
2 changes: 1 addition & 1 deletion components/freertos/test/test_freertos_debug_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#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_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 done_sem = NULL;
Expand Down
4 changes: 4 additions & 0 deletions components/libsodium/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
$(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
5 changes: 5 additions & 0 deletions components/mbedtls/port/mbedtls_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ void mbedtls_esp_enable_debug_log(mbedtls_ssl_config *conf, int threshold)
switch(threshold) {
case 1:
level = ESP_LOG_WARN;
break;
case 2:
level = ESP_LOG_INFO;
break;
case 3:
level = ESP_LOG_DEBUG;
break;
case 4:
level = ESP_LOG_VERBOSE;
break;
}
esp_log_level_set(TAG, level);
}
Expand Down Expand Up @@ -76,6 +80,7 @@ static void mbedtls_esp_debug(void *ctx, int level,
break;
case 3:
ESP_LOGD(TAG, "%s:%d %s", file, line, str);
break;
case 4:
ESP_LOGV(TAG, "%s:%d %s", file, line, str);
break;
Expand Down
4 changes: 2 additions & 2 deletions components/nghttp/port/http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ size_t http_parser_execute (http_parser *parser,

case 2:
parser->upgrade = 1;

/* falls through */
case 1:
parser->flags |= F_SKIPBODY;
break;
Expand Down Expand Up @@ -2374,7 +2374,7 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect,
case s_req_server_with_at:
found_at = 1;

/* FALLTROUGH */
/* falls through */
case s_req_server:
uf = UF_HOST;
break;
Expand Down
8 changes: 8 additions & 0 deletions components/wpa_supplicant/src/wpa2/tls/x509v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,20 +494,28 @@ static char * x509_name_attr_str(enum x509_name_attr_type type)
switch (type) {
case X509_NAME_ATTR_NOT_USED:
strcpy(name_attr, "[N/A]");
break;
case X509_NAME_ATTR_DC:
strcpy(name_attr, "DC");
break;
case X509_NAME_ATTR_CN:
strcpy(name_attr, "CN");
break;
case X509_NAME_ATTR_C:
strcpy(name_attr, "C");
break;
case X509_NAME_ATTR_L:
strcpy(name_attr, "L");
break;
case X509_NAME_ATTR_ST:
strcpy(name_attr, "ST");
break;
case X509_NAME_ATTR_O:
strcpy(name_attr, "O");
break;
case X509_NAME_ATTR_OU:
strcpy(name_attr, "OU");
break;
default :
strcpy(name_attr, "?");
}
Expand Down

0 comments on commit 2731181

Please sign in to comment.