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

iox-#1280 use proper prototypes in C binding #1281

Conversation

eboasson
Copy link
Contributor

@eboasson eboasson commented Mar 11, 2022

Declaring a function in C that takes no argument requires "(void)".
With strict warning settings, C compilers will issue a warning.

Fixes #1280

Signed-off-by: Erik Boasson eb@ilities.com

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-#123-this-is-a-branch)
  5. Commits messages are according to this guideline
    • Commit messages have the issue ID (iox-#123 commit text)
    • Commit messages are signed (git commit -s)
    • Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. Assign PR to reviewer

Notes for Reviewer

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
    • Each unit test case has a unique UUID
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Declaring a function in C that takes no argument requires "(void)".
With strict warning settings, C compilers will issue a warning.

Signed-off-by: Erik Boasson <eb@ilities.com>
@MatthiasKillat MatthiasKillat self-requested a review March 11, 2022 09:54
Copy link
Contributor

@elfenpiff elfenpiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eboasson Out of curiosity, do you may have a clue why the apple clang version reports in this case an error and the linux version doesn't.
I recompiled it to see if we may overlooked something in our CI but with:

# clang --version
clang version 13.0.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/13/bin

in combination with -Wall -Werror -pedantic -Wextra -Wconversion -Wuninitialized I do not get any warning.

Copy link
Contributor

@MatthiasKillat MatthiasKillat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is probably required to provide void in C (but not in C++, where it is equivalent to no type in the argument list). See also https://stackoverflow.com/questions/693788/is-it-better-to-use-c-void-arguments-void-foovoid-or-not-void-foo. I have not tried to find at a source in the C standard yet, but I remember having such an issue a long time ago.

@eboasson
Copy link
Contributor Author

@elfenpiff I suspect it is -Wstrict-prototypes that causes the warning. That gets enabled by Cyclone's CMakeLists.txt for Clang, so you would expect it to fail on Cyclone DDS CI as well, but it doesn't ... 🤔

@codecov
Copy link

codecov bot commented Mar 11, 2022

Codecov Report

Merging #1281 (bb70623) into release_2.0 (46c7cf3) will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           release_2.0    #1281      +/-   ##
===============================================
+ Coverage        78.91%   78.98%   +0.06%     
===============================================
  Files              370      370              
  Lines            14706    14706              
  Branches          2059     2059              
===============================================
+ Hits             11605    11615      +10     
+ Misses            2419     2410       -9     
+ Partials           682      681       -1     
Flag Coverage Δ
unittests 78.21% <ø> (+0.06%) ⬆️
unittests_timing 15.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
iceoryx_posh/source/roudi/port_manager.cpp 85.39% <0.00%> (+1.12%) ⬆️
iceoryx_hoofs/source/concurrent/loffli.cpp 91.42% <0.00%> (+11.42%) ⬆️

@MatthiasKillat MatthiasKillat merged commit 4eabe77 into eclipse-iceoryx:release_2.0 Mar 11, 2022
@elBoberido elBoberido linked an issue Mar 11, 2022 that may be closed by this pull request
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.

binding_c needs "proper" prototypes
3 participants