Avoid warnings of unused parameter.
authorNelson Ferreira <nelson.ferreira@ieee.org>
Mon, 9 Dec 2013 00:09:59 +0000 (19:09 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Mon, 9 Dec 2013 00:09:59 +0000 (19:09 -0500)
The old way of doing if(parameter); elicits other warnings such as if without a body.
While one could "fix" that in clang with placing the ; on the next line, using
SXE_UNUSED seems much saner, as it coveys intent.

* src/ent/ent-mpc.c: move prototype of mpc_set_ui_fr to ent-mpc.h
* src/ent/ent-mpc.h: declare mpc_set_ui_fr for usage by alloc.c
* src/ent/ent-float.c (mark_float): Removed if, marked as SXE_UNUSED
* src/ent/ent-float.c (float_equal): ditto
* src/ent/ent-float.c (ent_rem_FLOAT_T): ditto
* src/ent/ent-float.c (ent_rem_FLOAT_T_INT_T): ditto
* src/ent/ent-gaussian.c (bigg_equal): ditto.
* src/ent/ent-gaussian.c (bigg_hash): ditto.
* src/ent/ent-gaussian.c (bigg_mark): ditto.
* src/ent/ent-gaussian.c (bigg_finalise): ditto.
* src/ent/ent-indef.c (indef_hash): ditto.
* src/ent/ent-mpc.c (bigc_finalise): ditto.
* src/ent/ent-mpfr.c (bigfr_finalise): ditto.
* src/ent/ent.c (default_real_precision_changed): ditto.
* src/alloc.c: include ent-mpc.h when it is defined so that bigc uses the
proper definitions/prototypes

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/alloc.c
src/ent/ent-float.c
src/ent/ent-gaussian.c
src/ent/ent-indef.c
src/ent/ent-mpc.c
src/ent/ent-mpc.h
src/ent/ent-mpfr.c
src/ent/ent.c

index 7f8e019..5fc372e 100644 (file)
@@ -1647,6 +1647,7 @@ make_bigg_bg(bigg gaussian_value)
 /*** Big complex numbers with correct rounding ***/
 #if defined HAVE_MPC && defined WITH_MPC || \
        defined HAVE_PSEUC && defined WITH_PSEUC
+#include <ent/ent-mpc.h>
 DECLARE_FIXED_TYPE_ALLOC(bigc, Lisp_Bigc);
 #define MINIMUM_ALLOWED_FIXED_TYPE_CELLS_bigc 250
 
index 80162a8..96a2d9b 100644 (file)
@@ -41,19 +41,15 @@ Fixnum max_float_print_size = 0;
 
 \f
 static Lisp_Object
-mark_float(Lisp_Object obj)
+mark_float(Lisp_Object SXE_UNUSED(obj))
 {
        return Qnil;
-
-       if (obj);
 }
 
 static inline int
-float_equal(Lisp_Object obj1, Lisp_Object obj2, int depth)
+float_equal(Lisp_Object obj1, Lisp_Object obj2, int SXE_UNUSED(depth))
 {
        return (ent_float(obj1) == ent_float(obj2));
-
-       if (depth);
 }
 
 static inline unsigned long
@@ -188,15 +184,13 @@ ent_div_FLOAT_T_INT_T(Lisp_Object l, Lisp_Object r)
 }
 
 static inline Lisp_Object
-ent_rem_FLOAT_T(Lisp_Object l, Lisp_Object r)
+ent_rem_FLOAT_T(Lisp_Object SXE_UNUSED(l), Lisp_Object SXE_UNUSED(r))
 {
-       if (l);
        return make_float(0.0);
 }
 static inline Lisp_Object
-ent_rem_FLOAT_T_INT_T(Lisp_Object l, Lisp_Object r)
+ent_rem_FLOAT_T_INT_T(Lisp_Object SXE_UNUSED(l), Lisp_Object SXE_UNUSED(r))
 {
-       if (l);
        return make_float(0.0);
 }
 
index b01c376..0a038ca 100644 (file)
@@ -51,42 +51,30 @@ bigg_print(Lisp_Object obj, Lisp_Object printcharfun, int SXE_UNUSED(escapeflag)
 }
 
 static int
-bigg_equal(Lisp_Object obj1, Lisp_Object obj2, int depth)
+bigg_equal(Lisp_Object obj1, Lisp_Object obj2, int SXE_UNUSED(depth))
 {
        return bigg_eql(XBIGG_DATA(obj1), XBIGG_DATA(obj2));
-
-       /* less warnings */
-       if (depth);
 }
 
 static unsigned long
-bigg_hash(Lisp_Object obj, int depth)
+bigg_hash(Lisp_Object obj, int SXE_UNUSED(depth))
 {
        return bigg_hashcode(XBIGG_DATA(obj));
-
-       /* less warnings */
-       if (depth);
 }
 
 static Lisp_Object
-bigg_mark(Lisp_Object obj)
+bigg_mark(Lisp_Object SXE_UNUSED(obj))
 {
        return Qnil;
-
-       /* less warnings */
-       if (obj == Qnil);
 }
 
 static void
-bigg_finalise(void *header, int for_disksave)
+bigg_finalise(void *SXE_UNUSED(header), int for_disksave)
 {
        if (for_disksave)
                signal_simple_error
                        ("Can't dump an emacs containing "
                         "pseudo-gaussian objects",Qt);
-
-       /* less warnings */
-       if (header);
 }
 
 static const struct lrecord_description bigg_description[] = {
index 709bdcc..e128ec4 100644 (file)
@@ -62,12 +62,9 @@ indef_equal (Lisp_Object obj1, Lisp_Object obj2, int SXE_UNUSED(depth))
 }
 
 static unsigned long
-indef_hash (Lisp_Object obj, int depth)
+indef_hash (Lisp_Object obj, int SXE_UNUSED(depth))
 {
        return (unsigned long)XINDEF_DATA(obj);
-
-       /* less warnings */
-       if (depth);
 }
 
 static const struct lrecord_description indef_description[] = {
index d7a65c0..d179541 100644 (file)
@@ -63,14 +63,11 @@ bigc_mark (Lisp_Object SXE_UNUSED(obj))
 }
 
 static void
-bigc_finalise (void *header, int for_disksave)
+bigc_finalise (void *SXE_UNUSED(header), int for_disksave)
 {
        if (for_disksave)
                signal_simple_error
                        ("Can't dump an emacs containing MPC objects",Qt);
-
-       /* less warnings */
-       if (header);
 }
 
 static const struct lrecord_description bigc_description[] = {
@@ -80,7 +77,6 @@ static const struct lrecord_description bigc_description[] = {
 
 #if ! defined(HAVE_MPC_SET_UI_FR) || ! HAVE_MPC_SET_UI_FR
 #if defined(MPC_SET_X_Y)
-int mpc_set_ui_fr (mpc_t rop, unsigned long int re, mpfr_t im, mpc_rnd_t rnd);
 int mpc_set_ui_fr (mpc_t rop, unsigned long int re, mpfr_t im, mpc_rnd_t rnd)
              MPC_SET_X_Y (ui, fr, rop, re, im, rnd);
 #else
index 3c8ed35..43724d6 100644 (file)
@@ -110,6 +110,14 @@ extern bigc ent_scratch_bigc;
 extern Bufbyte *bigc_to_string(bigc, int);
 
 /***** Bigc: converting assignments *****/
+#if ! defined(HAVE_MPC_SET_UI_FR) || ! HAVE_MPC_SET_UI_FR
+#if defined(MPC_SET_X_Y)
+int mpc_set_ui_fr (mpc_t rop, unsigned long int re, mpfr_t im, mpc_rnd_t rnd);
+#else
+#error Cannot derived mpc_set_ui_fr without MPC_SET_X_Y!
+#endif
+#endif
+
 #define bigc_set(f1, f2)               mpc_set(f1, f2, GMP_RNDN)
 #define bigc_set_long(f, l)            mpc_set_si(f, l, GMP_RNDN)
 #define bigc_set_ulong(f, l)           mpc_set_ui(f, l, GMP_RNDN)
index cbc4dd0..7214800 100644 (file)
@@ -70,14 +70,11 @@ bigfr_mark (Lisp_Object unused)
 }
 
 static void
-bigfr_finalise (void *header, int for_disksave)
+bigfr_finalise (void *SXE_UNUSED(header), int for_disksave)
 {
        if (for_disksave)
                signal_simple_error
                        ("Can't dump an emacs containing MPFR objects", Qt);
-
-       /* less warnings */
-       if (header);
 }
 
 static const struct lrecord_description bigfr_description[] = {
index 4d48bc9..885e181 100644 (file)
@@ -253,9 +253,9 @@ Return t if OBJECT is a real, nil otherwise.
 }
 
 static int
-default_real_precision_changed (Lisp_Object sym, Lisp_Object *val,
-                               Lisp_Object in_object,
-                               int flags)
+default_real_precision_changed (Lisp_Object SXE_UNUSED(sym), Lisp_Object *val,
+                               Lisp_Object SXE_UNUSED(in_object),
+                               int SXE_UNUSED(flags))
 {
        unsigned long prec;
 
@@ -270,11 +270,6 @@ default_real_precision_changed (Lisp_Object sym, Lisp_Object *val,
                bigfr_set_default_prec(prec);
 #endif
        return 0;
-
-       /* less warnings */
-       if (sym == Qnil);
-       if (in_object == Qnil);
-       if (flags);
 }
 
 DEFUN("real", Freal, 1, 2, 0,  /*