Page MenuHomeFreeBSD

lib/libpcap build warning fixes
ClosedPublic

Authored by aprieger_llnw.com on Jun 12 2017, 9:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 13, 8:43 AM
Unknown Object (File)
Tue, Nov 4, 11:34 PM
Unknown Object (File)
Sat, Nov 1, 2:40 AM
Unknown Object (File)
Sat, Nov 1, 1:36 AM
Unknown Object (File)
Fri, Oct 31, 2:46 AM
Unknown Object (File)
Oct 13 2025, 6:07 AM
Unknown Object (File)
Oct 12 2025, 10:00 AM
Unknown Object (File)
Oct 5 2025, 2:01 PM
Subscribers
None

Details

Summary

fixes for warnings when building the application in lib/libpcap

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Changelog:
Pre-fix warnings are at: https://gist.github.com/aprieger-llnw/42d7f6af7bc0daabd37d209befd6f9f4

  1. 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

Note: remaining warnings:

  • yacc: 38 shift/reduce conflicts.
sbruno requested changes to this revision.Jun 17 2017, 7:09 PM

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;
}
This revision now requires changes to proceed.Jun 17 2017, 7:09 PM
contrib/libpcap/bpf/net/bpf_filter.c
65 ↗(On Diff #29515)

Just define SOLARIS 1 in the first case, and 0 in the second case.

aprieger_llnw.com edited edge metadata.
  • lib>libpcap revision update
This revision was automatically updated to reflect the committed changes.