Skip to content

Build issues with all warnings and pedantic defined #37

@skliper

Description

@skliper

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions