GNOME Bugzilla – Bug 666081
Duplicate typedefs
Last modified: 2013-09-13 01:05:41 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
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); } [...] }
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."
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.
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
(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.
-ansi and -std=c89 are synonymous, right?
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. :-)
(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.
(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!