Commit f5de0d3b authored by Colin Watson's avatar Colin Watson
Browse files

Add several function attributes suggested by GCC

* lib/debug.c (vdebug): Mark first argument as a printf format string.
* lib/pipeline.c (pipecmd_get_nargs, pipeline_get_ncommands,
pipeline_get_command, pipeline_get_pid, pipeline_peek_size): Mark as
pure.
parent 760cec6f
......@@ -48,7 +48,8 @@ void init_debug (void)
debug_level = 1;
}
static void vdebug (const char *message, va_list args)
static void PIPELINE_ATTR_FORMAT_PRINTF (1, 0) vdebug (const char *message,
va_list args)
{
if (debug_level)
vfprintf (stderr, message, args);
......
......@@ -535,7 +535,7 @@ void pipecmd_argstr (pipecmd *cmd, const char *argstr)
}
}
int pipecmd_get_nargs (pipecmd *cmd)
int _GL_ATTRIBUTE_PURE pipecmd_get_nargs (pipecmd *cmd)
{
struct pipecmd_process *cmdp;
......@@ -1153,12 +1153,12 @@ void pipeline_commands (pipeline *p, ...)
va_end (cmdv);
}
int pipeline_get_ncommands (pipeline *p)
int _GL_ATTRIBUTE_PURE pipeline_get_ncommands (pipeline *p)
{
return p->ncommands;
}
pipecmd *pipeline_get_command (pipeline *p, int n)
pipecmd * _GL_ATTRIBUTE_PURE pipeline_get_command (pipeline *p, int n)
{
if (n < 0 || n >= p->ncommands)
return NULL;
......@@ -1175,7 +1175,7 @@ pipecmd *pipeline_set_command (pipeline *p, int n, pipecmd *cmd)
return prev;
}
pid_t pipeline_get_pid (pipeline *p, int n)
pid_t _GL_ATTRIBUTE_PURE pipeline_get_pid (pipeline *p, int n)
{
assert (p->pids); /* pipeline started */
if (n < 0 || n >= p->ncommands)
......@@ -2223,7 +2223,7 @@ const char *pipeline_peek (pipeline *p, size_t *len)
return get_block (p, len, 1);
}
size_t pipeline_peek_size (pipeline *p)
size_t _GL_ATTRIBUTE_PURE pipeline_peek_size (pipeline *p)
{
if (!p->buffer)
return 0;
......
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