summaryrefslogtreecommitdiff
path: root/mpfr-impl.h
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-18 23:30:59 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-08-18 23:30:59 +0000
commite191508db5d73b86815e952c5269d2d07b16ab09 (patch)
treed97351a33c40284d80910803d62c125bb16940b6 /mpfr-impl.h
parentd3a66785087e65de58afeba53aaee0d7f4a02431 (diff)
downloadmpfr-e191508db5d73b86815e952c5269d2d07b16ab09.tar.gz
mpfr-impl.h: defined macro INITIALIZED to declare that some variable
is initialized before being used. README.dev: described the use of this macro. lngamma.c: replaced the dummy initialization by this macro. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5534 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r--mpfr-impl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h
index a23a4f4ff..1c5e1d93b 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -862,6 +862,18 @@ extern unsigned char *mpfr_stack;
# define MPFR_UNLIKELY(x) (x)
#endif
+/* Declare that some variable is initialized before being used (without a
+ dummy initialization) in order to avoid some compiler warnings. Use the
+ VAR = VAR trick (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296)
+ only with gcc as this is undefined behavior, and we don't know what
+ other compilers do (they may also be smarter). This trick could be
+ disabled with future gcc versions. */
+#if defined(__GNUC__)
+# define INITIALIZED(VAR) VAR = VAR
+#else
+# define INITIALIZED(VAR) VAR
+#endif
+
/* Ceil log 2: If GCC, uses a GCC extension, otherwise calls a function */
/* Warning:
* Needs to define MPFR_NEED_LONGLONG.