[MPlayer-dev-eng] [PATCH] Silence some -Wundef warnings
Josh
joshf87 at live.com
Tue Jan 22 05:27:58 CET 2013
On 1/21/2013 17:58, Diego Biurrun wrote:
> On Tue, Jan 08, 2013 at 11:39:27AM +0100, Erik Auerswald wrote:
>>
>> the attached patch silences some -Wundef warnings by always creating
>> the relevant #defines, even when not configuring for Windows:
>>
>> libdvdcss/libdvdcss.c:123:5: warning: "HAVE_DIRECT_H" is not defined
>> [-Wundef]
>> libdvdcss/libdvdcss.c:241:5: warning: "HAVE_DIRECT_H" is not defined
>> [-Wundef]
>> libavformat/cache.c:36:5: warning: "HAVE_IO_H" is not defined [-Wundef]
>> libavformat/file.c:26:5: warning: "HAVE_IO_H" is not defined [-Wundef]
>> libavutil/file.c:28:5: warning: "HAVE_IO_H" is not defined [-Wundef]
>> libavutil/log.c:32:5: warning: "HAVE_IO_H" is not defined [-Wundef]
>>
>> I have tested the patch on GNU/Linux, not on Windows, but it looks
>> "obviously correct" to me. ;-)
>
> I only saw this patch now and already fixed the issue differently
> earlier today. Thanks for the patch anyway.
>
> In case you are motivated, there are many -Wundef warnings lurking
> still :)
>
> Diego
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
>
>
This is what I came up with so far it is still a work in progress, I cut
32 Wundefs down to 7. I only tested under MinGW/Windows and checked
against ffmpeg's config.h for defines that should be "1".
-------------- next part --------------
Index: configure
===================================================================
--- configure (revision 35820)
+++ configure (working copy)
@@ -3264,13 +3264,46 @@
echores "$_mkstemp"
+echocheck "cryptgenrandom"
+_cryptgenrandom=no
+statement_check_broken windows.h wincrypt.h 'long check_CryptGenRandom(void) { return (long) CryptGenRandom; }' && _cryptgenrandom=yes
+if test "$_cryptgenrandom" = yes ; then
+ def_cryptgenrandom='#define HAVE_CRYPTGENRANDOM 1'
+else
+ def_cryptgenrandom='#define HAVE_CRYPTGENRANDOM 0'
+fi
+echores "$_cryptgenrandom"
+
+
+echocheck "sleep"
+_sleep=no
+statement_check windows.h 'long check_Sleep(void) { return (long) Sleep; }' && _sleep=yes
+if test "$_sleep" = yes ; then
+ def_sleep='#define HAVE_SLEEP 1'
+else
+ def_sleep='#define HAVE_SLEEP 0'
+fi
+echores "$_sleep"
+
+
+echocheck "usleep"
+_usleep=no
+statement_check unistd.h 'usleep(0)' && _usleep=yes
+if test "$_usleep" = yes ; then
+ def_usleep='#define HAVE_USLEEP 1'
+else
+ def_usleep='#define HAVE_USLEEP 0'
+fi
+echores "$_usleep"
+
+
echocheck "nanosleep"
_nanosleep=no
statement_check time.h 'nanosleep(0, 0)' && _nanosleep=yes
if test "$_nanosleep" = yes ; then
def_nanosleep='#define HAVE_NANOSLEEP 1'
else
- def_nanosleep='#undef HAVE_NANOSLEEP'
+ def_nanosleep='#define HAVE_NANOSLEEP 0'
fi
echores "$_nanosleep"
@@ -3377,6 +3410,27 @@
fi
+echocheck "struct group_source_req"
+_struct_group_source_req=no
+def_struct_group_source_req="#define HAVE_STRUCT_GROUP_SOURCE_REQ 0"
+for header in "netinet/in.h" "ws2tcpip.h" ; do
+ statement_check $header 'struct group_source_req mreq6' && _struct_group_source_req=yes &&
+ def_struct_group_source_req="#define HAVE_STRUCT_GROUP_SOURCE_REQ 1" && break
+done
+echores "$_struct_group_source_req"
+
+
+echocheck "struct ip_mreq_source"
+_struct_ip_mreq_source=no
+def_struct_ip_mreq_source="#define HAVE_STRUCT_IP_MREQ_SOURCE 0"
+for header in "netinet/in.h" "ws2tcpip.h" ; do
+ statement_check $header 'struct ip_mreq_source mreq6' && _struct_ip_mreq_source=yes &&
+ def_struct_ip_mreq_source="#define HAVE_STRUCT_IP_MREQ_SOURCE 1" && break
+done
+echores "$_struct_ip_mreq_source"
+
+
+
echocheck "struct ipv6_mreq"
_struct_ipv6_mreq=no
def_struct_ipv6_mreq="#define HAVE_STRUCT_IPV6_MREQ 0"
@@ -3557,6 +3611,17 @@
echores "$poll_h"
+echocheck "sys/time.h"
+_sys_time_h=no
+header_check sys/time.h && _sys_time_h=yes
+if [ $_sys_time_h = yes ]; then
+ def_sys_time_h='#define HAVE_SYS_TIME_H 1'
+else
+ def_sys_time_h='#define HAVE_SYS_TIME_H 0'
+fi
+echores "$_sys_time_h"
+
+
echocheck "inttypes.h (required)"
_inttypes=no
header_check inttypes.h && _inttypes=yes
@@ -3779,6 +3844,47 @@
fi #if win32; then
+echocheck "getprocessaffinitymask"
+_getprocessaffinitymask=no
+statement_check windows.h 'long check_GetProcessAffinityMask(void) { return (long) GetProcessAffinityMask; }' && _getprocessaffinitymask=yes
+if test "$_getprocessaffinitymask" = yes ; then
+ def_getprocessaffinitymask='#define HAVE_GETPROCESSAFFINITYMASK 1'
+else
+ def_getprocessaffinitymask='#define HAVE_GETPROCESSAFFINITYMASK 0'
+fi
+echores "$_getprocessaffinitymask"
+
+echocheck "sched_getaffinity"
+_sched_getaffinity=no
+statement_check sched.h 'sched_getaffinity(0, 0, 0)' && sched_getaffinity=yes
+if test "$sched_getaffinity" = yes ; then
+ def_sched_getaffinity='#define HAVE_SCHED_GETAFFINITY 1'
+else
+ def_sched_getaffinity='#define HAVE_SCHED_GETAFFINITY 0'
+fi
+echores "$_sched_getaffinity"
+
+echocheck "sysconf"
+_sysconf=no
+statement_check unistd.h 'sysconf(0)' && sysconf=yes
+if test "$sysconf" = yes ; then
+ def_sysconf='#define HAVE_SYSCONF 1'
+else
+ def_sysconf='#define HAVE_SYSCONF 0'
+fi
+echores "$_sysconf"
+
+echocheck "sysctl"
+_sysctl=no
+statement_check sys/sysctl.h 'sysctl(0, 0, 0, 0, 0, 0)' && sysctl=yes
+if test "$sysctl" = yes ; then
+ def_sysctl='#define HAVE_SYSCTL 1'
+else
+ def_sysctl='#define HAVE_SYSCTL 0'
+fi
+echores "$_sysctl"
+
+
echocheck "direct.h"
_direct_h=no
header_check direct.h && _direct_h=yes
@@ -4092,7 +4198,7 @@
gettimeofday=yes
def_gettimeofday='#define HAVE_GETTIMEOFDAY 1'
statement_check sys/time.h 'struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz)' ||
- { gettimeofday=no ; def_gettimeofday='#undef HAVE_GETTIMEOFDAY' ; }
+ { gettimeofday=no ; def_gettimeofday='#define HAVE_GETTIMEOFDAY 0' ; }
echores "$gettimeofday"
@@ -4102,7 +4208,7 @@
glob_win=yes
def_glob='#define HAVE_GLOB 1'
statement_check glob.h 'glob("filename", 0, 0, 0)' ||
- { glob=no ; def_glob='#undef HAVE_GLOB' ;
+ { glob=no ; def_glob='#define HAVE_GLOB 0' ;
mingw32 && glob_win=no ; }
echores "$glob"
@@ -8618,7 +8724,9 @@
/* system functions */
+$def_cryptgenrandom
$def_gethostbyname2
+$def_getprocessaffinitymask
$def_gettimeofday
$def_glob
$def_langinfo
@@ -8629,12 +8737,17 @@
$def_select
$def_setenv
$def_setmode
+$def_sched_getaffinity
$def_shm
+$def_sleep
$def_strsep
+$def_sysconf
+$def_sysctl
$def_sysi86
$def_sysi86_iv
$def_termcap
$def_termios
+$def_usleep
$def_vsscanf
@@ -8824,6 +8937,8 @@
$def_networking
$def_smb
$def_socklen_t
+$def_struct_group_source_req
+$def_struct_ip_mreq_source
$def_struct_ipv6_mreq
$def_struct_sockaddr_in6
$def_struct_sockaddr_sa_len
@@ -8937,6 +9052,7 @@
$def_direct_h
$def_io_h
$def_poll_h
+$def_sys_time_h
$def_windows_h
/* external libraries */
@@ -9015,6 +9131,7 @@
#define CONFIG_GRAY 0
#define CONFIG_LIBMODPLUG 0
#define CONFIG_LIBVORBIS 0
+#define CONFIG_MEMORY_POISONING 0
#define CONFIG_OPENSSL 0
#define CONFIG_POWERPC_PERF 0
/* For now prefer speed over avoiding potential invalid reads */
Index: libmpdemux/mf.c
===================================================================
--- libmpdemux/mf.c (revision 35820)
+++ libmpdemux/mf.c (working copy)
@@ -29,7 +29,7 @@
#include "config.h"
-#ifdef HAVE_GLOB
+#if HAVE_GLOB
#include <glob.h>
#else
#include "osdep/glob.h"
@@ -48,7 +48,7 @@
char * mf_type = NULL; //"jpg";
mf_t* open_mf(char * filename){
-#if defined(HAVE_GLOB) || defined(__MINGW32__)
+#if HAVE_GLOB || defined(__MINGW32__)
glob_t gg;
struct stat fs;
int i;
-------------- next part --------------
Before:
Line 118: libavformat/file.c:88:5: warning: "HAVE_ACCESS" is not defined [-Wundef]
Line 165: libavformat/img2dec.c:30:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 166: libavformat/img2dec.c:60:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 168: libavformat/img2dec.c:97:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 170: libavformat/img2dec.c:255:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 175: libavformat/img2dec.c:288:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 177: libavformat/img2dec.c:355:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 179: libavformat/img2dec.c:425:5: warning: "HAVE_GLOB" is not defined [-Wundef]
Line 285: libavformat/os_support.c:64:5: warning: "HAVE_SYS_TIME_H" is not defined [-Wundef]
Line 287: libavformat/os_support.c:239:5: warning: "HAVE_GETSERVBYPORT" is not defined [-Wundef]
Line 402: libavformat/udp.c:230:5: warning: "HAVE_STRUCT_GROUP_SOURCE_REQ" is not defined [-Wundef]
Line 403: libavformat/udp.c:258:7: warning: "HAVE_STRUCT_IP_MREQ_SOURCE" is not defined [-Wundef]
Line 747: libavcodec/libgsm.c:31:5: warning: "HAVE_GSM_H" is not defined [-Wundef]
Line 951: libavcodec/pthread.c:34:5: warning: "HAVE_SCHED_GETAFFINITY" is not defined [-Wundef]
Line 952: libavcodec/pthread.c:40:5: warning: "HAVE_GETPROCESSAFFINITYMASK" is not defined [-Wundef]
Line 953: libavcodec/pthread.c:43:5: warning: "HAVE_SYSCTL" is not defined [-Wundef]
Line 954: libavcodec/pthread.c:51:5: warning: "HAVE_SYSCONF" is not defined [-Wundef]
Line 956: libavcodec/pthread.c:170:5: warning: "HAVE_SCHED_GETAFFINITY" is not defined [-Wundef]
Line 957: libavcodec/pthread.c:179:7: warning: "HAVE_GETPROCESSAFFINITYMASK" is not defined [-Wundef]
Line 958: libavcodec/pthread.c:184:7: warning: "HAVE_SYSCTL" is not defined [-Wundef]
Line 959: libavcodec/pthread.c:191:7: warning: "HAVE_SYSCONF" is not defined [-Wundef]
Line 960: libavcodec/pthread.c:193:7: warning: "HAVE_SYSCONF" is not defined [-Wundef]
Line 1259: libswresample/swresample.c:288:5: warning: "CONFIG_LIBSOXR" is not defined [-Wundef]
Line 1299: libavutil/log.c:45:5: warning: "HAVE_SETCONSOLETEXTATTRIBUTE" is not defined [-Wundef]
Line 1301: libavutil/log.c:105:5: warning: "HAVE_SETCONSOLETEXTATTRIBUTE" is not defined [-Wundef]
Line 1308: libavutil/mem.c:129:5: warning: "CONFIG_MEMORY_POISONING" is not defined [-Wundef]
Line 1317: libavutil/random_seed.c:26:5: warning: "HAVE_CRYPTGENRANDOM" is not defined [-Wundef]
Line 1319: libavutil/random_seed.c:109:5: warning: "HAVE_CRYPTGENRANDOM" is not defined [-Wundef]
Line 1326: libavutil/time.c:45:7: warning: "HAVE_GETSYSTEMTIMEASFILETIME" is not defined [-Wundef]
Line 1328: libavutil/time.c:58:5: warning: "HAVE_NANOSLEEP" is not defined [-Wundef]
Line 1329: libavutil/time.c:62:7: warning: "HAVE_USLEEP" is not defined [-Wundef]
Line 1330: libavutil/time.c:64:7: warning: "HAVE_SLEEP" is not defined [-Wundef]
After:
Line 118: libavformat/file.c:88:5: warning: "HAVE_ACCESS" is not defined [-Wundef]
Line 277: libavformat/os_support.c:239:5: warning: "HAVE_GETSERVBYPORT" is not defined [-Wundef]
Line 734: libavcodec/libgsm.c:31:5: warning: "HAVE_GSM_H" is not defined [-Wundef]
Line 1233: libswresample/swresample.c:288:5: warning: "CONFIG_LIBSOXR" is not defined [-Wundef]
Line 1273: libavutil/log.c:45:5: warning: "HAVE_SETCONSOLETEXTATTRIBUTE" is not defined [-Wundef]
Line 1275: libavutil/log.c:105:5: warning: "HAVE_SETCONSOLETEXTATTRIBUTE" is not defined [-Wundef]
Line 1295: libavutil/time.c:45:7: warning: "HAVE_GETSYSTEMTIMEASFILETIME" is not defined [-Wundef]
More information about the MPlayer-dev-eng
mailing list