{"thread":{"id":"28932","subject":"Compile warnings","startedAt":"2011-11-14T14:55:22Z","lastAt":"2011-11-14T21:55:24Z","messageCount":4,"participants":["Frans Klaver","Ævar Arnfjörð Bjarmason","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179431","messageId":"op.v4xyekju0aolir@keputer","threadId":"28932","inReplyTo":null,"subject":"Compile warnings","fromName":"Frans Klaver","fromEmail":"fransklaver@gmail.com","sentAt":"2011-11-14T14:55:22Z","receivedAt":"2011-11-14T14:55:22Z","isPatch":false,"sender":{"key":"fransklaver@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1876483?v=4"},"body":"Hi,\n\nEvery now and then I see an 'unused result' warning come by during  \nbuilding. What is the general attitude towards these warnings? Remove them  \n(by properly checking)? Or leave them be as a kind of documentation -- we  \nknow we're ignoring the info, but it's good to be reminded?\n\nThanks,\nFrans\n"},{"id":"179434","messageId":"CACBZZX6d_ykc9CbN7H-ACWNUxACb9+TH4ffJ-+9T=SEv6Ai0Ug@mail.gmail.com","threadId":"28932","inReplyTo":"op.v4xyekju0aolir@keputer","subject":"Re: Compile warnings","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-11-14T16:58:20Z","receivedAt":"2011-11-14T16:58:20Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Nov 14, 2011 at 15:55, Frans Klaver <fransklaver@gmail.com> wrote:\n> Every now and then I see an 'unused result' warning come by during building.\n> What is the general attitude towards these warnings? Remove them (by\n> properly checking)? Or leave them be as a kind of documentation -- we know\n> we're ignoring the info, but it's good to be reminded?\n\nUnder what OS / version and compiler / version and what's the warning?\nPaste the full warning(s) you get verbatim.\n"},{"id":"179444","messageId":"7v39dqjvbj.fsf@alter.siamese.dyndns.org","threadId":"28932","inReplyTo":"op.v4xyekju0aolir@keputer","subject":"Re: Compile warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-14T20:36:00Z","receivedAt":"2011-11-14T20:36:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Frans Klaver\" <fransklaver@gmail.com> writes:\n\n> Every now and then I see an 'unused result' warning come by during\n> building. What is the general attitude towards these warnings? Remove\n> them  (by properly checking)? Or leave them be as a kind of\n> documentation -- we  know we're ignoring the info, but it's good to be\n> reminded?\n\nA callsite of a function whose return value is better checked should be\nchecked (e.g. not checking return from close(2) or write(2) in a non-error\ncodepath), but there is no strong mechanical \"General attitude\".\n\nSprinkling (void) that casts the return values all over the place makes\nour code illegible, and we do not prefer it as a solution. A function\nthat returns a value that is useful for some callers but can be safely\nignored by others is sometimes an indication of a poor API, and for our\nown code, we tend to prefer designing the API to pass optional pointer\nto return value from callers that do want to use the return value (and\nothers that do not care about the return value pass NULL).\n"},{"id":"179450","messageId":"op.v4yhummo0aolir@keputer","threadId":"28932","inReplyTo":"CACBZZX6d_ykc9CbN7H-ACWNUxACb9+TH4ffJ-+9T=SEv6Ai0Ug@mail.gmail.com","subject":"Re: Compile warnings","fromName":"Frans Klaver","fromEmail":"fransklaver@gmail.com","sentAt":"2011-11-14T21:55:24Z","receivedAt":"2011-11-14T21:55:24Z","isPatch":false,"sender":{"key":"fransklaver@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1876483?v=4"},"body":"On Mon, 14 Nov 2011 17:58:20 +0100, Ævar Arnfjörð Bjarmason  \n<avarab@gmail.com> wrote:\n\n> On Mon, Nov 14, 2011 at 15:55, Frans Klaver <fransklaver@gmail.com>  \n> wrote:\n>> Every now and then I see an 'unused result' warning come by during  \n>> building.\n>> What is the general attitude towards these warnings? Remove them (by\n>> properly checking)? Or leave them be as a kind of documentation -- we  \n>> know\n>> we're ignoring the info, but it's good to be reminded?\n>\n> Under what OS / version and compiler / version and what's the warning?\n> Paste the full warning(s) you get verbatim.\n\nThis question was triggered by\n\n     warning: ignoring return value of ‘fwrite’, declared with attribute  \nwarn_unused_result\n\nappearing in diff.c, graph.c, grep.c and several others. I'm using gentoo  \nlinux, gcc 4.5.3.\n\nSo the specific question would be, do these fwrites need to be checked?\n"}]}