1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +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:
Earle F. Philhower, III
2018-02-17 18:47:10 -08:00
committed by GitHub
parent ad42ab69c1
commit f9ac524b13
22 changed files with 73 additions and 51 deletions

View File

@ -241,6 +241,8 @@ boolean callback_pathExists(SdFile& parentDir, char *filePathComponent,
*/
SdFile child;
(void) isLastComponent;
(void) object;
boolean exists = child.open(parentDir, filePathComponent, O_RDONLY);
@ -310,6 +312,8 @@ boolean callback_openPath(SdFile& parentDir, char *filePathComponent,
boolean callback_remove(SdFile& parentDir, char *filePathComponent,
boolean isLastComponent, void *object) {
(void) object;
if (isLastComponent) {
return SdFile::remove(parentDir, filePathComponent);
}
@ -318,6 +322,7 @@ boolean callback_remove(SdFile& parentDir, char *filePathComponent,
boolean callback_rmdir(SdFile& parentDir, char *filePathComponent,
boolean isLastComponent, void *object) {
(void) object;
if (isLastComponent) {
SdFile f;
if (!f.open(parentDir, filePathComponent, O_READ)) return false;

View File

@ -393,7 +393,6 @@ uint8_t Sd2Card::readBlock(uint32_t block, uint8_t* dst) {
*/
uint8_t Sd2Card::readData(uint32_t block,
uint16_t offset, uint16_t count, uint8_t* dst) {
uint16_t n;
if (count == 0) return true;
if ((count + offset) > 512) {
goto fail;
@ -414,6 +413,8 @@ uint8_t Sd2Card::readData(uint32_t block,
}
#ifdef OPTIMIZE_HARDWARE_SPI
uint16_t n;
// start first spi transfer
SPDR = 0XFF;

View File

@ -259,11 +259,12 @@ uint8_t SdFile::make83Name(const char* str, uint8_t* name) {
i = 8; // place for extension
} else {
// illegal FAT characters
uint8_t b;
#if defined(__AVR__)
uint8_t b;
PGM_P p = PSTR("|<>^+=?/[];,*\"\\");
while ((b = pgm_read_byte(p++))) if (b == c) return false;
#elif defined(__arm__)
uint8_t b;
const uint8_t valid[] = "|<>^+=?/[];,*\"\\";
const uint8_t *p = valid;
while ((b = *p++)) if (b == c) return false;
@ -905,7 +906,7 @@ uint8_t SdFile::rmRfStar(void) {
if (!f.remove()) return false;
}
// position to next entry if required
if (curPosition_ != (32*(index + 1))) {
if (curPosition_ != (32*((uint32_t)index + 1))) {
if (!seekSet(32*(index + 1))) return false;
}
}