Hi Orion,

On 12-Feb-25 4:04 AM, Orion Poplawski wrote:
> https://www.x.org/releases/X11R7.7/doc/libXt/intrinsics.html
> 
> Describes:
> 
> typedef struct _XtActionsRec {
> String string;
> XtActionProc proc;
> } XtActionsRec, *XtActionList;
> 
> being initialized with:
> 
> 
> XtActionsRec actionTable[] = {
> {"Set", Set},
> {"Unset", Unset},
> {"Highlight", Highlight},
> {"Unhighlight", Unhighlight}
> {"Notify", Notify},
> };
> 
> But this is no longer valid it seems for at least a couple reasons. First the 
> initializer:
> 
> interface/x_interface.c: In function ‘check_app_res’:
> interface/x_interface.c:617:29: error: storage class specified for parameter 
> ‘new_actions’
>   617 |         static XtActionsRec new_actions[] = {
>       |                             ^~~~~~~~~~~

I think the keyword in the error here is "parameter", it seems that the 
compiler now
thinks this is a function parameter, not a function local variable.

That is what you need to fix, all the other errors also come from this same 
issue.

I guess this code is using old-style K&R function prototypes ?

I have seen cases with gcc15 errors where there is an earlier declaration of
the function without parameters, so instead of:

int foo(int bar);

The function declaration is just:

int foo();

Which leads to errors later on in callers about there being too much arguments,
I wonder if something similar but then in the other direction is happening here
causing gcc to see the

        static XtActionsRec new_actions[] = { ... };

to be a function parameter instead of a function local variable ?

Regards,

Hans







> interface/x_interface.c:617:9: error: parameter ‘new_actions’ is initialized
>   617 |         static XtActionsRec new_actions[] = {
>       |         ^~~~~~
> interface/x_interface.c:617:45: error: variable-sized object may not be 
> initialized except with an empty initializer
>   617 |         static XtActionsRec new_actions[] = {
>       |                                             ^
> 
> Then:
> 
> interface/x_interface.c:618:17: warning: braces around scalar initializer
>   618 |                 {"cmap_mod3",           (XtActionProc)cmap_mod3       
>   },
>       |                 ^
> interface/x_interface.c:618:17: note: (near initialization for ‘new_actions’)
> interface/x_interface.c:618:18: error: initialization of ‘XtActionsRec *’ 
> from incompatible pointer type ‘char *’ [-Wincompatible-pointer-types]
>   618 |                 {"cmap_mod3",           (XtActionProc)cmap_mod3       
>   },
>       |                  ^~~~~~~~~~~
> interface/x_interface.c:618:18: note: (near initialization for ‘new_actions’)
> interface/x_interface.c:618:41: warning: excess elements in scalar initializer
>   618 |                 {"cmap_mod3",           (XtActionProc)cmap_mod3       
>   },
>       |                                         ^
> interface/x_interface.c:618:41: note: (near initialization for ‘new_actions’)
> interface/x_interface.c:619:17: warning: braces around scalar initializer
>   619 |                 {"reverse_mod2", (XtActionProc)reverse_mod2      },
>       |                 ^
> 
> 
> So, what's the proper way to do this now?
> 

-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to