Re: How to do structure initialization with gcc 15

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 11, 2025 at 08:04:58PM -0700, 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:

Please post a preprocessed source (e.g. add -save-temps option to the gcc
command line that compiles it).

> 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[] = {
>       |                             ^~~~~~~~~~~
> 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?

	Jakub

-- 
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux