[PATCH] xen: Remove the use of K&R functions

Andrew Cooper posted 1 patch 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230216224438.705395-1-andrew.cooper3@citrix.com
Test gitlab-ci failed
xen/arch/x86/time.c             | 2 +-
xen/drivers/passthrough/iommu.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
[PATCH] xen: Remove the use of K&R functions
Posted by Andrew Cooper 1 year, 2 months ago
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(-)

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


Re: [PATCH] xen: Remove the use of K&R functions
Posted by Andrew Cooper 1 year, 2 months ago
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

Re: [PATCH] xen: Remove the use of K&R functions
Posted by Andrew Cooper 1 year, 2 months ago
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

Re: [PATCH] xen: Remove the use of K&R functions
Posted by Jan Beulich 1 year, 2 months ago
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