Skip to contentSkip to conversation

Include util.h to check the prototype with the implementation

PATCH In review Thomas Huth 3 participants 3 messages Jun 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Include util.h to check the prototype with the implementation

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".

---
 lib/util.c | 1 +
 1 file changed, 1 insertion(+)
lib/util.c +1 -0
index 69b1810..a905541 100644
@@ -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)
 {
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Thomas Huth

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? ;)

Quoted 12 lines
---
 lib/util.c | 1 +
 1 file changed, 1 insertion(+)
lib/util.c +0 -0
index 69b1810..a905541 100644

lib/util.c line 10

Quoted 7 lines
lib/util.c +1 -0
@@ -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)
 {
Signature · 3 lines
Thanks,

David
maintainer
#2 lore raw
In reply to Thomas Huth
Quoted 3 lines · Thomas Huth

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

Quoted 18 lines
---
 lib/util.c | 1 +
 1 file changed, 1 insertion(+)
lib/util.c +1 -0
index 69b1810..a905541 100644
@@ -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)
 {