AC_CHECK_FUNCS([mlock])
dnl Necessary support libraries.
-PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4])
+PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS"
dnl--------------------------------------------------------------------------
Source: catacomb
Section: libs
Priority: extra
-Build-Depends: mlib-dev (>= 2.0.2), debhelper (>= 8)
+Build-Depends: mlib-dev (>= 2.2.1), debhelper (>= 9)
Maintainer: Mark Wooding <mdw@distorted.org.uk>
Standards-Version: 3.1.1
#include <mLib/bits.h>
#include <mLib/dstr.h>
+#include <mLib/macros.h>
#include <mLib/sym.h>
#ifndef CATACOMB_KEY_ERROR_H
unsigned m;
} key_filter;
-/* --- Matching aginst key selection --- *
- *
- * GCC will warn about constant addresses in this test, which is rather
- * unfortunate. Muffle the warning. This is rather hideous because of the
- * way GCC's parser handles pragmata.
- */
-
-#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-# define KEY_MATCH_MUFFLE_WARNING(x) __extension__ ({ \
- _Pragma("GCC diagnostic push") \
- _Pragma("GCC diagnostic ignored \"-Waddress\"") \
- (x); \
- _Pragma("GCC diagnostic pop") \
- })
-#else
-# define KEY_MATCH_MUFFLE_WARNING(x) (x)
-#endif
+/* --- Matching aginst key selection --- */
#define KEY_MATCH(kd, kf) \
- (KEY_MATCH_MUFFLE_WARNING(!(kf)) || \
+ (MUFFLE_WARNINGS_EXPR(GCC_WARNING("-Waddress"), !(kf)) || \
((kd)->e & KF_ENCMASK) == KENC_STRUCT || \
((kd)->e & (kf)->m) == (kf)->f)
putc('\n', stderr);
}
-static int check(const char *op, const char *gd, group *g,
- ge *r, ge *c, ...) {
+static int EXECL_LIKE(0)
+ check(const char *op, const char *gd, group *g, ge *r, ge *c, ...)
+{
va_list ap;
if (G_EQ(g, r, c)) return (1);
#include <limits.h>
+#include <mLib/macros.h>
+
#ifndef CATACOMB_MP_H
# include "mp.h"
#endif
*
* GCC (at least) isn't clever enough to work out that the division in
* @MP_FROMINT@ is actually safe (since it will only be executed if @_i >
- * MPW_MAX@, which would prove that @(type)MPW_MAX + 1 != 0@). So here's
- * some machinery to shut it up.
+ * MPW_MAX@, which would prove that @(type)MPW_MAX + 1 != 0@).
*/
-#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-# define MP_FROMINT_MUFFLE_WARNING(x) do { \
- _Pragma("GCC diagnostic push") \
- _Pragma("GCC diagnostic ignored \"-Wdiv-by-zero\"") \
- x \
- _Pragma("GCC diagnostic pop") \
- } while (0)
-#else
-# define MP_FROMINT_MUFFLE_WARNING(x) do { x } while (0)
-#endif
-
/* --- @MP_FROMINT@ --- *
*
* Arguments: @d@ = destination multiprecision integer
if (_i <= MPW_MAX) \
break; \
else \
- MP_FROMINT_MUFFLE_WARNING({ _i /= (type)MPW_MAX + 1; }); \
+ MUFFLE_WARNINGS_STMT(GCC_WARNING("-Wdiv-by-zero"), { \
+ _i /= (type)MPW_MAX + 1; \
+ }); \
} \
} else { \
_d->f |= MP_NEG; \
if (_i >= -MPW_MAX) \
break; \
else \
- MP_FROMINT_MUFFLE_WARNING({ _i /= (type)MPW_MAX + 1; }); \
+ MUFFLE_WARNINGS_STMT(GCC_WARNING("-Wdiv-by-zero"), { \
+ _i /= (type)MPW_MAX + 1; \
+ }); \
} \
} \
\
#include <string.h>
#include <mLib/bits.h>
+#include <mLib/macros.h>
#include "mptypes.h"
#include "mpx.h"
* Use; Provides the dyadic boolean functions.
*/
-/* GCC complains about the generated code, so try to silence it. */
-#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
-#endif
-
#define MPX_BITBINOP(string) \
\
void mpx_bit##string(mpw *dv, mpw *dvl, const mpw *av, const mpw *avl, \
a = (av < avl) ? *av++ : 0; \
b = (bv < bvl) ? *bv++ : 0; \
*dv++ = B##string(a, b); \
+ IGNORE(a); IGNORE(b); \
} \
}
MPX_DOBIN(MPX_BITBINOP)
-#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-# pragma GCC diagnostic pop
-#endif
-
void mpx_not(mpw *dv, mpw *dvl, const mpw *av, const mpw *avl)
{
MPX_SHRINK(av, avl);
* Use: Writes out a timestamped log message.
*/
-static void pxlog(const char *p, ...)
+static void PRINTF_LIKE(1, 2) pxlog(const char *p, ...)
{
dstr d = DSTR_INIT;
va_list ap;
* Use: Formats a string and emits it to the output file.
*/
-static void pixserv_write(pixserv *px, const char *p, ...)
+static void PRINTF_LIKE(2, 3) pixserv_write(pixserv *px, const char *p, ...)
{
dstr d = DSTR_INIT;
va_list ap;
struct timeval tv;
gettimeofday(&tv, 0);
TV_SUB(&tv, &p->timer.tv, &tv);
- pixserv_write(px, "ITEM %s %i\n", p->tag, tv.tv_sec);
+ pixserv_write(px, "ITEM %s %lu\n", p->tag, (unsigned long)tv.tv_sec);
}
}
pixserv_write(px, "OK\n");
* Use: Reports a message to the user function.
*/
-extern int keycheck_report(keycheck */*kc*/, unsigned /*sev*/,
- const char */*msg*/, ...);
+extern int PRINTF_LIKE(3, 4)
+ keycheck_report(keycheck */*kc*/, unsigned /*sev*/,
+ const char */*msg*/, ...);
/* --- @keycheck_init@ --- *
*
#include <string.h>
#include <mLib/bits.h>
+#include <mLib/macros.h>
/*----- Static variables --------------------------------------------------*/
* unique.
*/
-static int unique(const char *t, int base, int sz, const char *name, ...)
+static int PRINTF_LIKE(4, 5)
+ unique(const char *t, int base, int sz, const char *name, ...)
{
char u[32];
char nbuf[128];
#include <stdio.h>
#include <mLib/bits.h>
+#include <mLib/macros.h>
#include "blkc.h"
#include "gcipher.h"
/* --- GCC complains about an out-of-bounds subscript here --- *
*
- * This is impossible. Thanks to @KSZ_ASSERT@, we know that @sz <= 16@ and
- * hence @i <= nk <= 4@; but @SQUARE_KWORDS == 36@.
+ * This is impossible. Thanks to @KSZ_ASSERT@, we know that @4 <= sz <=
+ * 16@ and hence @1 <= i <= nk <= 4@; but @SQUARE_KWORDS == 36@.
*/
-#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Warray-bounds"
-#endif
-
- ww = kk[i - 1];
-
-#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
-# pragma GCC diagnostic pop
-#endif
+ ww = MUFFLE_WARNINGS_EXPR(GCC_WARNING("-Warray-bounds"), kk[i - 1]);
/* --- Expand this material to fill the rest of the table --- */