[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] symbols.c: Avoid warn_unused_result build failure on fgets().



Hi,

On 9 November 2015 at 10:10, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>>> On 09.11.15 at 06:03, <haozhong.zhang@xxxxxxxxx> wrote:
>> On 11/04/15 07:04, Jan Beulich wrote:
>>> >>> On 04.11.15 at 12:39, <riku.voipio@xxxxxxxxxx> wrote:
>>> > In commit:
>>> >
>>> > d37d63d symbols: prefix static symbols with their source file names
>>> >
>>> > An unchecked fgets was added. This causes a compile error:
>>> >
>>> > symbols.c: In function 'read_symbol':
>>> > symbols.c:181:3: error: ignoring return value of 'fgets', declared with
>>> > attribute warn_unused_result [-Werror=unused-result]
>>> >    fgets(str, 500, in); /* discard rest of line */
>>> >    ^
>>> >
>>> > Paper over the warning like in the other similar fgets-on-error-path
>>> > earlier in the same file.
>>>
>>> But the two cases are dissimilar - the original one skips a line the
>>> format of which is not recognized, while here you may be converting
>>> success into an error. (I did notice the comment on the earlier fgets(),
>>> but since so far I didn't get any compiler warning on any system I
>>> built this on, I assumed we'd be fine without the check, since if we
>>> need the check, then it will end up even more clumsy than the other
>>> one.)
>>>
>>
>> Hi Riku and Jan,
>>
>> Will there be any fix for this error? I got the same error when
>> compiling Xen (commit 6f04de6) by gcc 4.8.4 on Ubuntu 14.04.3. And
>> adding "(void)" ahead of fgets() in the existing code cannot eliminate
>> the error/warning message.

> I expect / welcome an (updated) patch.

Sorry, I missed this mail thread. I'll dive into fixing the patch asap.

Riku

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.