You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by gi...@git.apache.org on 2017/07/26 18:10:00 UTC

[GitHub] ccollins476ad opened a new pull request #465: Fix host unit test compiler error on mac

ccollins476ad opened a new pull request #465: Fix host unit test compiler error on mac
URL: https://github.com/apache/mynewt-core/pull/465
 
 
   This addresses the following compiler error encountered in macOS:
   
   ```
       Compiling net/nimble/host/test/src/ble_hs_test_util.c
       net/nimble/host/test/src/ble_hs_test_util.c: In function 'ble_hs_test_util_create_rpa_conn':
       net/nimble/host/test/src/ble_hs_test_util.c:411:79: error: macro "memcpy" passed 10 arguments, but takes just 3
            memcpy(evt2.features, (uint8_t[]){ conn_features, 0, 0, 0, 0, 0, 0, 0 }, 8);
                                                                                      ^
       net/nimble/host/test/src/ble_hs_test_util.c:411:5: error: statement with no effect [-Werror=unused-value]
            memcpy(evt2.features, (uint8_t[]){ conn_features, 0, 0, 0, 0, 0, 0, 0 }, 8);
            ^
       cc1: all warnings being treated as errors
   ```
   
   This error occurs on the mac because its standard library implements `memcpy()` as a macro rather than a function.  The reason for the error is explained here: https://stackoverflow.com/a/5559334.  Basically, the preprocessor doesn't understand the full C syntax, so arguments to
   macros need special treatment.
   
   The fix is to surround the compound literal argument with an extra set of parenthesis.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services