Matthew Booth
2012-Dec-14 14:01 UTC
[Libguestfs] [PATCH] daemon: Add sentinel attribute to commandf and commandrf
Causes a compiler warning to be emitted if you omit the trailing NULL argument. --- daemon/daemon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/daemon.h b/daemon/daemon.h index 8f932d2..df1ba3a 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -100,9 +100,9 @@ extern char **split_lines (char *str); #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 extern int commandf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandrf (char **stdoutput, char **stderror, int flags, - const char *name, ...); + const char *name, ...) __attribute__((sentinel)); extern int commandvf (char **stdoutput, char **stderror, int flags, char const *const *argv); extern int commandrvf (char **stdoutput, char **stderror, int flags, -- 1.7.11.7
Richard W.M. Jones
2012-Dec-14 14:16 UTC
[Libguestfs] [PATCH] daemon: Add sentinel attribute to commandf and commandrf
On Fri, Dec 14, 2012 at 02:01:08PM +0000, Matthew Booth wrote:> Causes a compiler warning to be emitted if you omit the trailing NULL argument. > --- > daemon/daemon.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/daemon/daemon.h b/daemon/daemon.h > index 8f932d2..df1ba3a 100644 > --- a/daemon/daemon.h > +++ b/daemon/daemon.h > @@ -100,9 +100,9 @@ extern char **split_lines (char *str); > #define COMMAND_FLAG_CHROOT_COPY_FILE_TO_STDIN 2048 > > extern int commandf (char **stdoutput, char **stderror, int flags, > - const char *name, ...); > + const char *name, ...) __attribute__((sentinel)); > extern int commandrf (char **stdoutput, char **stderror, int flags, > - const char *name, ...); > + const char *name, ...) __attribute__((sentinel)); > extern int commandvf (char **stdoutput, char **stderror, int flags, > char const *const *argv); > extern int commandrvf (char **stdoutput, char **stderror, int flags, > --ACK. Any other functions we have that need to be marked this way? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
Reasonably Related Threads
- [PATCH v3 2/6] daemon: Split out command() functions and CLEANUP_* macros into separate files.
- [PATCH] daemon: improve internal commandrvf
- [PATCH] daemon: improve debugging for "stdout on stderr" flag
- [PATCH 1/2] daemon: NFC Use symbolic names in commandrvf
- [PATCH libguestfs] indent with spaces, not TABs