-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Clean up unused variables from HardwareSerial.cpp #1769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit is unfortunately wrong - the result of these variables isn't used, but the side effect of reading the UDR register is that the byte is removed from the FIFO, which is needed. If this line is removed, and a buffer flow occurs, I think that the RX complete interrupt will then continue to occur indefinately... Assuming that your goal is to silence the compilers warning, you might need to find some other way to keep the read, but get rid of the warning... Regarding the other variable you are removing, I already have a commit for that in #1711, which will hopefully be merged soon. |
Writing just
instead of
should do the trick. @matthijskooijman C |
Commit updated as promised. @matthijskooijman - Ah yes, I see what you mean now I've looked more closely at your changes. However (being fairly new to this) I'm not sure what is the correct way to achieve this - should I merge the commits from your PR into this branch? |
It's probably best if you put your change(s) on top of my change, instead of merging. To do so, you should fetch my changes and create a local branch containing them:
This puts you on a local branch called "new_branch", containing my changes. Now, add any changes you want (you could cherry-pick them, but IIRC I moved code so much that you'll probably want to redo your change from scratch). When making a pull-request, it seems you can even tell github to use "refs/pull/1711/head" (i.e. my pullreq) as a base (you'll have to manually enter that string, it's not offered in the list). Not sure what this means for the way the pullrequest is merged (I don't think github can know where the pullrequest should be merged to), but that's something to sort out later (the devs can always just manually pull the commit). |
Alternatively, shall I wait until #1711 is merged and then re-implement my changes on top of that to save having to open a new PR? |
As proposed in my previous comment, I've updated this to remove the unused |
Did you happen to compare the hex or disassembly output with and without this change? I'd expect them to be equal, but it would be good to doublecheck. |
@matthijskooijman Good thinking - I'll do that tomorrow evening and report back... |
Just checked, the output is exactly the same. Thanks! |
Many thanks both for your help - much appreciated. |
This pull request cleans up a couple of unused variables in
HardwareSerial.cpp
to improve clarity.