Skip to content
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

Fix three allocation related compiler warnings #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kholia
Copy link

@kholia kholia commented Nov 18, 2023

Without this PR, I see the following warnings when compilation this library:

Arduino/libraries/Etherkit_Si5351/src/si5351.cpp: In member function 'void Si5351::set_pll(uint64_t, si5351_pll)':
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp:568:10: warning: 'void operator delete(void*, std::size_t)' called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  568 |   delete params;
      |          ^~~~~~
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp:522:35: note: returned from 'void* operator new [](std::size_t)'
  522 |   uint8_t *params = new uint8_t[20];
      |                                   ^
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp: In member function 'void Si5351::set_vcxo(uint64_t, uint8_t)':
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp:1243:16: warning: 'void operator delete(void*, std::size_t)' called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
 1243 |         delete params;
      |                ^~~~~~
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp:1206:41: note: returned from 'void* operator new [](std::size_t)'
 1206 |         uint8_t *params = new uint8_t[20];
      |                                         ^
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp: In member function 'void Si5351::set_ms(si5351_clock, Si5351RegSet, uint8_t, uint8_t, uint8_t)':
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp:675:16: warning: 'void operator delete(void*, std::size_t)' called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
  675 |         delete params;
      |                ^~~~~~
Arduino/libraries/Etherkit_Si5351/src/si5351.cpp:586:41: note: returned from 'void* operator new [](std::size_t)'
  586 |         uint8_t *params = new uint8_t[20];

The changes in this PR fix these compiler warnings.

Thanks for your time, and attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant