After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611644 - Work around usage of XPointer
Work around usage of XPointer
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2010-03-02 22:38 UTC by Colin Walters
Modified: 2011-02-28 22:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Work around usage of XPointer (1.42 KB, patch)
2010-03-02 22:39 UTC, Colin Walters
none Details | Review
Work around usage of XPointer (979 bytes, patch)
2010-03-02 22:45 UTC, Colin Walters
committed Details | Review
build log from a sparc machine (73.21 KB, application/octet-stream)
2010-03-04 15:29 UTC, Colin Walters
  Details

Description Colin Walters 2010-03-02 22:38:58 UTC
XLib has historically used "char*" for "generic pointer" but
compliers rightly complain when casting this to a structure.

Work around this by taking a void * in our handler, but casting
the function type.
Comment 1 Colin Walters 2010-03-02 22:39:00 UTC
Created attachment 155072 [details] [review]
Work around usage of XPointer
Comment 2 Colin Walters 2010-03-02 22:45:48 UTC
Created attachment 155074 [details] [review]
Work around usage of XPointer

XLib has historically used "char*" for "generic pointer" but
compliers rightly complain when casting this to a structure.

Work around this by casting to void * and letting the implicit
conversion to a structure type take effect.
Comment 3 Colin Walters 2010-03-04 15:29:35 UTC
Created attachment 155233 [details]
build log from a sparc machine
Comment 4 Colin Walters 2010-03-04 15:30:05 UTC
irc:

<owen_> walters: where did this come up? what "compilers" are these? casting from a char * to a structure is certainly 100% valid
--> ach1m (~ach1m@p57A7EA36.dip.t-dialin.net) has joined #gnome-shell
 mizmo (~duffy@66.187.234.199) has joined #gnome-shell
<walters> owen_: gcc
 owen_: on sparc
 owen_: the void * cast is used elsewhere for XPointer conversion in metacity
<ajax> owen_: not if your architecture has alignment requirements.
 (iirc.  i always forget this crap.)
<-- danielb has quit (Remote closed the connection)
<owen_> ajax: how would that differ from void * casts?
<walters> it's just a warning, not an immediate error
<owen_> ajax: the compiler has no idea about the alignment of a void * or a char *?
<walters> i think void * in C is special in that it's a total escape hatch
<owen_> walters: why are you compiling metacity on sparc?
<ajax> oh, i bet this is gcc's aliasing analysis more than something C mandates.
<walters> owen_: haha i'm not, dgilmore was
<owen_> ajax: char * is definitely excepted from the aliasing rules
<-- mizmo has quit (Sláinte Mhath)
<walters> owen_: he wanted to patch out the -Werror from the spec, i wasn't a fan of that, so...
<ajax> well then i'm stumped.
--> mizmo (~duffy@66.187.234.199) has joined #gnome-shell
<owen_> walters I'd have to see the warning to even start to have an idea
<walters> ok...i'll ask
--> sanjien (~sanjie@117.204.5.90) has joined #gnome-shell
 drago01 (~linux@chello062178124135.3.13.univie.teleweb.at) has joined #gnome-shell
 bognarandras (~irssi@catv-86-101-0-88.catv.broadband.hu) has joined #gnome-shell
<owen_> walters: 
<owen_>   case " $CFLAGS " in
   *[\ \ ]-Wcast-align[\ \       ]*) ;;
   *) CFLAGS="$CFLAGS -Wcast-align" ;;
   esac
<walters> ah, yes
<owen_> to me that's the bogus thing, especially since -Wcast-align is machine specific, but whehter your code is bad or not is machine independent
<owen_> walters: if the (void *) cast is all over the same file anyways, then it's probably OK in this case too, but not really, I think, fundamentally, right.
Comment 5 Colin Walters 2011-02-28 22:18:25 UTC
Attachment 155074 [details] pushed as 687376b - Work around usage of XPointer
Comment 6 Colin Walters 2011-02-28 22:21:39 UTC
I had this sitting around in my metacity checkout still, and decided to push it, not like it's going to hurt anything.