Commit 3e16e86b authored by Colin Watson's avatar Colin Watson
Browse files

Simplify some GCC attribute handling

We have to be a little careful, as we can't use Gnulib in the public
<pipeline.h> header; but we can rely on it for internal compilation
units.

* lib/pipeline.c (passthrough): Use _GL_UNUSED rather than
PIPELINE_ATTR_UNUSED.
* tests/basic.c (pre_exec): Likewise.
* tests/common.h (MAIN): Likewise.
* tests/inspect.c (pid_helper): Likewise.
* tests/pump.c (tee_source): Likewise.
* lib/pipeline.h (PIPELINE_ATTR_UNUSED): Note that this is unused, but
preserved to avoid breaking (even undocumented) API.
parent 55d4fe43
......@@ -371,7 +371,7 @@ pipecmd *pipecmd_new_sequence (const char *name, ...)
return cmd;
}
static void passthrough (void *data PIPELINE_ATTR_UNUSED)
static void passthrough (void *data _GL_UNUSED)
{
for (;;) {
char buffer[4096];
......
......@@ -50,6 +50,10 @@ extern "C" {
#endif
/* Does this compiler support marking variables as unused? */
/* This is no longer used internally and isn't documented as part of
* libpipeline's public API, but is preserved just in case somebody used it
* anyway.
*/
#if PIPELINE_GNUC_PREREQ(2,4)
# define PIPELINE_ATTR_UNUSED __attribute__ ((__unused__))
#else
......
......@@ -300,7 +300,7 @@ END_TEST
/* This is of course better done using pipecmd_setenv, but setting an
* environment variable makes for an easy test.
*/
static void pre_exec (void *data PIPELINE_ATTR_UNUSED)
static void pre_exec (void *data _GL_UNUSED)
{
setenv ("TEST1", "10", 1);
}
......
......@@ -20,8 +20,7 @@
} while (0)
#define MAIN(test) \
int main (int argc PIPELINE_ATTR_UNUSED, \
char **argv PIPELINE_ATTR_UNUSED) \
int main (int argc _GL_UNUSED, char **argv _GL_UNUSED) \
{ \
int failed; \
Suite *s = test##_suite (); \
......
......@@ -73,7 +73,7 @@ START_TEST (test_inspect_pipeline)
}
END_TEST
static void pid_helper (void *data PIPELINE_ATTR_UNUSED)
static void pid_helper (void *data _GL_UNUSED)
{
struct sigaction sa;
......
......@@ -70,7 +70,7 @@ START_TEST (test_pump_connect_attaches_correctly)
}
END_TEST
static void tee_source (void *data PIPELINE_ATTR_UNUSED)
static void tee_source (void *data _GL_UNUSED)
{
unsigned char buf[256];
int i;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment