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: do not call "memcpy" if there is a) no data to copy, or b) the src pointer is null. #217

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

aentinger
Copy link
Contributor

No description provided.

@aentinger aentinger self-assigned this Sep 26, 2023
@per1234 per1234 added bug and removed enhancement labels Sep 27, 2023
@facchinm facchinm merged commit 65633ce into master Sep 27, 2023
5 checks passed
@jboynes
Copy link
Contributor

jboynes commented Nov 2, 2023

This PR fails to compile the tests on my desktop, perhaps due to an unhelpfully insightful newer compiler.

% make
Consolidate compiler generated dependencies of target test-ArduinoCore-API
[  1%] Building CXX object CMakeFiles/test-ArduinoCore-API.dir/src/CanMsg/test_CanMsg.cpp.o
In file included from .../ArduinoCore-API/test/src/CanMsg/test_CanMsg.cpp:11:
.../ArduinoCore-API/test/../api/CanMsg.h:58:36: error: address of array 'other.data' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
    if (this->data_length && other.data)
                          ~~ ~~~~~~^~~~
.../ArduinoCore-API/test/../api/CanMsg.h:70:38: error: address of array 'other.data' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
      if (this->data_length && other.data)
                            ~~ ~~~~~~^~~~
2 errors generated.
make[2]: *** [CMakeFiles/test-ArduinoCore-API.dir/src/CanMsg/test_CanMsg.cpp.o] Error 1
make[1]: *** [CMakeFiles/test-ArduinoCore-API.dir/all] Error 2
make: *** [all] Error 2

Compiler:

% c++ --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

jboynes added a commit to jboynes/ArduinoCore-API that referenced this pull request Nov 2, 2023
@aentinger aentinger deleted the fix-wno-null branch November 3, 2023 05:37
jboynes added a commit to jboynes/ArduinoCore-API that referenced this pull request Nov 3, 2023
aentinger added a commit that referenced this pull request Nov 6, 2023
Fix #217 when compiling with newer compiler versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants