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 439122 - Compilation warning in evolution's calendar folder
Compilation warning in evolution's calendar folder
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: general
2.12.x
Other All
: Normal trivial
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
evolution[codecleanup]
Depends on:
Blocks: 437579
 
 
Reported: 2007-05-17 12:46 UTC by Gilles Dartiguelongue
Modified: 2013-09-13 00:54 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
evolution-calendar-warning.patch (19.80 KB, patch)
2007-05-17 12:55 UTC, Gilles Dartiguelongue
committed Details | Review
evo_build.log (10.69 KB, text/plain)
2007-08-30 10:37 UTC, Milan Crha
  Details
evolution-calendar-weak-refs.patch (987 bytes, patch)
2007-09-05 10:24 UTC, Gilles Dartiguelongue
needs-work Details | Review
evolution-calendar-weak-refs.patch (1.89 KB, patch)
2007-09-06 09:40 UTC, Gilles Dartiguelongue
committed Details | Review
proposed evo patch (12.75 KB, patch)
2007-10-01 09:32 UTC, Milan Crha
needs-work Details | Review
proposed evo patch ][ (12.73 KB, patch)
2007-10-04 08:55 UTC, Milan Crha
none Details | Review

Description Gilles Dartiguelongue 2007-05-17 12:46:33 UTC
Please describe the problem:
to follow, a patch to fix most compilation warnings in evolution/calendar


Steps to reproduce:



Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Gilles Dartiguelongue 2007-05-17 12:55:37 UTC
Created attachment 88331 [details] [review]
evolution-calendar-warning.patch

left is a cast I couldn't yet find a way to sanitize.
Comment 2 Srinivasa Ragavan 2007-05-18 05:02:16 UTC
Looks fine Gilles. Im sure that it would fix some bugs as well (return values from g_list* weren't handled) Thanks
Comment 3 Matthew Barnes 2007-06-03 02:10:03 UTC
Committed to Subversion trunk (revision 33625).
Comment 4 Nathan Owens 2007-08-26 17:09:03 UTC
Note that this patch causes the gnome-pilot conduits to crash. I'm going to back out the patch for the conduit files in bug 201167, as I'm currently trying to combine a few patches into one for the conduits. I'll also add a comment to allow future developers know not to touch it.

The specific problem is that ctxt->locals should not be modified by the return of g_slist_prepend() in the calendar-conduit.c, todo-conduit.c, and memo-conduit.c files. We're not losing anything - the calling gnome-pilot function handles it. The change added by this bug fix screws up the iteration that's happening and we end up with corrupt/null pointers when the conduit is destroyed at the end of a sync. Specifically, todoconduit_destroy_record() crashes when trying to call free_ToDo(), and g_object_unref() complains about a bad reference. The same happens for the other conduits.
Comment 5 Milan Crha 2007-08-29 11:04:58 UTC
I think the fix in calls of g_object_add_weak_pointer is wrong, because as a second parameter would be used a pointer which should be set to NULL after the object is freed. In a patch there is passed an address into local variable, so it may not work as expected. Even I don't like this kind of coding, try to write it in this way:
g_object_add_weak_pointer (G_OBJECT (priv->vbox), (gpointer *) (void *) &(priv->vbox));

I also noticed that the patch for unpack_Appointment call can be done in the previous (two lines above) call too.

To Nathan, I didn't get the point of your comment, why it should not be modified? It looks very strange, the fix do (from my point of view) exactly what is supposed to do (in this part).
Comment 6 Matthew Barnes 2007-08-29 12:54:16 UTC
Milan is right, the second argument to g_object_add_weak_pointer() must be the address of the pointer that will be set to NULL when the object is finalized.

There's two ways to clean up strict aliasing warnings:

1) Declare the "vbox" member of EItipControlPrivate to be a gpointer rather
   than a GtkWidget.

2) Define a vbox as a union in the EItipControlPrivate struct:

      union {
         gpointer pointer;
         GtkWidget *widget;
      } vbox;

   The go through the file and change all usage of priv->vbox to
   priv->vbox.widget where it should be used as a object or widget.

   The g_object_add_weak_pointer() call would then look like:

      g_object_add_weak_pointer (
              G_OBJECT (priv->vbox.widget), &priv->vbox.pointer);

I personally prefer the second approach even though it's much more verbose, but either way should do it.

More info:
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html
Comment 7 Matthew Barnes 2007-08-29 12:55:10 UTC
Reopening to address the above comments.
Comment 8 Milan Crha 2007-08-30 10:37:36 UTC
Created attachment 94623 [details]
evo_build.log

I forget to mention, it introduce other/new warnings on my 64bit machine/system, like this:
e-tasks.c: In function 'e_tasks_open_task_id':
e-tasks.c:1462: warning: cast from pointer to integer of different size

We had a chat on IRC so I'm attaching here file, which contains errors from a build of whole Evolution on my machine. I've one for eds too, if you are interested.
Comment 9 Gilles Dartiguelongue 2007-09-05 10:24:05 UTC
Created attachment 94982 [details] [review]
evolution-calendar-weak-refs.patch

ok this should address the incorrect assignation and the potential bug that Milan explained.
Comment 10 Milan Crha 2007-09-05 10:55:53 UTC
Second one should be priv->hbox, I bet ;) Also notice, original patch has weak pointer change in insert_ok too. Please do ChangeLog entry too, thanks.
Comment 11 Gilles Dartiguelongue 2007-09-06 09:40:48 UTC
Created attachment 95044 [details] [review]
evolution-calendar-weak-refs.patch

ok, I think that's it this time.
Comment 12 Milan Crha 2007-09-06 11:15:55 UTC
Looks good to commit from my side.
Comment 13 Matthew Barnes 2007-09-07 12:43:51 UTC
The patch will fix the behavior but it still breaks strict aliasing rules.  See comment #6 for how to fix this properly.  I'll approve this in order to fix the bug, but we'll have to revisit the strict aliasing issue at some point.
Comment 14 Gilles Dartiguelongue 2007-09-07 14:21:36 UTC
commited and removed the warning suppression part as discussed with Matthew and Milan on irc.
Comment 15 Milan Crha 2007-10-01 09:32:05 UTC
Created attachment 96450 [details] [review]
proposed evo patch

for evolution;

Here's a fix for rest compiler warnings in calendar subdirectory, which I saw on my x86_64 system/machine. I also fixed some leaks there.
Comment 16 Srinivasa Ragavan 2007-10-04 08:23:22 UTC
Never comment something like this.

+	gdouble width/*, height*/;

Also

foo { /*comment */

It sort of spoils the readability of the code. I know there are some. But lets not add any new.
Comment 17 Milan Crha 2007-10-04 08:55:30 UTC
Created attachment 96618 [details] [review]
proposed evo patch ][

for evolution;

I'm sorry I did this. I removed that /*, height*/ comment and moved those /* to fix strict-aliasing */ comments above unions. I hope it's better now. I didn't change anything else there (except of the date in ChangeLog).
Comment 18 Srinivasa Ragavan 2007-11-05 06:34:30 UTC
Milan, I dont see any obvious fix. Havent tested it. Just test/compile and commit.
Comment 19 Milan Crha 2007-11-05 11:10:51 UTC
Removed part of
* gui/e-itip-control.c
* gui/dialogs/alarm-dialog.c
* gui/e-day-view-layout.c
* gui/e-day-view-layout.h
* gui/print.c
because it is there already. So the only thing which kept here is the fix for bug #270605. So I obsolete my patch and attach improved one to that bug.
Comment 20 Milan Crha 2007-11-05 11:20:00 UTC
I changed my mind, I keep that patch to Suman there. Closing this as fixed, because all has been committed regarding to calendar directory. (If I didn't overlooked something.)