Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_x11sym.h: corrected XQueryKeymap() proto. #9751

Merged
merged 1 commit into from
May 10, 2024

Conversation

sezero
Copy link
Contributor

@sezero sezero commented May 10, 2024

Noticed this in SDL-1.2 in a gcc-13 build, which emitted the following
warning: (No such warnings in SDL2 and SDL3, due to macro differences)

./src/video/x11/SDL_x11sym.h:84:48: warning: argument 2 of type 'char *' declared as a pointer [-Warray-parameter=]
   84 | SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
      |                                          ~~~~~~^
./src/video/x11/SDL_x11dyn.c:95:15: note: in definition of macro 'SDL_X11_SYM'
   95 |         rc fn params { ret p##fn args ; }
      |               ^~~~~~
In file included from ./src/video/x11/SDL_x11dyn.h:27,
                 from ./src/video/x11/SDL_x11dyn.c:26:
/usr/include/X11/Xlib.h:2980:5: note: previously declared as an array 'char[32]'
 2980 |     char [32]           /* keys_return */
      |     ^~~~~~~~~

The original actually was char[32] but was changed with
libsdl-org/SDL-1.2@8ada1e8
(https://bugzilla.libsdl.org/show_bug.cgi?id=170
libsdl-org/SDL-1.2#101)
@icculus: Do you remember why that was?

Noticed this in SDL-1.2 in a gcc-13 build, which emitted the following
warning:  (No such warnings in SDL2 and SDL3, due to macro differences)

./src/video/x11/SDL_x11sym.h:84:48: warning: argument 2 of type 'char *' declared as a pointer [-Warray-parameter=]
   84 | SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
      |                                          ~~~~~~^
./src/video/x11/SDL_x11dyn.c:95:15: note: in definition of macro 'SDL_X11_SYM'
   95 |         rc fn params { ret p##fn args ; }
      |               ^~~~~~
In file included from ./src/video/x11/SDL_x11dyn.h:27,
                 from ./src/video/x11/SDL_x11dyn.c:26:
/usr/include/X11/Xlib.h:2980:5: note: previously declared as an array 'char[32]'
 2980 |     char [32]           /* keys_return */
      |     ^~~~~~~~~

The original actually was char[32] but was changed with
libsdl-org/SDL-1.2@8ada1e8
(https://bugzilla.libsdl.org/show_bug.cgi?id=170
libsdl-org/SDL-1.2#101)
@sezero sezero requested review from icculus and slouken May 10, 2024 15:08
@slouken
Copy link
Collaborator

slouken commented May 10, 2024

It should match SDL2/3. If that’s what this PR does, that’s fine.

@sezero
Copy link
Contributor Author

sezero commented May 10, 2024

It should match SDL2/3. If that’s what this PR does, that’s fine.

I'm not sure I understand. SDL 1.2, 2 and 3 all prototype it the same way (2nd param as pointer) because of inheritance from the above-mentioned commit. This one takes that part back (to '2nd arg as array): if it's good, I'll apply to SDL2 (and to SDL-1.2)

Copy link
Collaborator

@slouken slouken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking around, it looks like all the prototypes use char[], so yes, go ahead and commit and merge.

@sezero sezero merged commit b2fca55 into libsdl-org:main May 10, 2024
38 checks passed
@sezero sezero deleted the x11-gcc13 branch May 10, 2024 15:51
@sezero
Copy link
Contributor Author

sezero commented May 10, 2024

Cherry-picked to SDL2, didn't touch release-2.30.x

Will apply to SDL-1.2 too, shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants