mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Add -Werror to acceptance builds for C and CPP (#4369)
Use platform.local.txt to add -Werror to GCC for the build of all code. Any warnings on a submitted patch will cause an error. Several examples and libraries had warnings/errors (missing returns on functions, types, etc.). Clean those up with this commit as well.
This commit is contained in:
committed by
GitHub
parent
ad42ab69c1
commit
f9ac524b13
@ -39,8 +39,8 @@ extern "C" {
|
||||
#define beget16(addr) (*addr * 256 + *(addr+1))
|
||||
|
||||
ESP8266AVRISP::ESP8266AVRISP(uint16_t port, uint8_t reset_pin, uint32_t spi_freq, bool reset_state, bool reset_activehigh):
|
||||
_reset_pin(reset_pin), _reset_state(reset_state), _spi_freq(spi_freq), _reset_activehigh(reset_activehigh),
|
||||
_server(WiFiServer(port)), _state(AVRISP_STATE_IDLE)
|
||||
_spi_freq(spi_freq), _server(WiFiServer(port)), _state(AVRISP_STATE_IDLE),
|
||||
_reset_pin(reset_pin), _reset_state(reset_state), _reset_activehigh(reset_activehigh)
|
||||
{
|
||||
pinMode(_reset_pin, OUTPUT);
|
||||
setReset(_reset_state);
|
||||
@ -71,6 +71,7 @@ AVRISPState_t ESP8266AVRISP::update() {
|
||||
ip_addr_t lip;
|
||||
lip.addr = _client.remoteIP();
|
||||
AVRISP_DEBUG("client connect %d.%d.%d.%d:%d", IP2STR(&lip), _client.remotePort());
|
||||
(void) lip; // Avoid unused warning when not in debug mode
|
||||
_client.setTimeout(100); // for getch()
|
||||
_state = AVRISP_STATE_PENDING;
|
||||
_reject_incoming();
|
||||
@ -136,10 +137,9 @@ void ESP8266AVRISP::fill(int n) {
|
||||
}
|
||||
|
||||
uint8_t ESP8266AVRISP::spi_transaction(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
|
||||
uint8_t n;
|
||||
SPI.transfer(a);
|
||||
n = SPI.transfer(b);
|
||||
n = SPI.transfer(c);
|
||||
SPI.transfer(b);
|
||||
SPI.transfer(c);
|
||||
return SPI.transfer(d);
|
||||
}
|
||||
|
||||
@ -233,7 +233,6 @@ void ESP8266AVRISP::end_pmode() {
|
||||
}
|
||||
|
||||
void ESP8266AVRISP::universal() {
|
||||
int w;
|
||||
uint8_t ch;
|
||||
|
||||
fill(4);
|
||||
@ -265,8 +264,6 @@ int ESP8266AVRISP::addr_page(int addr) {
|
||||
|
||||
|
||||
void ESP8266AVRISP::write_flash(int length) {
|
||||
uint32_t started = millis();
|
||||
|
||||
fill(length);
|
||||
|
||||
if (Sync_CRC_EOP == getch()) {
|
||||
@ -331,7 +328,6 @@ void ESP8266AVRISP::program_page() {
|
||||
int length = 256 * getch();
|
||||
length += getch();
|
||||
char memtype = getch();
|
||||
char buf[100];
|
||||
// flash memory @here, (length) bytes
|
||||
if (memtype == 'F') {
|
||||
write_flash(length);
|
||||
@ -390,7 +386,6 @@ void ESP8266AVRISP::eeprom_read_page(int length) {
|
||||
}
|
||||
|
||||
void ESP8266AVRISP::read_page() {
|
||||
char result = (char)Resp_STK_FAILED;
|
||||
int length = 256 * getch();
|
||||
length += getch();
|
||||
char memtype = getch();
|
||||
@ -424,9 +419,13 @@ void ESP8266AVRISP::read_signature() {
|
||||
|
||||
// It seems ArduinoISP is based on the original STK500 (not v2)
|
||||
// but implements only a subset of the commands.
|
||||
int ESP8266AVRISP::avrisp() {
|
||||
void ESP8266AVRISP::avrisp() {
|
||||
uint8_t data, low, high;
|
||||
uint8_t ch = getch();
|
||||
// Avoid set but not used warning. Leaving them in as it helps document the code
|
||||
(void) data;
|
||||
(void) low;
|
||||
(void) high;
|
||||
// AVRISP_DEBUG("CMD 0x%02x", ch);
|
||||
switch (ch) {
|
||||
case Cmnd_STK_GET_SYNC:
|
||||
@ -517,7 +516,7 @@ int ESP8266AVRISP::avrisp() {
|
||||
|
||||
// anything else we will return STK_UNKNOWN
|
||||
default:
|
||||
AVRISP_DEBUG("??!?");
|
||||
AVRISP_DEBUG("?!?");
|
||||
error++;
|
||||
if (Sync_CRC_EOP == getch()) {
|
||||
_client.print((char)Resp_STK_UNKNOWN);
|
||||
|
@ -71,7 +71,7 @@ protected:
|
||||
|
||||
inline void _reject_incoming(void); // reject any incoming tcp connections
|
||||
|
||||
int avrisp(void); // handle incoming STK500 commands
|
||||
void avrisp(void); // handle incoming STK500 commands
|
||||
|
||||
uint8_t getch(void); // retrieve a character from the remote end
|
||||
uint8_t spi_transaction(uint8_t, uint8_t, uint8_t, uint8_t);
|
||||
|
Reference in New Issue
Block a user