diff mbox series

xen: Remove the use of K&R functions

Message ID 20230216224438.705395-1-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen: Remove the use of K&R functions | expand

Commit Message

Andrew Cooper Feb. 16, 2023, 10:44 p.m. UTC
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.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>

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(-)

Comments

Andrew Cooper Feb. 16, 2023, 11:02 p.m. UTC | #1
On 16/02/2023 10:44 pm, Andrew Cooper wrote:
> 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.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Wei Liu <wl@xen.org>
>
> 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
Andrew Cooper Feb. 16, 2023, 11:17 p.m. UTC | #2
On 16/02/2023 11:02 pm, Andrew Cooper wrote:
> On 16/02/2023 10:44 pm, Andrew Cooper wrote:
>> 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.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Jan Beulich <JBeulich@suse.com>
>> CC: Roger Pau Monné <roger.pau@citrix.com>
>> CC: Wei Liu <wl@xen.org>
>>
>> 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:

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 09edbd23b399..e1c268789e7e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -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
Jan Beulich Feb. 17, 2023, 7:29 a.m. UTC | #3
On 17.02.2023 00:17, Andrew Cooper wrote:
> On 16/02/2023 11:02 pm, Andrew Cooper wrote:
>> On 16/02/2023 10:44 pm, Andrew Cooper wrote:
>>> 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.
>>>
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>> ---
>>> CC: Jan Beulich <JBeulich@suse.com>
>>> CC: Roger Pau Monné <roger.pau@citrix.com>
>>> CC: Wei Liu <wl@xen.org>
>>>
>>> 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:
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index 09edbd23b399..e1c268789e7e 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -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.

Sure.

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 782b11c8a97b..4e44a43cc5e8 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -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);
 }
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 921b71e81904..0e187f6ae33c 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -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);