c++ - bunch of errors and warnings while compiling in gcc linux -
this question has answer here:
this piece of code used compiled no errors few months ago. lost vm image setup new linux vm latest gcc , libraries. these errors , warnings.
in file included /opt/espressif/esp8266_sdk/include/ets_sys.h:12:0, include/espmissingincludes.h:4, driver/i2c.c:20: driver/i2c.c: in function 'i2c_init': /opt/espressif/esp8266_sdk/include/eagle_soc.h:247:94: error: suggest parentheses around arithmetic in operand of '|' [-werror=parentheses] #define pin_func_select(pin_name, func) {write_peri_reg(pin_name,read_peri_reg(pin_name) & (~(periphs_io_mux_func<<periphs_io_mux_func_s)) |( (((func&bit2)<<2)|(func&0x3))<<periphs_io_mux_func_s) );} while (0) ^ /opt/espressif/esp8266_sdk/include/eagle_soc.h:50:87: note: in definition of macro 'write_peri_reg' #define write_peri_reg(addr, val) (*((volatile uint32_t *)ets_uncached_addr(addr))) =(val) ^ driver/i2c.c:64:5: note: in expansion of macro 'pin_func_select' pin_func_select(i2c_sda_mux, i2c_sda_func); ^ /opt/espressif/esp8266_sdk/include/eagle_soc.h:247:94: error: suggest parentheses around arithmetic in operand of '|' [-werror=parentheses] #define pin_func_select(pin_name, func) {write_peri_reg(pin_name,read_peri_reg(pin_name) & (~(periphs_io_mux_func<<periphs_io_mux_func_s)) |( (((func&bit2)<<2)|(func&0x3))<<periphs_io_mux_func_s) );} while (0) ^ /opt/espressif/esp8266_sdk/include/eagle_soc.h:50:87: note: in definition of macro 'write_peri_reg' #define write_peri_reg(addr, val) (*((volatile uint32_t *)ets_uncached_addr(addr))) =(val) ^ driver/i2c.c:65:5: note: in expansion of macro 'pin_func_select' pin_func_select(i2c_sck_mux, i2c_sck_func); ^ cc1: warnings being treated errors make: *** [build/driver/i2c.o] error 1 does know how solve these?
you treating warnings errors, presumably building using -werror. code should compile if remove flag, or add -wno-error=parentheses.
however, if code yours (rather in 3rd party library appears be) worth fixing underlying cause. fix in macro adding parenthesis in right places, think you'd better served making macros real functions.
Comments
Post a Comment