&& { echo '$(ME): Use PRI*MAX instead of %j' 1>&2; exit 1; } \
|| :
+# Ensure the alternative __attribute (keyword) form isn't used as
+# that form is not elided where required. Also ensure that we don't
+# directly use attributes already defined by gnulib.
+# TODO: move the check for _GL... attributes to gnulib.
+sc_prohibit-gl-attributes:
+ @cd $(srcdir) && GIT_PAGER= git grep -En \
+ "__attribute |__(unused|pure|const)__" src gl/lib/*.[ch] \
+ && { echo '$(ME): Use _GL... attribute macros' 1>&2; exit 1; } \
+ || :
+
# Look for lines longer than 80 characters, except omit:
# - program-generated long lines in diff headers,
# - tests involving long checksum lines, and
}
extern void
-chopt_free (struct Chown_option *chopt ATTRIBUTE_UNUSED)
+chopt_free (struct Chown_option *chopt _GL_UNUSED)
{
/* Deliberately do not free chopt->user_name or ->group_name.
They're not always allocated. */
always-successful replacement to avoid checking for setgroups
availability everywhere, just to support broken platforms. */
static int
-setgroups (size_t size ATTRIBUTE_UNUSED, gid_t const *list ATTRIBUTE_UNUSED)
+setgroups (size_t size _GL_UNUSED, gid_t const *list _GL_UNUSED)
{
return 0;
}
#if USE_XATTR
static void
-copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
+copy_attr_error (struct error_context *ctx _GL_UNUSED,
char const *fmt, ...)
{
if (!errno_unsupported (errno))
}
static void
-copy_attr_allerror (struct error_context *ctx ATTRIBUTE_UNUSED,
+copy_attr_allerror (struct error_context *ctx _GL_UNUSED,
char const *fmt, ...)
{
int err = errno;
}
static char const *
-copy_attr_quote (struct error_context *ctx ATTRIBUTE_UNUSED, char const *str)
+copy_attr_quote (struct error_context *ctx _GL_UNUSED, char const *str)
{
return quote (str);
}
static void
-copy_attr_free (struct error_context *ctx ATTRIBUTE_UNUSED,
- char const *str ATTRIBUTE_UNUSED)
+copy_attr_free (struct error_context *ctx _GL_UNUSED,
+ char const *str _GL_UNUSED)
{
}
#else /* USE_XATTR */
static bool
-copy_attr (char const *src_path ATTRIBUTE_UNUSED,
- int src_fd ATTRIBUTE_UNUSED,
- char const *dst_path ATTRIBUTE_UNUSED,
- int dst_fd ATTRIBUTE_UNUSED,
- struct cp_options const *x ATTRIBUTE_UNUSED)
+copy_attr (char const *src_path _GL_UNUSED,
+ int src_fd _GL_UNUSED,
+ char const *dst_path _GL_UNUSED,
+ int dst_fd _GL_UNUSED,
+ struct cp_options const *x _GL_UNUSED)
{
return true;
}
}
#else
extern bool
-extent_scan_read (struct extent_scan *scan ATTRIBUTE_UNUSED)
+extent_scan_read (struct extent_scan *scan _GL_UNUSED)
{
scan->initial_scan_failed = true;
errno = ENOTSUP;
{
for (;;)
{
- uintmax_t q1, q0, hi, lo ATTRIBUTE_UNUSED;
+ uintmax_t q1, q0, hi, lo _GL_UNUSED;
q0 = t0 * primes_dtab[i].binv;
umul_ppmm (hi, lo, q0, p);
_q0 = (u0) * _di; \
if ((u1) >= (d)) \
{ \
- uintmax_t _p1, _p0 ATTRIBUTE_UNUSED; \
+ uintmax_t _p1, _p0 _GL_UNUSED; \
umul_ppmm (_p1, _p0, _q0, d); \
(q1) = ((u1) - _p1) * _di; \
(q0) = _q0; \
/* x B (mod n). */
#define redcify(r_prim, r, n) \
do { \
- uintmax_t _redcify_q ATTRIBUTE_UNUSED; \
+ uintmax_t _redcify_q _GL_UNUSED; \
udiv_qrnnd (_redcify_q, r_prim, r, 0, n); \
} while (0)
static inline uintmax_t
mulredc (uintmax_t a, uintmax_t b, uintmax_t m, uintmax_t mi)
{
- uintmax_t rh, rl, q, th, tl ATTRIBUTE_UNUSED, xh;
+ uintmax_t rh, rl, q, th, tl _GL_UNUSED, xh;
umul_ppmm (rh, rl, a, b);
q = rl * mi;
uintmax_t a1, uintmax_t a0, uintmax_t b1, uintmax_t b0,
uintmax_t m1, uintmax_t m0, uintmax_t mi)
{
- uintmax_t r1, r0, q, p1, p0 ATTRIBUTE_UNUSED, t1, t0, s1, s0;
+ uintmax_t r1, r0, q, p1, p0 _GL_UNUSED, t1, t0, s1, s0;
mi = -mi;
assert ( (a1 >> (W_TYPE_SIZE - 1)) == 0);
assert ( (b1 >> (W_TYPE_SIZE - 1)) == 0);
a_prim = s0 % n;
else
{
- uintmax_t dummy ATTRIBUTE_UNUSED;
+ uintmax_t dummy _GL_UNUSED;
udiv_qrnnd (dummy, a_prim, s1, s0, n);
}
}
/* Do we need more than one iteration? */
for (;;)
{
- uintmax_t r ATTRIBUTE_UNUSED;
+ uintmax_t r _GL_UNUSED;
uintmax_t q, y;
udiv_qrnnd (q, r, nh, nl, x);
y = (x + q) / 2;
}
#else
static bool
-has_capability (char const *name ATTRIBUTE_UNUSED)
+has_capability (char const *name _GL_UNUSED)
{
errno = ENOTSUP;
return false;
PRINT_FIELDS (N, T, fmt_string, xprintf (fmt_string, adjusted_width, x))
#define PRINT_FLOATTYPE(N, T, FTOASTR, BUFSIZE) \
- PRINT_FIELDS (N, T, fmt_string ATTRIBUTE_UNUSED, \
+ PRINT_FIELDS (N, T, fmt_string _GL_UNUSED, \
char buf[BUFSIZE]; \
FTOASTR (buf, sizeof buf, 0, 0, x); \
xprintf ("%*s", adjusted_width, buf))
static void
print_named_ascii (size_t fields, size_t blank, void const *block,
- const char *unused_fmt_string ATTRIBUTE_UNUSED,
+ const char *unused_fmt_string _GL_UNUSED,
int width, int pad)
{
unsigned char const *p = block;
static void
print_ascii (size_t fields, size_t blank, void const *block,
- const char *unused_fmt_string ATTRIBUTE_UNUSED, int width,
+ const char *unused_fmt_string _GL_UNUSED, int width,
int pad)
{
unsigned char const *p = block;
}
static void
-format_address_none (uintmax_t address ATTRIBUTE_UNUSED,
- char c ATTRIBUTE_UNUSED)
+format_address_none (uintmax_t address _GL_UNUSED,
+ char c _GL_UNUSED)
{
}
acts like printf's %f format. */
static void
out_epoch_sec (char *pformat, size_t prefix_len,
- struct stat const *statbuf ATTRIBUTE_UNUSED,
+ struct stat const *statbuf _GL_UNUSED,
struct timespec arg)
{
char *dot = memchr (pformat, '.', prefix_len);
int argi = 0;
int opti = 1;
bool require_set_attr;
- bool speed_was_set ATTRIBUTE_UNUSED;
+ bool speed_was_set _GL_UNUSED;
bool verbose_output;
bool recoverable_output;
int k;
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif
-#ifndef ATTRIBUTE_UNUSED
-# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#endif
-
/* The warn_unused_result attribute appeared first in gcc-3.4.0 */
#undef ATTRIBUTE_WARN_UNUSED_RESULT
#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
#else
static void
-record_or_unlink_tempfile (char const *fn, FILE *fp ATTRIBUTE_UNUSED)
+record_or_unlink_tempfile (char const *fn, FILE *fp _GL_UNUSED)
{
unlink (fn);
}
}
static bool
-count_items (struct item *unused ATTRIBUTE_UNUSED)
+count_items (struct item *unused _GL_UNUSED)
{
n_strings++;
return false;