summaryrefslogtreecommitdiff
path: root/src/mpfr-sassert.h
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-07-22 14:32:12 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-07-22 14:32:12 +0000
commita4382a6ad151a031ba617a0c0f6574f611d4f250 (patch)
tree577d9790ea4c606949b53aa6ff7b411e04e5e647 /src/mpfr-sassert.h
parent25191e1212e34a5d7aaad4959bb7e4ce67966ab9 (diff)
downloadmpfr-a4382a6ad151a031ba617a0c0f6574f611d4f250.tar.gz
[src/mpfr-sassert.h] Get rid of annoying warnings
typedef 'MPFR_ASSERT_xxx' locally defined but not used with GCC 4.8+ (better than the non-portable solution r8618). Thanks to Jonathan Wakely: http://gcc.gnu.org/ml/gcc-help/2013-07/msg00142.html git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8625 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mpfr-sassert.h')
-rw-r--r--src/mpfr-sassert.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mpfr-sassert.h b/src/mpfr-sassert.h
index 95d98b434..c2f111c89 100644
--- a/src/mpfr-sassert.h
+++ b/src/mpfr-sassert.h
@@ -43,11 +43,20 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* Default version which should be compatible with nearly all compilers */
# if !defined(MPFR_DECL_STATIC_ASSERT)
+# if __MPFR_GNUC(4,8)
+/* Get rid of annoying warnings "typedef '...' locally defined but not used"
+ (new in GCC 4.8). Thanks to Jonathan Wakely for this solution:
+ http://gcc.gnu.org/ml/gcc-help/2013-07/msg00142.html */
+# define MPFR_TYPEDEF_UNUSED __attribute__ ((unused))
+# else
+# define MPFR_TYPEDEF_UNUSED
+# endif
# define MPFR_ASSERT_CAT(a,b) MPFR_ASSERT_CAT_(a,b)
# define MPFR_ASSERT_CAT_(a,b) a ## b
# define MPFR_STAT_STATIC_ASSERT(c) do { \
typedef enum { MPFR_ASSERT_CAT(MPFR_STATIC_ASSERT_CONST_,__LINE__) = !(c) } \
- MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1]; } while (0)
+ MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1] \
+ MPFR_TYPEDEF_UNUSED; } while (0)
# define MPFR_DECL_STATIC_ASSERT(c) \
typedef enum { MPFR_ASSERT_CAT(MPFR_STATIC_ASSERT_CONST_,__LINE__) = !(c) } \
MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1];