From 614dcfffd2842adf48a08a786da458b39c0246b7 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Fri, 22 Sep 2017 16:24:40 -0400 Subject: [PATCH] Fix more header-related warnings. This fixes all current default warnings with GCC7 on Linux. That does not mean the code is anywhere close to clean. --- arogue5/configure.ac | 2 +- arogue5/mdport.c | 9 +++++++-- arogue7/configure.ac | 2 +- arogue7/mdport.c | 13 +++++++++++-- rogue4/mach_dep.c | 7 ++++++- rogue4/mdport.c | 9 +++++++-- urogue/configure.ac | 2 +- urogue/mdport.c | 9 +++++++-- xrogue/configure.ac | 2 +- xrogue/state.c | 13 +++++++++++-- 10 files changed, 53 insertions(+), 15 deletions(-) diff --git a/arogue5/configure.ac b/arogue5/configure.ac index ddf025f..cfd49d4 100644 --- a/arogue5/configure.ac +++ b/arogue5/configure.ac @@ -13,7 +13,7 @@ AC_PROG_CC MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) +AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h arpa/inet.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T diff --git a/arogue5/mdport.c b/arogue5/mdport.c index 997aa1e..a7446e1 100644 --- a/arogue5/mdport.c +++ b/arogue5/mdport.c @@ -41,11 +41,16 @@ #undef MOUSE_MOVED #elif defined(__DJGPP__) #include +#else +#include #endif #ifdef HAVE_PWD_H #include #endif +#ifdef HAVE_ARPA_INET_H +#include +#endif #ifdef HAVE_SYS_UTSNAME_H #include #endif @@ -552,7 +557,7 @@ int md_endian = 0x01020304; unsigned long int md_ntohl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else @@ -568,7 +573,7 @@ md_ntohl(unsigned long int x) unsigned long int md_htonl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else diff --git a/arogue7/configure.ac b/arogue7/configure.ac index bfc9eec..c7ad7ca 100644 --- a/arogue7/configure.ac +++ b/arogue7/configure.ac @@ -12,7 +12,7 @@ AC_PROG_CC MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h]) +AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h utmp.h term.h ncurses/term.h process.h arpa/inet.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T diff --git a/arogue7/mdport.c b/arogue7/mdport.c index 7df1f19..12258a5 100644 --- a/arogue7/mdport.c +++ b/arogue7/mdport.c @@ -29,6 +29,10 @@ SUCH DAMAGE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #if defined(_WIN32) #include #include @@ -40,6 +44,7 @@ #include #else #include +#include #include #include #endif @@ -73,6 +78,10 @@ #include #include +#ifdef HAVE_ARPA_INET_H +#include +#endif + #define MOD_MOVE(c) (toupper(c) ) void @@ -533,7 +542,7 @@ int md_endian = 0x01020304; unsigned long int md_ntohl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else @@ -549,7 +558,7 @@ md_ntohl(unsigned long int x) unsigned long int md_htonl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else diff --git a/rogue4/mach_dep.c b/rogue4/mach_dep.c index b254105..fc0ca41 100644 --- a/rogue4/mach_dep.c +++ b/rogue4/mach_dep.c @@ -38,6 +38,11 @@ #include #include #include + +#ifdef CHECKTIME +#include +#endif + #include "rogue.h" int num_checks; /* times we've gone over in checkout() */ @@ -266,9 +271,9 @@ checkout(int s) #ifdef CHECKTIME checktime = (CHECKTIME * 60) / num_checks; -#endif #ifdef SIGALRM alarm(checktime); +#endif #endif chmsg(msgs[num_checks - 1], ((double) checktime / 60.0)); diff --git a/rogue4/mdport.c b/rogue4/mdport.c index c0958b5..e459354 100644 --- a/rogue4/mdport.c +++ b/rogue4/mdport.c @@ -43,6 +43,8 @@ #undef MOUSE_MOVED #elif defined(__DJGPP__) #include +#else +#include #endif #ifdef HAVE_PWD_H @@ -54,6 +56,9 @@ #ifdef HAVE_UTMPX_H #include #endif +#ifdef HAVE_ARPA_INET_H +#include +#endif #ifdef __INTERIX char *strdup(const char *s); @@ -535,7 +540,7 @@ int md_endian = 0x01020304; unsigned long int md_ntohl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else @@ -551,7 +556,7 @@ md_ntohl(unsigned long int x) unsigned long int md_htonl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else diff --git a/urogue/configure.ac b/urogue/configure.ac index 47c7a3a..cc25f95 100644 --- a/urogue/configure.ac +++ b/urogue/configure.ac @@ -12,7 +12,7 @@ AC_PROG_CC MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h utmpx.h term.h ncurses/term.h process.h]) +AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h nlist.h stdlib.h string.h sys/ioctl.h termios.h unistd.h utmp.h utmpx.h term.h ncurses/term.h process.h arpa/inet.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_UID_T diff --git a/urogue/mdport.c b/urogue/mdport.c index 0e3830f..53b86c8 100644 --- a/urogue/mdport.c +++ b/urogue/mdport.c @@ -49,6 +49,7 @@ #else #include #include +#include #include #include #endif @@ -57,6 +58,10 @@ #include #include +#ifdef HAVE_ARPA_INET_H +#include +#endif + #if defined(_WIN32) && !defined(__MINGW32__) #define PATH_MAX MAX_PATH #endif @@ -544,7 +549,7 @@ int md_endian = 0x01020304; unsigned long int md_ntohl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else @@ -560,7 +565,7 @@ md_ntohl(unsigned long int x) unsigned long int md_htonl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else diff --git a/xrogue/configure.ac b/xrogue/configure.ac index bae2aef..dc25a8b 100644 --- a/xrogue/configure.ac +++ b/xrogue/configure.ac @@ -12,7 +12,7 @@ AC_PROG_CC MP_WITH_CURSES # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h term.h ncurses/term.h process.h]) +AC_CHECK_HEADERS([pwd.h errno.h fcntl.h limits.h stdlib.h string.h sys/ioctl.h sys/utsname.h termios.h unistd.h term.h ncurses/term.h process.h arpa/inet.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T diff --git a/xrogue/state.c b/xrogue/state.c index d825e38..888a5b4 100644 --- a/xrogue/state.c +++ b/xrogue/state.c @@ -52,6 +52,10 @@ #define RSXR_COORDLIST 0XABCD0016 #define RSXR_ROOMS 0XABCD0017 +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #if defined(_WIN32) #include #include @@ -62,6 +66,7 @@ #include #else #include +#include #include #include #endif @@ -84,6 +89,10 @@ #include #endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + int md_fileno(FILE *fp); #define READSTAT ((format_error == 0) && (read_error == 0)) @@ -3439,7 +3448,7 @@ int md_endian = 0x01020304; unsigned long int md_ntohl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else @@ -3455,7 +3464,7 @@ md_ntohl(unsigned long int x) unsigned long int md_htonl(unsigned long int x) { -#ifdef _WIN32 +#ifndef HAVE_ARPA_INET_H if ( *((char *)&md_endian) == 0x01 ) return(x); else