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)
Apr 10 2024, 1:39 AM
Unknown Object (File)
Apr 7 2024, 4:07 PM
Unknown Object (File)
Mar 19 2024, 3:41 PM
Unknown Object (File)
Mar 19 2024, 2:51 PM
Unknown Object (File)
Mar 10 2024, 11:44 AM
Unknown Object (File)
Mar 10 2024, 11:43 AM
Unknown Object (File)
Mar 10 2024, 11:43 AM
Unknown Object (File)
Mar 10 2024, 11:43 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.