You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2022/03/22 10:57:38 UTC

[GitHub] [celix] PengZheng opened a new pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

PengZheng opened a new pull request #404:
URL: https://github.com/apache/celix/pull/404


   Build assertion add by myself triggered when cross-building for some 32-bit ARM SOCs:
   
   ```
   /data1/zhengpeng/.conan/data/celix/2.2.3/zhengpeng/testing/build/da240cb99c76219749ba20006c5c321d1fa57aeb/libs/utils/src/array_list.c: In function ‘celix_arrayList_defaultEquals’:
   /data1/zhengpeng/.conan/data/celix/2.2.3/zhengpeng/testing/build/da240cb99c76219749ba20006c5c321d1fa57aeb/libs/utils/src/array_list.c:64:5: error: size of unnamed array is negative
        CELIX_BUILD_ASSERT(sizeof(a.voidPtrVal) == sizeof(a));
        ^~~~~~~~~~~~~~~~~~
   ```
   
   On such platforms, sizeof(double) > sizeof(void *). An immediate fix and some optimizations are applied.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng commented on a change in pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

Posted by GitBox <gi...@apache.org>.
PengZheng commented on a change in pull request #404:
URL: https://github.com/apache/celix/pull/404#discussion_r832133972



##########
File path: libs/utils/src/array_list.c
##########
@@ -409,61 +409,62 @@ size_t celix_arrayList_getSize(const celix_array_list_t *list, int index) { retu
 
 static void arrayList_addEntry(celix_array_list_t *list, celix_array_list_entry_t entry) {
     arrayList_ensureCapacity(list, (int)list->size + 1);
-    memset(&list->elementData[list->size], 0, sizeof(entry));
     list->elementData[list->size++] = entry;
 }
 
 void celix_arrayList_add(celix_array_list_t *list, void * element) {
-    celix_array_list_entry_t entry = { .voidPtrVal = element };

Review comment:
       Now that sizeof(void*) != sizeof(entry), it's buggy. 
   
   Mislead by https://en.cppreference.com/w/c/language/struct_initialization:
   
   >All members that are not initialized explicitly are [zero-initialized](https://en.cppreference.com/w/c/language/initialization#Zero_initialization)
   
   I thought `memset` unnecessary, and almost reintroduced the bug you already solved once, @pnoltes 
   Thanks to our CI: https://github.com/apache/celix/runs/5643661568?check_suite_focus=true 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter commented on pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #404:
URL: https://github.com/apache/celix/pull/404#issuecomment-1075074933


   # [Codecov](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#404](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (17c4d16) into [master](https://codecov.io/gh/apache/celix/commit/3b651daecc2e61cdcc00419cd537b5ec986a2472?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3b651da) will **decrease** coverage by `0.02%`.
   > The diff coverage is `85.18%`.
   
   > :exclamation: Current head 17c4d16 differs from pull request most recent head 493c1af. Consider uploading reports for the commit 493c1af to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #404      +/-   ##
   ==========================================
   - Coverage   73.12%   73.10%   -0.03%     
   ==========================================
     Files         205      205              
     Lines       31272    31256      -16     
   ==========================================
   - Hits        22869    22850      -19     
   - Misses       8403     8406       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...sub/pubsub\_admin\_tcp/src/pubsub\_tcp\_topic\_sender.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX2FkbWluX3RjcC9zcmMvcHVic3ViX3RjcF90b3BpY19zZW5kZXIuYw==) | `84.51% <0.00%> (-0.38%)` | :arrow_down: |
   | [...ubsub\_admin\_udp\_mc/src/pubsub\_udpmc\_topic\_sender.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX2FkbWluX3VkcF9tYy9zcmMvcHVic3ViX3VkcG1jX3RvcGljX3NlbmRlci5j) | `54.59% <0.00%> (-0.32%)` | :arrow_down: |
   | [libs/utils/src/array\_list.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy91dGlscy9zcmMvYXJyYXlfbGlzdC5j) | `87.50% <91.66%> (-0.08%)` | :arrow_down: |
   | [libs/framework/src/framework.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy9mcmFtZXdvcmsvc3JjL2ZyYW1ld29yay5j) | `79.54% <100.00%> (ø)` | |
   | [libs/utils/src/hash\_map.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy91dGlscy9zcmMvaGFzaF9tYXAuYw==) | `93.25% <0.00%> (-0.85%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [3b651da...493c1af](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng merged pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

Posted by GitBox <gi...@apache.org>.
PengZheng merged pull request #404:
URL: https://github.com/apache/celix/pull/404


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] codecov-commenter edited a comment on pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #404:
URL: https://github.com/apache/celix/pull/404#issuecomment-1075074933


   # [Codecov](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#404](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c0bc6a8) into [master](https://codecov.io/gh/apache/celix/commit/6f1817d5ce14b61cfcb20369ce4fff1f93cba36d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6f1817d) will **decrease** coverage by `0.00%`.
   > The diff coverage is `90.90%`.
   
   > :exclamation: Current head c0bc6a8 differs from pull request most recent head a4cb88d. Consider uploading reports for the commit a4cb88d to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #404      +/-   ##
   ==========================================
   - Coverage   73.13%   73.12%   -0.01%     
   ==========================================
     Files         205      205              
     Lines       31274    31274              
   ==========================================
   - Hits        22872    22869       -3     
   - Misses       8402     8405       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [libs/utils/src/array\_list.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy91dGlscy9zcmMvYXJyYXlfbGlzdC5j) | `87.57% <90.90%> (ø)` | |
   | [libs/utils/src/hash\_map.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bGlicy91dGlscy9zcmMvaGFzaF9tYXAuYw==) | `93.25% <0.00%> (-1.69%)` | :arrow_down: |
   | [...sub/pubsub\_admin\_tcp/src/pubsub\_tcp\_topic\_sender.c](https://codecov.io/gh/apache/celix/pull/404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnVuZGxlcy9wdWJzdWIvcHVic3ViX2FkbWluX3RjcC9zcmMvcHVic3ViX3RjcF90b3BpY19zZW5kZXIuYw==) | `85.84% <0.00%> (+1.32%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [6f1817d...a4cb88d](https://codecov.io/gh/apache/celix/pull/404?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng commented on a change in pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

Posted by GitBox <gi...@apache.org>.
PengZheng commented on a change in pull request #404:
URL: https://github.com/apache/celix/pull/404#discussion_r832133972



##########
File path: libs/utils/src/array_list.c
##########
@@ -409,61 +409,62 @@ size_t celix_arrayList_getSize(const celix_array_list_t *list, int index) { retu
 
 static void arrayList_addEntry(celix_array_list_t *list, celix_array_list_entry_t entry) {
     arrayList_ensureCapacity(list, (int)list->size + 1);
-    memset(&list->elementData[list->size], 0, sizeof(entry));
     list->elementData[list->size++] = entry;
 }
 
 void celix_arrayList_add(celix_array_list_t *list, void * element) {
-    celix_array_list_entry_t entry = { .voidPtrVal = element };

Review comment:
       Now that sizeof(void*) != sizeof(entry), it's buggy. 
   
   Mislead by https://en.cppreference.com/w/c/language/struct_initialization:
   
   >All members that are not initialized explicitly are [zero-initialized](https://en.cppreference.com/w/c/language/initialization#Zero_initialization)
   
   I thought `memset` in unnecessary, and almost reintroduced the bug you already solved once, @pnoltes 
   Thanks to our CI: https://github.com/apache/celix/runs/5643661568?check_suite_focus=true 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [celix] PengZheng commented on a change in pull request #404: Fix broken array list equality on some 32-bit platforms where sizeof(…

Posted by GitBox <gi...@apache.org>.
PengZheng commented on a change in pull request #404:
URL: https://github.com/apache/celix/pull/404#discussion_r832128453



##########
File path: libs/utils/src/array_list.c
##########
@@ -197,7 +197,7 @@ int arrayList_addIndex(array_list_pt list, unsigned int index, void * element) {
     }
     arrayList_ensureCapacity(list, (int)list->size+1);
     numMoved = list->size - index;
-    memmove(list->elementData+(index+1), list->elementData+index, sizeof(void *) * numMoved);
+    memmove(list->elementData+(index+1), list->elementData+index, sizeof(celix_array_list_entry_t) * numMoved);

Review comment:
       If sizeof(void*) != sizeof(entry), then use of sizeof(void*) is buggy.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org