diff mbox

[kvm-unit-tests] Include util.h to check the prototype with the implementation

Message ID 1498540718-3224-1-git-send-email-thuth@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Huth June 27, 2017, 5:18 a.m. UTC
util.c should include util.h so that the compiler can check that
the prototype from the header matches the implementation. This is
required for compiling the file with "-Wmissing-prototypes".

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/util.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Hildenbrand June 27, 2017, 8:40 a.m. UTC | #1
On 27.06.2017 07:18, Thomas Huth wrote:
> util.c should include util.h so that the compiler can check that
> the prototype from the header matches the implementation. This is
> required for compiling the file with "-Wmissing-prototypes".

Why is something like that not contained in -Wextra? ;)

> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/util.c b/lib/util.c
> index 69b1810..a905541 100644
> --- a/lib/util.c
> +++ b/lib/util.c
> @@ -4,6 +4,7 @@
>   * This work is licensed under the terms of the GNU LGPL, version 2.
>   */
>  #include <libcflat.h>
> +#include "util.h"
>  
>  int parse_keyval(char *s, long *val)
>  {
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
Paolo Bonzini June 27, 2017, 12:30 p.m. UTC | #2
On 27/06/2017 07:18, Thomas Huth wrote:
> util.c should include util.h so that the compiler can check that
> the prototype from the header matches the implementation. This is
> required for compiling the file with "-Wmissing-prototypes".

I think all of lib/ should compile with "-Wmissing-prototypes".  I
applied this patch.

Paolo

> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/util.c b/lib/util.c
> index 69b1810..a905541 100644
> --- a/lib/util.c
> +++ b/lib/util.c
> @@ -4,6 +4,7 @@
>   * This work is licensed under the terms of the GNU LGPL, version 2.
>   */
>  #include <libcflat.h>
> +#include "util.h"
>  
>  int parse_keyval(char *s, long *val)
>  {
>
diff mbox

Patch

diff --git a/lib/util.c b/lib/util.c
index 69b1810..a905541 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -4,6 +4,7 @@ 
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
 #include <libcflat.h>
+#include "util.h"
 
 int parse_keyval(char *s, long *val)
 {