arduino / ArduinoCore-avr

The Official Arduino AVR core
https://www.arduino.cc
1.25k stars 1.06k forks source link

Removed a number of compiler warnings. #483

Closed jfjlaros closed 2 years ago

jfjlaros commented 2 years ago

This "patch" will result in the suppression of a number of warnings that are the result of unused parameters. In particular the following warnings are removed.

.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp: In function 'void* operator new(std::size_t, std::nothrow_t)':
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp:59:60: warning: unused parameter 'tag' [-Wunused-parameter]
 void * operator new(std::size_t size, const std::nothrow_t tag) noexcept {
                                                            ^~~
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp: In function 'void* operator new [](std::size_t, const std::nothrow_t&)':
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp:68:63: warning: unused parameter 'tag' [-Wunused-parameter]
 void * operator new[](std::size_t size, const std::nothrow_t& tag) noexcept {
                                                               ^~~
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp: In function 'void operator delete(void*, const std::nothrow_t&)':
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp:103:55: warning: unused parameter 'tag' [-Wunused-parameter]
 void operator delete(void* ptr, const std::nothrow_t& tag) noexcept {
                                                       ^~~
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp: In function 'void operator delete [](void*, const std::nothrow_t&)':
.../.arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino/new.cpp:106:57: warning: unused parameter 'tag' [-Wunused-parameter]
 void operator delete[](void* ptr, const std::nothrow_t& tag) noexcept {
                                                         ^~~

P.S. There are some more warnings about the use of binary constants (e.g., 0b11111000). I can also take care of them if you like.

jfjlaros commented 2 years ago

I accidentally added more commits to this PR, this is fixed in PR #484.

matthijskooijman commented 2 years ago

For future reference, you can do a "force push" to a branch to remove extra commit (or push fixed versions of them after using git rebase for history rewriting) and the PR will be automatically updated to reflect whatever you push to the branch. Also, doing a force push to PR branches is generally considered acceptable (unlike force pushing to e.g. the master/main branch, which makes things more complicated for other people that have pulled that branch).