Repository navigation
Fix ambiguous irDebugPrint calls when DEBUG is on - #5
Merged
Merged
Conversation
DPRINT() of an int, uint16_t, uint32_t or a pointer difference converted equally well to the uint64_t and int64_t overloads, so any build with DEBUG defined failed to compile. Route every other integer type through a template that picks the signed or unsigned overload, and print a char as a character. CONFIG_IRREMOTE_DEBUG never reached DPRINT either: IRconfig.h, which maps it to DEBUG, was included after IRplatform.h had already tested DEBUG. That is why the CI debug build passed. Include IRconfig.h from IRplatform.h before the test. Fixes #4
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4.
Problem
With
DEBUGdefined (e.g.-DDEBUGfrom a PlatformIO debug env), the library failed to compile:irDebugPrintonly haduint64_tandint64_toverloads, and anint,uint16_t,uint32_tor pointer difference converts equally well to both. It hitsDPRINTcalls inIRrecv.cpp,ir_Corona.cpp,ir_Lutron.cppand others.CI did not catch it because
CONFIG_IRREMOTE_DEBUGnever actually enabled debug output:IRremoteESP8266.hincludesIRplatform.h(which testsDEBUG) beforeIRconfig.h(which definesDEBUGfrom Kconfig). The "Debug tracing" CI step was building withDPRINTcompiled out.Fix
irDebugPrintoverload for any other integral type forwards to theint64_t/uint64_toverload by signedness. The exact-match non-template overloads still win for their own types.irDebugPrint(char), so acharprints as a character rather than a number.IRplatform.hincludesIRconfig.hbefore theDEBUGtest, soCONFIG_IRREMOTE_DEBUG=yworks. The existing CI debug step now really compiles the debug path.Testing
ir_receive_dumpfor esp32 on IDF 5.5 with-DDEBUG.CONFIG_IRREMOTE_DEBUG=yboth complete with no errors or warnings, and the ELF containsirDebugPrint(so debug code is really compiled in).cpplint --recursive src includeis clean.