[vlc-devel] GCC patch to fix LIBVLC_USED for GCC 3.3

Brad brad at comstyle.com
Thu Aug 12 01:51:15 CEST 2010


Eliminates many thousands of warnings about the warn_unused_result attribute
not being supported by GCC 3.3. This is the default compiler on OpenBSD on
almost all architectures up until the latest pending release, but this
version is also in use for some other archs not moved over yet. I had
forward ported this from my 1.0 patch for the OpenBSD port/package.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
>From 9c22e67b13e74f4ac43d454d1f421a5449408830 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Wed, 11 Aug 2010 19:24:49 -0400
Subject: [PATCH] Only define LIBVLC_USED for GCC 3.4 or newer. GCC 3.3 does not support
 the warn_unused_result attribute.

---
 include/vlc_common.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 68db925..7e16c13 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -80,7 +80,11 @@
 #     define LIBVLC_FORMAT(x,y) __attribute__ ((format(printf,x,y)))
 #   endif
 #   define LIBVLC_FORMAT_ARG(x) __attribute__ ((format_arg(x)))
-#   define LIBVLC_USED __attribute__ ((warn_unused_result))
+#   if __GNUC__ > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ >= 4))
+#     define LIBVLC_USED __attribute__ ((warn_unused_result))
+#   else
+#     define LIBVLC_USED
+#   endif
 #   define LIBVLC_MALLOC __attribute__ ((malloc))
 #else
 #   define LIBVLC_FORMAT(x,y)
-- 
1.7.1



More information about the vlc-devel mailing list