[vlc-devel] [PATCH 1/2] Provide a variant of the CALL macro which doesn't use the nested functions GNU C extension.

Jai Menon jmenon86 at gmail.com
Sun Jan 9 18:36:54 CET 2011


This is useful when building with compilers like clang+llvm which do not
plan on implementing this extension.
---
 bin/override.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/bin/override.c b/bin/override.c
index ac9e14c..2c94afe 100644
--- a/bin/override.c
+++ b/bin/override.c
@@ -109,6 +109,13 @@ static void *getsym (const char *name)
         logbug(&counter, level, __func__, __VA_ARGS__); \
     } while (0)
 
+#ifdef __clang__
+
+#define CALL(func, ...) \
+({ typeof (func) *sym = getsym ( # func); sym (__VA_ARGS__); })
+
+#else
+
 /* Evil non-standard GNU C macro ;)
  *  typeof keyword,
  *  statement-expression,
@@ -127,6 +134,7 @@ static void *getsym (const char *name)
     sym (__VA_ARGS__); \
 })
 
+#endif
 
 /*** Environment ***
  *
-- 
1.7.3.2




More information about the vlc-devel mailing list