Skip to content

Commit

Permalink
Fix compiler warnings causing Travis failures. (#1491)
Browse files Browse the repository at this point in the history
* Fix ICACHE_RAM_ATTR deprecation warning.
Address compilation issue:
```
/home/travis/build/crankyoldgit/IRremoteESP8266/src/IRrecv.cpp: In member function 'void IRrecv::enableIRIn(bool)':
/home/travis/build/crankyoldgit/IRremoteESP8266/src/IRrecv.cpp:346:62: warning: 'void read_timeout(void*)' is deprecated: Use IRAM_ATTR in place of ICACHE_RAM_ATTR to move functions into IRAM [-Wdeprecated-declarations]
```
* Address Switch/code unreachable warning, via a horrible temporary hack.
  • Loading branch information
crankyoldgit authored Jun 6, 2021
1 parent 9573cb2 commit c490849
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/IRrecvDumpV2/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ build_flags = -D_IR_LOCALE_=zh-CN ; Chinese (Simplified)
; Build the library with all protocols disabled to flush out #if/#ifdef issues &
; any compiler warnings, by turning them into errors.
[env:shakedown_no_protocols]
build_flags = -D_IR_ENABLE_DEFAULT_=false -Werror
build_flags = -D_IR_ENABLE_DEFAULT_=false -Werror -Wno-error=switch
1 change: 1 addition & 0 deletions examples/SmartIRRepeater/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ board = nodemcuv2
build_flags =
${env.build_flags}
-Werror
-Wno-error=switch
-D_IR_ENABLE_DEFAULT_=false
8 changes: 0 additions & 8 deletions src/IRac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,8 @@ bool IRac::isProtocolSupported(const decode_type_t protocol) {
#if SEND_VOLTAS
case decode_type_t::VOLTAS:
#endif
#if SEND_WHIRLPOOL_AC
case decode_type_t::WHIRLPOOL_AC:
#endif
// Note: Compiler Warning is disabled because someone could disable all
// the protocols before this and it is then unreachable.
// "-Wswitch-unreachable" not used as it appears to be an unknown option.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
return true;
#pragma GCC diagnostic pop
default:
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions src/IRrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ extern "C" {

#ifndef USE_IRAM_ATTR
#if defined(ESP8266)
#if defined(IRAM_ATTR)
#define USE_IRAM_ATTR IRAM_ATTR
#else // IRAM_ATTR
#define USE_IRAM_ATTR ICACHE_RAM_ATTR
#endif // IRAM_ATTR
#endif // ESP8266
#if defined(ESP32)
#define USE_IRAM_ATTR IRAM_ATTR
Expand Down

0 comments on commit c490849

Please sign in to comment.