]> The Tcpdump Group git mirrors - libpcap/commitdiff
Squelch some "no declaration before definition" warnings.
authorGuy Harris <[email protected]>
Tue, 3 Apr 2018 01:52:07 +0000 (18:52 -0700)
committerGuy Harris <[email protected]>
Tue, 3 Apr 2018 01:52:07 +0000 (18:52 -0700)
We are deliberately not declaring those variables in header files,
because they were never so declared in any libpcap API, and because we
don't want people to use them.  We only keep them exported to avoid
causing breakage for binaries that happen to use them; if, as, and when
either 1) we're sure there aren't any binaries that use them or 2)
decide we don't care whether those binaries stop working, we can get rid
of them.

nametoaddr.c
pcap.c

index 2b7475adbf41f92ba5d613567de952225a642bb6..a749b8e68c4fdb29cb9d9710532ea451e992b8c9 100644 (file)
@@ -545,7 +545,12 @@ struct eproto {
  * Debian, at least, so make it a public symbol, even though we
  * don't officially export it by declaring it in a header file.
  * (Programs *should* do this themselves, as tcpdump now does.)
+ *
+ * We declare it here, right before defining it, to squelch any
+ * warnings we might get from compilers about the lack of a
+ * declaration.
  */
+extern struct eproto eproto_db[];
 PCAP_API_DEF struct eproto eproto_db[] = {
        { "pup", ETHERTYPE_PUP },
        { "xns", ETHERTYPE_NS },
diff --git a/pcap.c b/pcap.c
index 358c01eb5e4058ce520c7556aea3a1cf260494c2..e1d88389216229e2cdba1c80cf3a38464738f48d 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -176,7 +176,12 @@ pcap_wsockinit(void)
  * Not explicitly exported via a header file - the right API to use
  * is pcap_lib_version() - but some programs included it, so we
  * provide it.
+ *
+ * We declare it here, right before defining it, to squelch any
+ * warnings we might get from compilers about the lack of a
+ * declaration.
  */
+extern char pcap_version[];
 PCAP_API_DEF char pcap_version[] = PACKAGE_VERSION;
 
 static int