diff mbox series

[2/3] aarch64: libgcc: add prototypes in cpuinfo

Message ID 20241003194450.1052220-3-christophe.lyon@linaro.org
State New
Headers show
Series aarch64: Clean warnings in libgcc | expand

Commit Message

Christophe Lyon Oct. 3, 2024, 7:44 p.m. UTC
Add prototypes for __init_cpu_features_resolver and
__init_cpu_features to avoid warnings due to -Wmissing-prototypes.

	libgcc/
	* config/aarch64/cpuinfo.c (__init_cpu_features_resolver): Add
	prototype.
	(__init_cpu_features): Likewise.
---
 libgcc/config/aarch64/cpuinfo.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kyrylo Tkachov Oct. 4, 2024, 8 a.m. UTC | #1
> On 3 Oct 2024, at 21:44, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> 
> External email: Use caution opening links or attachments
> 
> 
> Add prototypes for __init_cpu_features_resolver and
> __init_cpu_features to avoid warnings due to -Wmissing-prototypes.
> 
>        libgcc/
>        * config/aarch64/cpuinfo.c (__init_cpu_features_resolver): Add
>        prototype.
>        (__init_cpu_features): Likewise.
> ---
> libgcc/config/aarch64/cpuinfo.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/libgcc/config/aarch64/cpuinfo.c b/libgcc/config/aarch64/cpuinfo.c
> index 4b94fca8695..c62a7453e8e 100644
> --- a/libgcc/config/aarch64/cpuinfo.c
> +++ b/libgcc/config/aarch64/cpuinfo.c
> @@ -418,6 +418,7 @@ __init_cpu_features_constructor(unsigned long hwcap,
>   setCPUFeature(FEAT_INIT);
> }
> 
> +void __init_cpu_features_resolver(unsigned long, const __ifunc_arg_t *);
> void
> __init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) {
>   if (__aarch64_cpu_features.features)
> @@ -425,6 +426,7 @@ __init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) {
>   __init_cpu_features_constructor(hwcap, arg);
> }
> 
> +void __init_cpu_features(void);
> void __attribute__ ((constructor))
> __init_cpu_features(void) {
>   unsigned long hwcap;

I thought the intent of the missing-prototypes warning is to warn about missing prototypes in a header file primarily.
Should these prototypes go into gcc/common/config/aarch64/cpuinfo.h instead?
Thanks,
Kyrill

> --
> 2.34.1
>
Christophe Lyon Oct. 4, 2024, 8:15 a.m. UTC | #2
On Fri, 4 Oct 2024 at 10:00, Kyrylo Tkachov <ktkachov@nvidia.com> wrote:
>
>
>
> > On 3 Oct 2024, at 21:44, Christophe Lyon <christophe.lyon@linaro.org> wrote:
> >
> > External email: Use caution opening links or attachments
> >
> >
> > Add prototypes for __init_cpu_features_resolver and
> > __init_cpu_features to avoid warnings due to -Wmissing-prototypes.
> >
> >        libgcc/
> >        * config/aarch64/cpuinfo.c (__init_cpu_features_resolver): Add
> >        prototype.
> >        (__init_cpu_features): Likewise.
> > ---
> > libgcc/config/aarch64/cpuinfo.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/libgcc/config/aarch64/cpuinfo.c b/libgcc/config/aarch64/cpuinfo.c
> > index 4b94fca8695..c62a7453e8e 100644
> > --- a/libgcc/config/aarch64/cpuinfo.c
> > +++ b/libgcc/config/aarch64/cpuinfo.c
> > @@ -418,6 +418,7 @@ __init_cpu_features_constructor(unsigned long hwcap,
> >   setCPUFeature(FEAT_INIT);
> > }
> >
> > +void __init_cpu_features_resolver(unsigned long, const __ifunc_arg_t *);
> > void
> > __init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) {
> >   if (__aarch64_cpu_features.features)
> > @@ -425,6 +426,7 @@ __init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) {
> >   __init_cpu_features_constructor(hwcap, arg);
> > }
> >
> > +void __init_cpu_features(void);
> > void __attribute__ ((constructor))
> > __init_cpu_features(void) {
> >   unsigned long hwcap;
>
> I thought the intent of the missing-prototypes warning is to warn about missing prototypes in a header file primarily.

Indeed, that's my understanding too....

> Should these prototypes go into gcc/common/config/aarch64/cpuinfo.h instead?
In that case, compilation of gcc/config/aarch64/aarch64.c fails because:
gcc/common/config/aarch64/cpuinfo.h:96:56: error: ‘__ifunc_arg_t’ does
not name a type
and it does not seem obvious to expose this type in aarch64.c

IIUC, these functions never have their prototypes exposed/used, and
I'm not even sure how __init_cpu_features is called: in
dispatch_function_versions(), I only see a reference to
__init_cpu_features_resolver?

(But I'm not at all familiar with this code)

Thanks,

Christophe


> Thanks,
> Kyrill
>
> > --
> > 2.34.1
> >
>
diff mbox series

Patch

diff --git a/libgcc/config/aarch64/cpuinfo.c b/libgcc/config/aarch64/cpuinfo.c
index 4b94fca8695..c62a7453e8e 100644
--- a/libgcc/config/aarch64/cpuinfo.c
+++ b/libgcc/config/aarch64/cpuinfo.c
@@ -418,6 +418,7 @@  __init_cpu_features_constructor(unsigned long hwcap,
   setCPUFeature(FEAT_INIT);
 }
 
+void __init_cpu_features_resolver(unsigned long, const __ifunc_arg_t *);
 void
 __init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) {
   if (__aarch64_cpu_features.features)
@@ -425,6 +426,7 @@  __init_cpu_features_resolver(unsigned long hwcap, const __ifunc_arg_t *arg) {
   __init_cpu_features_constructor(hwcap, arg);
 }
 
+void __init_cpu_features(void);
 void __attribute__ ((constructor))
 __init_cpu_features(void) {
   unsigned long hwcap;