farsightsec / nmsg

network message encapsulation library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile warnings on OS X

mschiffm opened this issue · comments

The newest release of nmsg has two complaints when building on OS X.

Struct timespec warnings

In several places the following warning shows up:

...
In file included from ./nmsg/nmsg.h:93:
./nmsg/input.h:262:15: warning: declaration of 'struct timespec' will not be
      visible outside of this function [-Wvisibility]
                     struct timespec *ts, nmsg_message_t **msg, size_t *n_msg);
                            ^
1 warning generated.
...

Comparison always true

This doesn't complain on Linux, just OS X:

...
nmsg/res.c:43:10: warning: comparison of constant 16 with expression of type
      'enum nmsg_res' is always true
      [-Wtautological-constant-out-of-range-compare]
            val <= sizeof(res_strings) / sizeof(char *) &&
            ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
...

Both fixes are pushed to my fork and a PR has been issued: mschiffm@8c51879

Should be fixed in #34 + #35.

@mschiffm Can you check if the next branch compiles without these warnings on OS X and close this issue if so?

Thanks!

The above warnings are fixed. However, there is a new one:

...
  CC       nmsg/msgmod/transparent_json.lo
nmsg/msgmod/transparent_json.c:171:19: warning: comparison of unsigned
      expression < 0 is always false [-Wtautological-compare]
                        if (enum_value < 0 || enum_value >= enum_descr->...
                            ~~~~~~~~~~ ^ ~
...

enum_value is declared here: https://github.com/farsightsec/nmsg/blob/next/nmsg/msgmod/transparent_json.c#L152 as an unsigned value.

...Which I just read is closed: #36