{"thread":{"id":"22434","subject":"build warnings","startedAt":"2010-01-29T09:03:37Z","lastAt":"2010-01-29T11:23:57Z","messageCount":3,"participants":["Michael Wookey","Jeff King","Erik Faye-Lund"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"132942","messageId":"d2e97e801001290103r5b9cfc2aq8daec90c8c88f2ff@mail.gmail.com","threadId":"22434","inReplyTo":null,"subject":"build warnings","fromName":"Michael Wookey","fromEmail":"michaelwookey@gmail.com","sentAt":"2010-01-29T09:03:37Z","receivedAt":"2010-01-29T09:03:37Z","isPatch":false,"sender":{"key":"michaelwookey@gmail.com","avatar":"https://avatars.githubusercontent.com/u/19476?v=4"},"body":"FYI,\n\nWith current master (dace5dd1), the following build warnings appear on\nUbuntu 9.10 (x86):\n\n  run-command.c: In function ‘notify_parent’:\n  run-command.c:70: warning: ignoring return value of ‘write’,\ndeclared with attribute warn_unused_result\n  run-command.c: In function ‘die_child’:\n  run-command.c:80: warning: ignoring return value of ‘write’,\ndeclared with attribute warn_unused_result\n  run-command.c:81: warning: ignoring return value of ‘write’,\ndeclared with attribute warn_unused_result\n  run-command.c:82: warning: ignoring return value of ‘write’,\ndeclared with attribute warn_unused_result\n\nThese warnings were introduced by the following commits:\n\n  2b541bf8 (\"start_command: detect execvp failures early\")\n  a5487ddf (\"start_command: report child process setup errors to the\nparent's stderr\")\n\nThe GCC details are:\n\n  ~$ gcc --version\n  gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1\n"},{"id":"132950","messageId":"20100129110201.GB6165@coredump.intra.peff.net","threadId":"22434","inReplyTo":"d2e97e801001290103r5b9cfc2aq8daec90c8c88f2ff@mail.gmail.com","subject":"Re: build warnings","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-01-29T11:02:01Z","receivedAt":"2010-01-29T11:02:01Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 29, 2010 at 08:03:37PM +1100, Michael Wookey wrote:\n\n> With current master (dace5dd1), the following build warnings appear on\n> Ubuntu 9.10 (x86):\n> \n>   run-command.c: In function ‘notify_parent’:\n>   run-command.c:70: warning: ignoring return value of ‘write’,\n> declared with attribute warn_unused_result\n>   run-command.c: In function ‘die_child’:\n>   run-command.c:80: warning: ignoring return value of ‘write’,\n> declared with attribute warn_unused_result\n>   run-command.c:81: warning: ignoring return value of ‘write’,\n> declared with attribute warn_unused_result\n>   run-command.c:82: warning: ignoring return value of ‘write’,\n> declared with attribute warn_unused_result\n\nThere is no point in looking at the return value of any of those calls.\nThe first one is about notifying the parent process of a child's failure\nto exec while it is dying (the surrounding function is even an atexit\nhandler!). If we can't do that, there is really no alternative behavior.\nThe latter three are printing fatal error messages. If we fail at that,\nthere is not much to do (unless we should print an error...).\n\n>   ~$ gcc --version\n>   gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1\n\nI have heard that Ubuntu recently switched on unused result warnings by\ndefault, and I have seen complaints that it is generating a lot of\nuninteresting warnings like these.\n\nDoes anybody know if this behavior is here to stay? Can it be worked\naround with -Wno-warn-unused-result or something? There are few enough\ncallsites here that I am not entirely opposed to annotating them with\n\"(void)write\" (does that actually work?), but I worry that this is a\nslippery slope. There are a lot of other calls whose return values are\nalso uninteresting (just looking in the vicinity of this code, I see an\nfflush and a close, neither of whose failure would be interesting). I'm\nnot excited at the prospect of annotating all of them.\n\n-Peff\n"},{"id":"132952","messageId":"40aa078e1001290323u5ab98747p5adc9f703c30fae7@mail.gmail.com","threadId":"22434","inReplyTo":"20100129110201.GB6165@coredump.intra.peff.net","subject":"Re: build warnings","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-01-29T11:23:57Z","receivedAt":"2010-01-29T11:23:57Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Fri, Jan 29, 2010 at 12:02 PM, Jeff King <peff@peff.net> wrote:\n> On Fri, Jan 29, 2010 at 08:03:37PM +1100, Michael Wookey wrote:\n>\n>> With current master (dace5dd1), the following build warnings appear on\n>> Ubuntu 9.10 (x86):\n>>\n>>   run-command.c: In function ‘notify_parent’:\n>>   run-command.c:70: warning: ignoring return value of ‘write’,\n>> declared with attribute warn_unused_result\n>>   run-command.c: In function ‘die_child’:\n>>   run-command.c:80: warning: ignoring return value of ‘write’,\n>> declared with attribute warn_unused_result\n>>   run-command.c:81: warning: ignoring return value of ‘write’,\n>> declared with attribute warn_unused_result\n>>   run-command.c:82: warning: ignoring return value of ‘write’,\n>> declared with attribute warn_unused_result\n>\n> There is no point in looking at the return value of any of those calls.\n> The first one is about notifying the parent process of a child's failure\n> to exec while it is dying (the surrounding function is even an atexit\n> handler!). If we can't do that, there is really no alternative behavior.\n> The latter three are printing fatal error messages. If we fail at that,\n> there is not much to do (unless we should print an error...).\n>\n>>   ~$ gcc --version\n>>   gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1\n>\n> I have heard that Ubuntu recently switched on unused result warnings by\n> default, and I have seen complaints that it is generating a lot of\n> uninteresting warnings like these.\n>\n> Does anybody know if this behavior is here to stay? Can it be worked\n> around with -Wno-warn-unused-result or something? There are few enough\n> callsites here that I am not entirely opposed to annotating them with\n> \"(void)write\" (does that actually work?), but I worry that this is a\n> slippery slope. There are a lot of other calls whose return values are\n> also uninteresting (just looking in the vicinity of this code, I see an\n> fflush and a close, neither of whose failure would be interesting). I'm\n> not excited at the prospect of annotating all of them.\n>\n\nIn my experience, quieting warn-unused-result globally isn't ideal;\nthis warning has helped me track down some serious issues many times\nin the past. IIRC, gcc requires a specific attribute on a function\nprototype in order to generate warnings when the return-value isn't\nused. I guess the issue we're seeing here is that the glibc that\nUbuntu ships has recently added this attribute for some CRT-functions.\n\nPersonally I think that quieting them (\"(void)func(...)\" does work\nAFAIK) can make sense as long as there's only a few call-sites.\nHowever, if it's so many that it'll generate substantial noise in the\ngit-sources or Ubuntu-users will get annoyed beyond sense,\n\"-Wno-warn-unused-result\" might be the only choice. But perhaps this\nis something Ubuntu-users would put in their config.mak?\n\n-- \nErik \"kusma\" Faye-Lund\n"}]}