11 messages in ru.sysoev.nginxRe: Compilation errors on Ubuntu 8.10...
FromSent OnAttachments
Eric BensonNov 10, 2008 9:38 am.log, .diff
Igor SysoevNov 10, 2008 12:34 pm.Other
Eric BensonNov 10, 2008 1:25 pm 
Maxim DouninNov 10, 2008 1:35 pm 
Igor SysoevNov 10, 2008 1:43 pm 
Eric BensonNov 10, 2008 2:27 pm 
Maxim DouninNov 10, 2008 3:47 pm 
Maxim DouninNov 10, 2008 4:29 pm.txt
Igor SysoevNov 10, 2008 10:35 pm.Other
Eric BensonNov 10, 2008 11:24 pm 
mikeNov 10, 2008 11:33 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Compilation errors on Ubuntu 8.10 Intrepid IbexActions...
From:Maxim Dounin (mdou@mdounin.ru)
Date:Nov 10, 2008 1:35:17 pm
List:ru.sysoev.nginx

Hello!

On Mon, Nov 10, 2008 at 11:34:37PM +0300, Igor Sysoev wrote:

On Mon, Nov 10, 2008 at 09:38:39AM -0800, Eric Benson wrote:

Compiling either 0.6.32 or 0.7.20 on a new Ubuntu 8.10 installation with gcc
4.3.2 causes errors due to a new compiler warning (when combined with the use of
-Werror in CFLAGS). There is now a compiler warning when the return value of
write() is ignored. This causes errors in a number of placees in nginx. I have
included a log showing the compiler output as well as a patch file showing the
changes I made to avoid these errors.

Thank you. However, there is more elegant way to suppress this warning without stub variables:

(void) write_fd(...)

Could you test the attached patch ?

No, warn_unused_result warning can't be avoided by casting to void:

$ cat unused.c int foo() __attribute__((warn_unused_result));

int foo() { return 1; }

int main() { (void) foo();

return 0; } $ gcc unused.c unused.c: In function 'main': unused.c:12: warning: ignoring return value of 'foo', declared with attribute
warn_unused_result

More details here:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509

However I don't think it's a good idea to use stub variables. Probably something like

if (ngx_write_fd(...) == NGX_FILE_ERROR) { /* void */ }

would be better.

p.s. Actually I think that it's glibc's bug. But we probably have to live with it, at least for some time.