You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So Fedora 40 now defaults to gcc14 (development version). gcc14 defaults to -Werror=incompatible-pointer-types , and now compiling player (on Fedora player-3.1.0-55.fc40) causes compilation error as:
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c: In function ‘_wrap_playerc_blackboard_on_blackboard_event_set’:
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56575:23: warning: ‘struct playerc_blackboard’ declared inside parameter list will not be visible outside of this definition or declaration
56575 | void (*arg2)(struct playerc_blackboard *,player_blackboard_entry_t) = (void (*)(struct playerc_blackboard *,player_blackboard_entry_t)) 0 ;
| ^~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56575:90: warning: ‘struct playerc_blackboard’ declared inside parameter list will not be visible outside of this definition or declaration
56575 | void (*arg2)(struct playerc_blackboard *,player_blackboard_entry_t) = (void (*)(struct playerc_blackboard *,player_blackboard_entry_t)) 0 ;
| ^~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56575:73: error: initialization of ‘void (*)(struct playerc_blackboard *, player_blackboard_entry_t)’ {aka ‘void (*)(struct playerc_blackboard *, struct player_blackboard_entry)’} from incompatible pointer type ‘void (*)(struct playerc_blackboard *, player_blackboard_entry_t)’ {aka ‘void (*)(struct playerc_blackboard *, struct player_blackboard_entry)’} [-Wincompatible-pointer-types]
56575 | void (*arg2)(struct playerc_blackboard *,player_blackboard_entry_t) = (void (*)(struct playerc_blackboard *,player_blackboard_entry_t)) 0 ;
| ^
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56593:41: error: assignment to ‘void (*)(struct playerc_blackboard *, player_blackboard_entry_t)’ {aka ‘void (*)(struct playerc_blackboard *, struct player_blackboard_entry)’} from incompatible pointer type ‘void (*)(struct playerc_blackboard *, player_blackboard_entry_t)’ {aka ‘void (*)(struct playerc_blackboard *, struct player_blackboard_entry)’} [-Wincompatible-pointer-types]
56593 | if (arg1) (arg1)->on_blackboard_event = arg2;
| ^
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c: In function ‘_wrap_playerc_blackboard_on_blackboard_event_get’:
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56605:25: warning: ‘struct playerc_blackboard’ declared inside parameter list will not be visible outside of this definition or declaration
56605 | void (*result)(struct playerc_blackboard *,player_blackboard_entry_t) = 0 ;
| ^~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56616:29: warning: ‘struct playerc_blackboard’ declared inside parameter list will not be visible outside of this definition or declaration
56616 | result = (void (*)(struct playerc_blackboard *,player_blackboard_entry_t)) ((arg1)->on_blackboard_event);
| ^~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/player-release-3-1-0/redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c:56616:10: error: assignment to ‘void (*)(struct playerc_blackboard *, player_blackboard_entry_t)’ {aka ‘void (*)(struct playerc_blackboard *, struct player_blackboard_entry)’} from incompatible pointer type ‘void (*)(struct playerc_blackboard *, player_blackboard_entry_t)’ {aka ‘void (*)(struct playerc_blackboard *, struct player_blackboard_entry)’} [-Wincompatible-pointer-types]
56616 | result = (void (*)(struct playerc_blackboard *,player_blackboard_entry_t)) ((arg1)->on_blackboard_event);
| ^
These warnings / errors are a bit difficult to understand, but the file redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c generated by swig, then preprocessed, reads:
So there is no struct playerc_blackboard forward declaration before _wrap_playerc_blackboard_on_blackboard_event_set, and gcc cannot understand it.
This is because this playercRUBY_wrap.c is generated by parsing header file with client_libs/libplayerc/bindings/python/playerc_swig_parse.py, then converted with swig. The parsed header file client_libs/libplayerc/playerc.h reads:
1227 typedef struct playerc_blackboard
1228 {
1229 /** Device info; must be at the start of all device structures. */
1230 playerc_device_t info;
1231 /** Function to be called when a key is updated. */
1232 void (*on_blackboard_event)(struct playerc_blackboard*, player_blackboard_entry_t);
1233 /** Kludge to get around python callback issues. */
1234 void *py_private;
1235 } playerc_blackboard_t;
So there is struct playerc_blackboard definition, which does self-reference. But then playerc_swig_parse.py reads:
197 struct=re.compile("""
198 (?P<decl>typedef\s+struct\s*)\w*\s* # Declaration <==========================
199 {(?P<body>.*?)}(?P<footer>\s* # Body
200 (?P<name>playerc_\w+?)(_t)? # Name
201 \s*;)
202 """, re.DOTALL|re.VERBOSE)
So this regexp changes the above typedef struct playerc_blackboard line (in playerc.h) to typedef struct , then the generated swig file contains incomplete playerc_blackboard_t declaration.
The fix for this is to do explicit formard declaration for struct playerc_blackboard .
The text was updated successfully, but these errors were encountered:
mtasaka
added a commit
to mtasaka/player
that referenced
this issue
Feb 12, 2024
…tion
Language bindings use files generated by playerc_swig_parse.py which parses header files, and playerc_swig_parse.py deletes the "tag" in struct definition. This behavior generates incomplete struct definition in generated file, then causes compilation error.
To avoid compilation error, do explicit forward declaration for such struct.
Fixesplayerproject#26 .
So Fedora 40 now defaults to gcc14 (development version). gcc14 defaults to
-Werror=incompatible-pointer-types
, and now compiling player (on Fedora player-3.1.0-55.fc40) causes compilation error as:These warnings / errors are a bit difficult to understand, but the file
redhat-linux-build/client_libs/libplayerc/bindings/ruby/playercRUBY_wrap.c
generated by swig, then preprocessed, reads:So there is no
struct playerc_blackboard
forward declaration before_wrap_playerc_blackboard_on_blackboard_event_set
, and gcc cannot understand it.This is because this
playercRUBY_wrap.c
is generated by parsing header file withclient_libs/libplayerc/bindings/python/playerc_swig_parse.py
, then converted withswig
. The parsed header file client_libs/libplayerc/playerc.h reads:So there is
struct playerc_blackboard
definition, which does self-reference. But thenplayerc_swig_parse.py
reads:So this regexp changes the above
typedef struct playerc_blackboard
line (in playerc.h) totypedef struct
, then the generated swig file contains incompleteplayerc_blackboard_t
declaration.The fix for this is to do explicit formard declaration for
struct playerc_blackboard
.The text was updated successfully, but these errors were encountered: