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

Build issues with all warnings and pedantic defined #37

Closed
skliper opened this issue Nov 5, 2019 · 1 comment · Fixed by #39
Closed

Build issues with all warnings and pedantic defined #37

skliper opened this issue Nov 5, 2019 · 1 comment · Fixed by #39
Labels
enhancement New feature or request

Comments

@skliper
Copy link
Contributor

skliper commented Nov 5, 2019

Describe the bug
With "-Wall -Wstrict-prototypes -std=c99 -pedantic -Wcast-align" defined, multiple issues observed:

[ 14%] Building C object tools/cFS-GroundSystem/Subsystems/cmdUtil/CMakeFiles/cmdUtil.dir/cmdUtil.c.o
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/cmdUtil.c: In function ‘main’:
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/cmdUtil.c:507:17: warning: overflow in implicit constant conversion [-Woverflow]
     tempShort = 0xC000; /* Sequence word. */
                 ^
[ 28%] Building C object tools/cFS-GroundSystem/Subsystems/cmdUtil/CMakeFiles/cmdUtil.dir/SendUdp.c.o
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c: In function ‘SendUdp’:
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:55:25: error: storage size of ‘hints’ isn’t known
     struct addrinfo     hints;
                         ^
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:78:30: error: invalid application of ‘sizeof’ to incomplete type ‘struct addrinfo’
     memset(&hints, 0, sizeof(struct addrinfo));
                              ^
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:81:25: error: ‘AI_CANONNAME’ undeclared (first use in this function)
     hints.ai_flags    = AI_CANONNAME;
                         ^
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:81:25: note: each undeclared identifier is reported only once for each function it appears in
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:84:15: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
     errcode = getaddrinfo(hostname, portNum, &hints, &result);
               ^
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:89:63: error: dereferencing pointer to incomplete type ‘struct addrinfo’
     printf("sending data to '%s' (IP : %s); port %d\n", result->ai_canonname,
                                                               ^
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:132:9: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
         freeaddrinfo(result);
         ^
/home/jhageman/cFS/cFS-GitHub/tools/cFS-GroundSystem/Subsystems/cmdUtil/SendUdp.c:55:25: warning: unused variable ‘hints’ [-Wunused-variable]
     struct addrinfo     hints;
                         ^

To Reproduce
Steps to reproduce the behavior:

  1. add_definitions("-Wall -Wstrict-prototypes -std=c99 -pedantic -Wcast-align") to mission_build.cmake prepare function
  2. make prep and make

Expected behavior
Clean build

Code snips
N/A

System observed on:

  • Hardware: cFS Dev Server
  • OS: Ubuntu 16.04
  • Versions: master bundle

Additional context
N/A

Reporter Info
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Nov 5, 2019

User error on everything except the first warning, was missing -D_XOPEN_SOURCE=600 flag.

skliper added a commit that referenced this issue Nov 15, 2019
Fixes #37 
Code reviewed and approved at 20191106 CCB
@skliper skliper added the enhancement New feature or request label Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant