From: Roy Marples Date: Sun, 21 Dec 2014 19:00:19 +0000 (+0000) Subject: Fix compile warnings without INET or INET6 using gcc. X-Git-Tag: v6.7.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca867830abdb6578c90f40234daf5ebcee70a261;p=thirdparty%2Fdhcpcd.git Fix compile warnings without INET or INET6 using gcc. --- diff --git a/arp.h b/arp.h index 41c91ee9..71c34676 100644 --- a/arp.h +++ b/arp.h @@ -75,6 +75,6 @@ void arp_free(struct arp_state *); void arp_free_but(struct arp_state *); void arp_close(struct interface *); #else -#define arp_close(a) +#define arp_close(a) {} #endif #endif diff --git a/dhcp.h b/dhcp.h index d78ff4f7..18a99685 100644 --- a/dhcp.h +++ b/dhcp.h @@ -290,13 +290,13 @@ void dhcp_close(struct interface *); void dhcp_free(struct interface *); int dhcp_dump(struct interface *); #else -#define dhcp_drop(a, b) +#define dhcp_drop(a, b) {} #define dhcp_start(a) {} -#define dhcp_reboot(a, b) b = b -#define dhcp_reboot_newopts(a, b) -#define dhcp_close(a) -#define dhcp_free(a) -#define dhcp_dump(a) -1 +#define dhcp_reboot(a, b) (b = b) +#define dhcp_reboot_newopts(a, b) (b = b) +#define dhcp_close(a) {} +#define dhcp_free(a) {} +#define dhcp_dump(a) (-1) #endif #endif diff --git a/dhcp6.h b/dhcp6.h index 0e7ee806..f50af0b6 100644 --- a/dhcp6.h +++ b/dhcp6.h @@ -246,13 +246,13 @@ void dhcp6_drop(struct interface *, const char *); int dhcp6_dump(struct interface *); #else #define dhcp6_findaddr(a, b, c) (0) -#define dhcp6_find_delegates(a) +#define dhcp6_find_delegates(a) {} #define dhcp6_start(a, b) (0) -#define dhcp6_reboot(a) -#define dhcp6_env(a, b, c, d, e) -#define dhcp6_free(a) +#define dhcp6_reboot(a) {} +#define dhcp6_env(a, b, c, d, e) {} +#define dhcp6_free(a) {} #define dhcp6_dadcompleted(a) (0) -#define dhcp6_drop(a, b) +#define dhcp6_drop(a, b) {} #define dhcp6_dump(a) (-1) #endif diff --git a/if-bsd.c b/if-bsd.c index b61d80c7..817c8e13 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -145,6 +145,7 @@ if_openlinksocket(void) #endif } +#if defined(INET) || defined(INET6) static void if_linkaddr(struct sockaddr_dl *sdl, const struct interface *ifp) { @@ -157,6 +158,7 @@ if_linkaddr(struct sockaddr_dl *sdl, const struct interface *ifp) link_addr(ifp->name, sdl); #endif } +#endif static int if_getssid1(const char *ifname, uint8_t *ssid) diff --git a/if-options.c b/if-options.c index 89835034..06e3a591 100644 --- a/if-options.c +++ b/if-options.c @@ -526,6 +526,11 @@ set_option_space(struct dhcpcd_ctx *ctx, uint8_t *request[], uint8_t *require[], uint8_t *no[]) { +#if !defined(INET) && !defined(INET6) + /* Satisfy use */ + ctx = ctx; +#endif + #ifdef INET6 if (strncmp(arg, "dhcp6_", strlen("dhcp6_")) == 0) { *d = ctx->dhcp6_opts; diff --git a/ipv6.h b/ipv6.h index ec4102c8..8e46ebc2 100644 --- a/ipv6.h +++ b/ipv6.h @@ -214,11 +214,11 @@ int ipv6_removesubnet(struct interface *, struct ipv6_addr *); void ipv6_buildroutes(struct dhcpcd_ctx *); #else -#define ipv6_init(a) NULL +#define ipv6_init(a) (NULL) #define ipv6_start(a) (-1) -#define ipv6_free_ll_callbacks(a) -#define ipv6_free(a) -#define ipv6_ctxfree(a) +#define ipv6_free_ll_callbacks(a) {} +#define ipv6_free(a) {} +#define ipv6_ctxfree(a) {} #endif #endif diff --git a/ipv6nd.h b/ipv6nd.h index 310eb68e..4d1c516c 100644 --- a/ipv6nd.h +++ b/ipv6nd.h @@ -101,10 +101,10 @@ void ipv6nd_neighbour(struct dhcpcd_ctx *, struct in6_addr *, int); #else #define ipv6nd_startrs(a) {} #define ipv6nd_findaddr(a, b, c) (0) -#define ipv6nd_free(a) +#define ipv6nd_free(a) {} #define ipv6nd_hasra(a) (0) #define ipv6nd_dadcompleted(a) (0) -#define ipv6nd_drop(a) +#define ipv6nd_drop(a) {} #endif #endif diff --git a/script.c b/script.c index 9a8dd2d4..fef322ac 100644 --- a/script.c +++ b/script.c @@ -229,7 +229,9 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) { char **env, **nenv, *p; size_t e, elen, l; +#if defined(INET) || defined(INET6) ssize_t n; +#endif const struct if_options *ifo = ifp->options; const struct interface *ifp2; #ifdef INET @@ -274,7 +276,9 @@ make_env(const struct interface *ifp, const char *reason, char ***argv) strcmp(reason, "UNKNOWN") == 0 || strcmp(reason, "DEPARTED") == 0 || strcmp(reason, "STOPPED") == 0) - ; + { + /* This space left intentionally blank */ + } #ifdef INET else dhcp = 1;