Skip to contentSkip to conversation

tools: Remove the use of K&R functions

PATCH In review Andrew Cooper 3 participants 4 messages Feb 16, 2023 – Feb 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: Remove the use of K&R functions

Clang-15 (as seen in the FreeBSD 14 tests) complains:

xg_main.c:1248 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] xg_init()

         ^
          void

The error message is a bit confusing but appears to new as part of -Wdeprecated-non-prototype which is part of supporting C2x which formally removes K&R syntax.

Either way, fix the offending functions.

---
CC: Anthony PERARD <[email protected]>
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Wei Liu <[email protected]>
CC: Julien Grall <[email protected]>

---
 tools/debugger/gdbsx/xg/xg_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/debugger/gdbsx/xg/xg_main.c +1 -1
index 4576c762af0c..580fe237b20e 100644
@@ -121,7 +121,7 @@ xgprt(const char *fn, const char *fmt, ...)
  *         -1 failure, errno set.
  */
 int 
-xg_init()
+xg_init(void)
 {
     int flags, saved_errno;
 
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Andrew Cooper

Clang-15 (as seen in the FreeBSD 14 tests) complains:

xg_main.c:1248 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] xg_init()

         ^
          void
Quoted 7 lines

The error message is a bit confusing but appears to new as part of -Wdeprecated-non-prototype which is part of supporting C2x which formally removes K&R syntax.

Either way, fix the offending functions.

Thanks,

Signature · 1 line
Anthony PERARD
#2 lore raw
In reply to Andrew Cooper
Quoted 6 lines · Andrew Cooper

Clang-15 (as seen in the FreeBSD 14 tests) complains:

xg_main.c:1248 error: a function declaration without a prototype is deprecated in all versions of C
[-Werror,-Wstrict-prototypes]
xg_init()

Quoted 9 lines
         ^
          void

The error message is a bit confusing but appears to new as part of -Wdeprecated-non-prototype which is part of supporting C2x which formally removes K&R syntax.

Either way, fix the offending functions.

Nit: This says "functions" (plural), but I only see one function being modified in this patch?

Doesn't matter too much but might save an archaeologist some confusion if someone were to fix this up on check-in. :-)

-George

#3 lore raw
Quoted 19 lines · George Dunlap

On Thu, Feb 16, 2023 at 11:16 PM Andrew Cooper
<[email protected]> wrote:

Clang-15 (as seen in the FreeBSD 14 tests) complains:

  xg_main.c:1248 error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  xg_init()
         ^
          void

The error message is a bit confusing but appears to new as part of -Wdeprecated-non-prototype which is part of supporting C2x which formally
removes K&R syntax.

Quoted 8 lines

Either way, fix the offending functions.

Nit: This says "functions" (plural), but I only see one function being modified in this patch?

Doesn't matter too much but might save an archaeologist some confusion if someone were to fix this up on check-in. :-)

Yeah, I pre-emptively wrote the commit message as tools-wide.  Given 4 in Xen, I was expecting to find more than 1 in tools.

I fixed it up on commit.

~Andrew