summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-02-19 10:58:51 +0000
committerPádraig Brady <P@draigBrady.com>2013-02-20 04:04:25 +0000
commit31861f663a440df498bdb7788fa43aa9d03133c5 (patch)
tree358f12f0f419f7471ac38aa788fd5adba68e03b0 /src
parent04b035670de49429d48dea726125caa613c1629f (diff)
downloadcoreutils-31861f663a440df498bdb7788fa43aa9d03133c5.tar.xz
maint: cleanup up various uses of __attribute__
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute() form without trailing underscores as that is not elided where required. Also ensure we use gnulib macros rather than defining our own. * src/system.h: Remove gnulib provided macros. * src/chown-core.c: Likewise. * src/chroot.c: Likewise. * src/copy.c: Likewise. * src/csplit.c: Likewise. * src/dd.c: Likewise. * src/expr.c: Likewise. * src/extent-scan.c: Likewise. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/ptx.c: Likewise. * src/sort.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/system.h: Likewise. * src/tac.c: Likewise. * src/test.c: Likewise. * src/tsort.c: Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/chown-core.c2
-rw-r--r--src/chroot.c2
-rw-r--r--src/copy.c20
-rw-r--r--src/extent-scan.c2
-rw-r--r--src/factor.c14
-rw-r--r--src/ls.c2
-rw-r--r--src/od.c10
-rw-r--r--src/stat.c2
-rw-r--r--src/stty.c2
-rw-r--r--src/system.h4
-rw-r--r--src/tac.c2
-rw-r--r--src/tsort.c2
12 files changed, 30 insertions, 34 deletions
diff --git a/src/chown-core.c b/src/chown-core.c
index 3a3044e04..a5a2b4761 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -68,7 +68,7 @@ chopt_init (struct Chown_option *chopt)
}
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. */
diff --git a/src/chroot.c b/src/chroot.c
index 1c1a97695..b77a8bf66 100644
--- a/src/chroot.c
+++ b/src/chroot.c
@@ -57,7 +57,7 @@ static struct option const long_opts[] =
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;
}
diff --git a/src/copy.c b/src/copy.c
index 3f2cc2b0c..244313ee7 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -471,7 +471,7 @@ errno_unsupported (int err)
#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))
@@ -487,7 +487,7 @@ copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
}
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;
@@ -500,14 +500,14 @@ copy_attr_allerror (struct error_context *ctx ATTRIBUTE_UNUSED,
}
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)
{
}
@@ -539,11 +539,11 @@ copy_attr (char const *src_path, int src_fd,
#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;
}
diff --git a/src/extent-scan.c b/src/extent-scan.c
index 5d25b9aab..6d3032a72 100644
--- a/src/extent-scan.c
+++ b/src/extent-scan.c
@@ -218,7 +218,7 @@ extent_scan_read (struct extent_scan *scan)
}
#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;
diff --git a/src/factor.c b/src/factor.c
index 8f1542a2f..257a7ed90 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -791,7 +791,7 @@ factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0,
{
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);
@@ -933,7 +933,7 @@ static const unsigned char binvert_table[128] =
_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; \
@@ -948,7 +948,7 @@ static const unsigned char binvert_table[128] =
/* 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)
@@ -981,7 +981,7 @@ static const unsigned char binvert_table[128] =
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;
@@ -1001,7 +1001,7 @@ mulredc2 (uintmax_t *r1p,
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);
@@ -1271,7 +1271,7 @@ prime_p (uintmax_t n)
a_prim = s0 % n;
else
{
- uintmax_t dummy ATTRIBUTE_UNUSED;
+ uintmax_t dummy _GL_UNUSED;
udiv_qrnnd (dummy, a_prim, s1, s0, n);
}
}
@@ -1803,7 +1803,7 @@ isqrt2 (uintmax_t nh, uintmax_t nl)
/* 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;
diff --git a/src/ls.c b/src/ls.c
index f1ed43bd2..d9876f842 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2734,7 +2734,7 @@ has_capability (char const *name)
}
#else
static bool
-has_capability (char const *name ATTRIBUTE_UNUSED)
+has_capability (char const *name _GL_UNUSED)
{
errno = ENOTSUP;
return false;
diff --git a/src/od.c b/src/od.c
index ffccd7410..e7d881b28 100644
--- a/src/od.c
+++ b/src/od.c
@@ -416,7 +416,7 @@ N (size_t fields, size_t blank, void const *block, \
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))
@@ -452,7 +452,7 @@ dump_hexl_mode_trailer (size_t n_bytes, const char *block)
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;
@@ -483,7 +483,7 @@ print_named_ascii (size_t fields, size_t blank, void const *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;
@@ -1056,8 +1056,8 @@ skip (uintmax_t n_skip)
}
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)
{
}
diff --git a/src/stat.c b/src/stat.c
index dd210d181..232669811 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -583,7 +583,7 @@ out_minus_zero (char *pformat, size_t prefix_len)
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);
diff --git a/src/stty.c b/src/stty.c
index ee891a593..e518839d5 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -745,7 +745,7 @@ main (int argc, char **argv)
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;
diff --git a/src/system.h b/src/system.h
index 1677999ef..0605a2f2e 100644
--- a/src/system.h
+++ b/src/system.h
@@ -425,10 +425,6 @@ enum
# 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)
diff --git a/src/tac.c b/src/tac.c
index c6a8cf695..5bf40a7e8 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -409,7 +409,7 @@ record_or_unlink_tempfile (char const *fn, FILE *fp)
#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);
}
diff --git a/src/tsort.c b/src/tsort.c
index d22f1f051..93ff89499 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -280,7 +280,7 @@ record_relation (struct item *j, struct item *k)
}
static bool
-count_items (struct item *unused ATTRIBUTE_UNUSED)
+count_items (struct item *unused _GL_UNUSED)
{
n_strings++;
return false;