diff --git a/cli.c b/cli.c index a4400708..e4ed6144 100644 --- a/cli.c +++ b/cli.c @@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include +#include "cli.h" #include "constants.h" #include "serval_types.h" #include "rhizome_types.h" @@ -28,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "str.h" #include "strbuf_helpers.h" #include "dataformats.h" -#include "cli.h" int cli_usage(const struct cli_schema *commands, XPRINTF xpf) { diff --git a/cli.h b/cli.h index 40fa0e85..fb606920 100644 --- a/cli.h +++ b/cli.h @@ -20,13 +20,12 @@ #ifndef __SERVAL_DNA__CLI_H #define __SERVAL_DNA__CLI_H -#include "xprintf.h" -#include "log.h" #include - #ifdef HAVE_JNI_H #include #endif +#include "xprintf.h" +#include "log.h" #define COMMAND_LINE_MAX_LABELS (32) diff --git a/constants.h b/constants.h index 6ef5faa2..eb538ed1 100644 --- a/constants.h +++ b/constants.h @@ -25,11 +25,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Number of elements in an array (Warning: does not work if A is a pointer!). #define NELS(A) (sizeof (A) / sizeof *(A)) +// Stop OpenJDK 7 from foisting their UNUSED() macro on us in +#ifdef UNUSED +# undef UNUSED +#endif + // To suppress the "unused parameter" warning from -Wunused-parameter. -#ifdef __GNUC__ -# define UNUSED(x) x __attribute__((__unused__)) +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#if (defined(__GNUC__)) || __has_attribute(unused) + #define UNUSED(x) x __attribute__((__unused__)) #else -# define UNUSED(x) x + #define UNUSED(x) x #endif // UDP Port numbers for various Serval services. diff --git a/directory_service.c b/directory_service.c index 71b1b88d..fae71877 100644 --- a/directory_service.c +++ b/directory_service.c @@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include -#include "constants.h" #include "serval.h" +#include "constants.h" #include "mdp_client.h" #include "str.h" diff --git a/dna_helper.c b/dna_helper.c index 2a35566b..32eb1205 100644 --- a/dna_helper.c +++ b/dna_helper.c @@ -52,13 +52,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include #include "sighandlers.h" +#include "serval.h" #include "conf.h" #include "str.h" #include "strbuf.h" #include "strbuf_helpers.h" #include "dataformats.h" #include "overlay_address.h" -#include "serval.h" /* The challenge with making an interface for calling an external program to diff --git a/keyring.c b/keyring.c index cb5d9070..47f13b6a 100644 --- a/keyring.c +++ b/keyring.c @@ -20,13 +20,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include -#include "constants.h" #include "serval.h" -#include "str.h" -#include "mem.h" -#include "rotbuf.h" -#include "conf.h" #include "rhizome.h" +#include "conf.h" +#include "constants.h" #include "nacl.h" #include "overlay_address.h" #include "crypto.h" @@ -35,6 +32,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "overlay_buffer.h" #include "keyring.h" #include "dataformats.h" +#include "str.h" +#include "mem.h" +#include "rotbuf.h" static void keyring_free_keypair(keypair *kp); static void keyring_free_context(keyring_context *c); diff --git a/meshms_restful.c b/meshms_restful.c index 7b57be98..dc3b8db6 100644 --- a/meshms_restful.c +++ b/meshms_restful.c @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "conf.h" #include "serval.h" +#include "conf.h" #include "httpd.h" #include "strbuf_helpers.h" diff --git a/msp_proxy.c b/msp_proxy.c index f0022b9a..ceca464c 100644 --- a/msp_proxy.c +++ b/msp_proxy.c @@ -18,11 +18,11 @@ */ #include +#include "cli.h" #include "serval_types.h" #include "mdp_client.h" #include "msp_client.h" #include "fdqueue.h" -#include "cli.h" #include "log.h" #include "mem.h" #include "str.h" diff --git a/nonce.c b/nonce.c index 13130cf8..1dba01bf 100644 --- a/nonce.c +++ b/nonce.c @@ -17,9 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "cli.h" #include "constants.h" #include "os.h" -#include "cli.h" int nonce_initialised=0; unsigned char nonce_buffer[128]; diff --git a/rhizome_http.c b/rhizome_http.c index 7c0f8957..866eadc6 100644 --- a/rhizome_http.c +++ b/rhizome_http.c @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "conf.h" #include "serval.h" +#include "conf.h" #include "httpd.h" #include "str.h" #include "strbuf.h" diff --git a/rhizome_restful.c b/rhizome_restful.c index 1894f682..920e23c2 100644 --- a/rhizome_restful.c +++ b/rhizome_restful.c @@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "conf.h" #include "serval.h" +#include "conf.h" #include "httpd.h" #include "strbuf_helpers.h" diff --git a/serval.h b/serval.h index 4680eb3c..5965f372 100644 --- a/serval.h +++ b/serval.h @@ -117,11 +117,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include +#include "cli.h" #include "serval_types.h" #include "sighandlers.h" #include "instance.h" #include "fdqueue.h" -#include "cli.h" #include "constants.h" #include "mem.h" #include "xprintf.h" diff --git a/simulator.c b/simulator.c index ca239700..49cb3a83 100644 --- a/simulator.c +++ b/simulator.c @@ -24,15 +24,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include +#include "console.h" +#include "conf.h" #include "mem.h" #include "socket.h" #include "fdqueue.h" #include "str.h" #include "strbuf.h" #include "strbuf_helpers.h" -#include "conf.h" #include "net.h" -#include "console.h" #include "limit.h" #define MTU 1600