"Daniel P. Berrange" <berra...@redhat.com> writes:

> The drive_add() method returns NULL if it failed to parse the
> parameter values for any reason. All callers must check this
> and exit if failure occurred. Annotate the method so that the
> compiler validates this.

Good move.  Need more of that.

> Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
> ---
>  vl.c |   38 ++++++++++++++++++++++++++------------
>  1 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 7121cd0..3d08a44 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -654,6 +654,7 @@ static int bt_parse(const char *opt)
>  #define MTD_ALIAS "if=mtd"
>  #define SD_ALIAS "index=0,if=sd"
>  
> +QEMU_WARN_UNUSED_RESULT
>  QemuOpts *drive_add(const char *file, const char *fmt, ...)

The *declaration* needs QEMU_WARN_UNUSED_RESULT.  Tacking it onto the
definition only protects this compilation unit.

[...]

Reply via email to