[FFmpeg-devel] [PATCH] Use __typeof__ instead of GCC-specific typeof keyword.

Diego 'Flameeyes' Pettenò flameeyes
Thu Oct 2 18:58:36 CEST 2008


The typeof keyword is disabled by default when building with -std=c99
as it's a GNU extension, make it known that it's an extension by using
the underscore-enclosed variant.

The underscore-encosed keyword is accepted by GCC without requesting
extensions to the C99 standard, while the simpler typeof() keyword
requires GNU extensions to the C99 standard to be explicitly requested
(e.g.: by using the -fasm option).

ICC supports the __typeof__ keyword as well as typeof.
---

 libavformat/avformat.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index cc8f36a..e11e788 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1123,8 +1123,8 @@ void ff_dynarray_add(unsigned long **tab_ptr, int *nb_ptr, unsigned long elem);
 #ifdef __GNUC__
 #define dynarray_add(tab, nb_ptr, elem)\
 do {\
-    typeof(tab) _tab = (tab);\
-    typeof(elem) _elem = (elem);\
+    __typeof__(tab) _tab = (tab);\
+    __typeof__(elem) _elem = (elem);\
     (void)sizeof(**_tab == _elem); /* check that types are compatible */\
     ff_dynarray_add((unsigned long **)_tab, nb_ptr, (unsigned long)_elem);\
 } while(0)





More information about the ffmpeg-devel mailing list