Skip to contentSkip to conversation

xen: Remove the use of K&R functions

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

lore
Share & tools
lore
#0 lore raw

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

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

arch/x86/time.c:1364:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] s_time_t get_s_time()

                     ^
                      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: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

These are all the examples found in a default build of Xen. I'm still finding toolstack violations.

---
 xen/arch/x86/time.c             | 2 +-
 xen/drivers/passthrough/iommu.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/time.c +1 -1
index 782b11c8a97b..4e44a43cc5e8 100644
@@ -1361,7 +1361,7 @@ s_time_t get_s_time_fixed(u64 at_tsc)
     return t->stamp.local_stime + scale_delta(delta, &t->tsc_scale);
 }
 
-s_time_t get_s_time()
+s_time_t get_s_time(void)
 {
     return get_s_time_fixed(0);
 }
xen/drivers/passthrough/iommu.c +2 -2
index 921b71e81904..0e187f6ae33c 100644
@@ -606,7 +606,7 @@ int __init iommu_setup(void)
     return rc;
 }
 
-int iommu_suspend()
+int iommu_suspend(void)
 {
     if ( iommu_enabled )
         return iommu_call(iommu_get_ops(), suspend);
@@ -614,7 +614,7 @@ int iommu_suspend()
     return 0;
 }
 
-void iommu_resume()
+void iommu_resume(void)
 {
     if ( iommu_enabled )
         iommu_vcall(iommu_get_ops(), resume);
Signature · 1 line
2.30.2
#1 lore raw
Quoted 14 lines · Andrew Cooper

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

arch/x86/time.c:1364:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] s_time_t get_s_time()

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

Quoted 8 lines

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

These are all the examples found in a default build of Xen. I'm still finding toolstack violations.

Apparently not.  int cf_check vmx_cpu_up() too.

~Andrew

#2 lore raw
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Andrew Cooper

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

arch/x86/time.c:1364:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] s_time_t get_s_time()

                     ^
                      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: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

Quoted 3 lines
Quoted 2 lines

These are all the examples found in a default build of Xen. I'm still finding toolstack violations.

Apparently not.  int cf_check vmx_cpu_up() too.

Ok, finally got a clean Clang-15 build.  I've folded this hunk into the patch:

xen/arch/x86/hvm/vmx/vmcs.c +0 -0
index 09edbd23b399..e1c268789e7e 100644
@@ -781,7 +781,7 @@ static int _vmx_cpu_up(bool bsp)

     return 0;
 }

-int cf_check vmx_cpu_up()
+int cf_check vmx_cpu_up(void)
 {
     return _vmx_cpu_up(false);
 }

but am not intending to send a v2 given how trivial it is.

~Andrew

Reviewed-by
#3 lore raw
Quoted 44 lines · Andrew Cooper
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Andrew Cooper

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

arch/x86/time.c:1364:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] s_time_t get_s_time()

                     ^
                      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: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

Quoted 3 lines
Quoted 2 lines

These are all the examples found in a default build of Xen. I'm still finding toolstack violations.

Apparently not.  int cf_check vmx_cpu_up() too.

Ok, finally got a clean Clang-15 build.  I've folded this hunk into the patch:

xen/arch/x86/hvm/vmx/vmcs.c +0 -0
index 09edbd23b399..e1c268789e7e 100644
@@ -781,7 +781,7 @@ static int _vmx_cpu_up(bool bsp)
      return 0;
  }

xen/arch/x86/hvm/vmx/vmcs.c +1 -1
-int cf_check vmx_cpu_up()
+int cf_check vmx_cpu_up(void)

 {
     return _vmx_cpu_up(false);
 }

Quoted 1 line

but am not intending to send a v2 given how trivial it is.

Sure.

Jan