[FFmpeg-devel] [PATCH 1/4] Check if the compiler supports the #warning directive before use.

Diego 'Flameeyes' Pettenò flameeyes
Thu Oct 2 18:54:41 CEST 2008


Not all compilers support the #warning directives; namely Sun Studio
compiler will abort uild if the #warning directive is used; check for
it during configure to make sure it's only used when supported.
---

 configure               |    5 +++++
 libavcodec/i386/mmx.h   |    2 ++
 libavformat/framehook.h |    2 ++
 libavformat/nsvdec.c    |    2 ++
 4 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 5361e5c..3a92d0f 100755
--- a/configure
+++ b/configure
@@ -810,6 +810,7 @@ HAVE_LIST="
     sys_videoio_h
     termios_h
     threads
+    warning_directive
     winsock2_h
     yasm
 "
@@ -1568,6 +1569,10 @@ EOF
 sym=$($nm -P -g $TMPO | grep ff_extern)
 extern_prefix=${sym%%ff_extern*}
 
+check_cc <<EOF && enable warning_directive || disable warning_directive
+#warning "This is only a warning"
+EOF
+
 check_asm inline_asm '""'
 
 if enabled x86; then
diff --git a/libavcodec/i386/mmx.h b/libavcodec/i386/mmx.h
index 197e059..c1bcd20 100644
--- a/libavcodec/i386/mmx.h
+++ b/libavcodec/i386/mmx.h
@@ -21,7 +21,9 @@
 #ifndef AVCODEC_I386_MMX_H
 #define AVCODEC_I386_MMX_H
 
+#if ENABLE_WARNING_DIRECTIVE
 #warning Everything in this header is deprecated, use plain asm()! New code using this header will be rejected.
+#endif
 
 /*
  * The type of an value that fits in an MMX register (note that long
diff --git a/libavformat/framehook.h b/libavformat/framehook.h
index 9dc144b..17bdfcd 100644
--- a/libavformat/framehook.h
+++ b/libavformat/framehook.h
@@ -22,7 +22,9 @@
 #ifndef AVFORMAT_FRAMEHOOK_H
 #define AVFORMAT_FRAMEHOOK_H
 
+#if ENABLE_WARNING_DIRECTIVE
 #warning VHOOK is deprecated. Please help finishing libavfilter instead of wasting your time writing new filters for this crappy filter system.
+#endif
 
 /*
  * Prototypes for interface to .so that implement a video processing hook
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index dbc2d00..27a113d 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -359,7 +359,9 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
         if((unsigned)table_entries >= UINT_MAX / sizeof(uint32_t))
             return -1;
         nsv->nsvf_index_data = av_malloc(table_entries * sizeof(uint32_t));
+#if ENABLE_WARNING_DIRECTIVE
 #warning "FIXME: Byteswap buffer as needed"
+#endif
         get_buffer(pb, (unsigned char *)nsv->nsvf_index_data, table_entries * sizeof(uint32_t));
     }
 





More information about the ffmpeg-devel mailing list