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 666081 - Duplicate typedefs
Duplicate typedefs
Status: VERIFIED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.4.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2011-12-13 12:27 UTC by Christophe Fergeau
Modified: 2013-09-13 01:05 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christophe Fergeau 2011-12-13 12:27:38 UTC
make[4]: entrant dans le répertoire « /home/teuf/gnome/src/evolution/mail »
  CC     libevolution_mail_la-e-mail-account-store.lo
In file included from ../mail/e-mail-session.h:31,
                 from ../mail/e-mail-backend.h:29,
                 from ../mail/mail-ops.h:32,
                 from e-mail-account-store.c:30:
../mail/mail-folder-cache.h:53: erreur: redefinition of typedef ‘EMailSession’
e-mail-account-store.h:47: note: previous declaration of ‘EMailSession’ was here
In file included from ../mail/e-mail-backend.h:29,
                 from ../mail/mail-ops.h:32,
                 from e-mail-account-store.c:30:
../mail/e-mail-session.h:59: erreur: redefinition of typedef ‘EMailAccountStore’
e-mail-account-store.h:59: note: previous declaration of ‘EMailAccountStore’ was here
../mail/e-mail-session.h:61: erreur: redefinition of typedef ‘EMailSession’
../mail/mail-folder-cache.h:53: note: previous declaration of ‘EMailSession’ was here
make[4]: *** [libevolution_mail_la-e-mail-account-store.lo] Erreur 1
make[4]: quittant le répertoire « /home/teuf/gnome/src/evolution/mail »
make[3]: *** [all-recursive] Erreur 1
make[3]: quittant le répertoire « /home/teuf/gnome/src/evolution/mail »
make[2]: *** [all] Erreur 2
make[2]: quittant le répertoire « /home/teuf/gnome/src/evolution/mail »
make[1]: *** [all-recursive] Erreur 1
make[1]: quittant le répertoire « /home/teuf/gnome/src/evolution »
make: *** [all] Erreur 2
Comment 1 Dodji Seketeli 2011-12-13 12:59:18 UTC
Although the re-definition is unfortunate and should trigger a
warning, I think the code is valid, so this is a GCC issue.  I
believe this code is accepted in recent GCCs.  AIUI, the part of
the code in the C front-end in GCC that deals with this (in
trunk) is, in gcc/c-decl.c:

static bool
diagnose_mismatched_decls (tree newdecl, tree olddecl,
			   tree *newtypep, tree *oldtypep)
{
[...]
      else if (pedantic && !flag_isoc1x)
	{
	  pedwarn (input_location, OPT_pedantic,
		   "redefinition of typedef %q+D", newdecl);
	  locate_old_decl (olddecl);
	}
[...]
}
Comment 2 Christophe Fergeau 2011-12-14 13:40:56 UTC
I filed https://bugzilla.redhat.com/show_bug.cgi?id=767538 against gcc, and here is the answer I got

"Jakub Jelinek 2011-12-14 08:28:18 EST

The duplicate typedefs are invalid in both ISO C89 and C99, it is only valid in
the upcoming C1X standard that is being worked on.  GCC 4.6 and later allow it
as an extension (except for -pedantic-errors) in preparation for C1X standard,
but that doesn't change anything on it being invalid in C89 and C99 [...].  Just fix up your sources."
Comment 3 Dodji Seketeli 2011-12-14 15:50:12 UTC
Yeah, I was wrong in saying it was a GCC issue.  Re-reading the C99 specification carefully proved me wrong, as I noted on the bug linked to by Christophe above.  So I am afraid this ought to be fixed in the sources.
Comment 4 Matthew Barnes 2011-12-14 18:47:13 UTC
Thanks for the clarification, I've heard conflicting answers about that and wasn't sure if it was really standards-compliant.

Either of you know of a handy gcc flag that will catch this?  It builds fine for me with gcc-4.6.2-1.fc16, but I'd prefer it to fail.  (-ansi is overkill, need something more targeted)

This should fix it, reopen if I missed something:

http://git.gnome.org/browse/evolution/commit/?id=a4f11df843ef2ab53e32c6fd84e3d980e0d092cf
Comment 5 Dodji Seketeli 2011-12-14 19:05:05 UTC
(In reply to comment #4)

> Either of you know of a handy gcc flag that will catch this?

You could maybe try -std=c89 or -std=c99.
Comment 6 Matthew Barnes 2011-12-14 19:14:19 UTC
-ansi and -std=c89 are synonymous, right?
Comment 7 Dodji Seketeli 2011-12-14 20:35:33 UTC
Right.  Actually it's equivalent to -std=c90.  I miss the part of your question where you were saying that you wanted something target.

Unfortunately, the only "targeted" option I see from reading the source code is -pedantic.  And that might prevent many other parts of the Evolution source code from compiling.  So I guess we are left with asking Christophe to try to build the code again with a compiler which version is less than 4.6.  :-)
Comment 8 Matthew Barnes 2011-12-14 21:20:00 UTC
(In reply to comment #7)
> Unfortunately, the only "targeted" option I see from reading the source code is
> -pedantic.  And that might prevent many other parts of the Evolution source
> code from compiling.

It does.  In fact in fixing this I thought "well I'll just add -ansi -pedantic and get everything cleaned up nice" but it choked on all kinds of bogus looking issues and I had to abort, hence the desire for a more targeted warning option.
Comment 9 Christophe Fergeau 2011-12-15 09:01:38 UTC
(In reply to comment #4)
> This should fix it, reopen if I missed something:
> 
> http://git.gnome.org/browse/evolution/commit/?id=a4f11df843ef2ab53e32c6fd84e3d980e0d092cf

I just tried it and I can successfully compile evolution master, so works for me. Thanks!