Page MenuHomeFreeBSD

lib/libpcap build warning fixes
ClosedPublic

Authored by aprieger_llnw.com on Jun 12 2017, 9:46 PM.
Tags
None
Referenced Files
F108082649: D11166.diff
Tue, Jan 21, 5:47 AM
Unknown Object (File)
Dec 11 2024, 8:43 AM
Unknown Object (File)
Nov 16 2024, 1:58 AM
Unknown Object (File)
Oct 18 2024, 3:18 AM
Unknown Object (File)
Oct 14 2024, 2:03 AM
Unknown Object (File)
Oct 3 2024, 10:04 PM
Unknown Object (File)
Sep 30 2024, 12:36 PM
Unknown Object (File)
Sep 20 2024, 6:26 AM
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.