fixes for warnings when building the application in lib/libpcap
Details
Details
Diff Detail
Diff Detail
- Lint
No Lint Coverage - Unit
No Test Coverage - Build Status
Buildable 9830 Build 10265: arc lint + arc unit
Event Timeline
Comment Actions
Changelog:
Pre-fix warnings are at: https://gist.github.com/aprieger-llnw/42d7f6af7bc0daabd37d209befd6f9f4
- contrib/libpcap/bpf/net/bpf_filter.c
- warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
- fix: modified the function that defines SOLARIS to accommodate the design desired by clang
- warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
Comment Actions
The old code will always #define SOLARIS with a value of 1 or 0. (true/false)
The new code will #define SOLARIS to NULL(?) if the conditions are set and it will be undefined in all other cases.
I don't think this is correct, no?
Take a look at the follow code snippet. In this case, if we build it on FreeBSD, all is well and SOLARIS is defined as the value 1. If we build on linux, SOLARIS is undefined and we get a compile error.
#include <stdio.h> #ifdef __FreeBSD__ #define SOLARIS 1 #endif int main() { printf("Value of SOLARIS is %d\n", SOLARIS); return 0; }
contrib/libpcap/bpf/net/bpf_filter.c | ||
---|---|---|
65 | Just define SOLARIS 1 in the first case, and 0 in the second case. |