[Dovecot] typo in failures.c
Hi, I found a typo on line 101 of dovecot-1.1.rc8/src/lib/failures.c.
The first two arguments to io_add() are reversed. The fd should be
first, and IO_WRITE second.
On Fri, 2008-06-06 at 21:00 -0500, Mike Abbott wrote:
Hi, I found a typo on line 101 of dovecot-1.1.rc8/src/lib/failures.c.
The first two arguments to io_add() are reversed. The fd should be
first, and IO_WRITE second.
Thanks, fixed: http://hg.dovecot.org/dovecot-1.1/rev/7c9895192a23
I wish gcc warned about bad enum usages, it would have caught this.
--On Saturday, June 07, 2008 5:11 AM +0300 Timo Sirainen tss@iki.fi wrote:
I wish gcc warned about bad enum usages, it would have caught this.
Wow, that surprised me that it lacked that, as I'm so used to it on Windows. But I mostly code in C++ there, so perhaps the conversion in C is legal?
http://gcc.gnu.org/ml/gcc/2004-07/msg00375.html
Except that conversion from one enum type to another looks like it should be illegal based on that message.
On Fri, 2008-06-06 at 22:55 -0700, Kenneth Porter wrote:
--On Saturday, June 07, 2008 5:11 AM +0300 Timo Sirainen tss@iki.fi wrote:
I wish gcc warned about bad enum usages, it would have caught this.
Wow, that surprised me that it lacked that, as I'm so used to it on Windows. But I mostly code in C++ there, so perhaps the conversion in C is legal?
http://gcc.gnu.org/ml/gcc/2004-07/msg00375.html
Except that conversion from one enum type to another looks like it should be illegal based on that message.
I don't mind that much if enum -> int is allowed, but as that mail says int -> enum shouldn't be. But gcc gives no warnings about that either. The closest warning related to that I could find was:
-Wenum-compare (C++ and Objective-C++ only) Warn about a comparison between values of different enum types.
I think it was Sun Studio that warned about enum usage. Maybe I should try compiling Dovecot once again to see if it shows more bugs.
Kenneth Porter wrote:
Wow, that surprised me that it lacked that, as I'm so used to it on Windows. But I mostly code in C++ there, so perhaps the conversion in C is legal?
Yes, implicit int->enum conversion is allowed in C, but not C++. (TC++PL p. 817)
(And implicit cast from void* to any other pointer type is not allowed in C++, either)
Anders.
On Sat, 2008-06-07 at 05:11 +0300, Timo Sirainen wrote:
On Fri, 2008-06-06 at 21:00 -0500, Mike Abbott wrote:
Hi, I found a typo on line 101 of dovecot-1.1.rc8/src/lib/failures.c.
The first two arguments to io_add() are reversed. The fd should be
first, and IO_WRITE second.Thanks, fixed: http://hg.dovecot.org/dovecot-1.1/rev/7c9895192a23
I wish gcc warned about bad enum usages, it would have caught this.
The Linux kernel uses sparse(1) to catch this kind of thing, but it may require some annotations. Cf. http://www.kernel.org/pub/software/devel/sparse/
johannes
participants (5)
-
Anders
-
Johannes Berg
-
Kenneth Porter
-
Mike Abbott
-
Timo Sirainen