Ticket #1897 (accepted defect) — at Version 3

Opened 10 years ago

Last modified 10 years ago

Build breaks on ignored return values

Reported by: metux Owned by: metux
Priority: blocker Milestone: 4.7.2
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description (last modified by metux) (diff)

glibc has a lot of functions whose return values should not be ignored. this produces a lot of warnings, which cause the build to break when using -Werror (which *really* should be standard for any production build ;-p):

background.c:446: error: ignoring return value of 'write', declared with attribute warn_unused_result

(setting the priority to blocker, since it breaks any serious build)

branch:1897_libc_return_values
changeset:61ab5c96737d98ba85c358f39f3b497d6c880961

Change History

comment:1 follow-up: ↓ 2 Changed 10 years ago by andrew_b

Branch: 1897_libc_return_values.

-       fscanf (f, ";\n");
+       if (fscanf (f, ";\n"));

Where you've seen such way? The widely used way to suppress warings of unsed return values is

       (void) fscanf (f, ";\n");

I think we should use a common coding styles in MC codebase.

comment:2 in reply to: ↑ 1 Changed 10 years ago by slyfox

Replying to andrew_b:

Branch: 1897_libc_return_values.

-       fscanf (f, ";\n");
+       if (fscanf (f, ";\n"));

Where you've seen such way?

Agreed, looks ambiguous, odd and (not yet) generates another warning:

warning: suggest braces around empty body in an 'if' statement [-Wempty-body]

The widely used way to suppress warings of unsed return values is

       (void) fscanf (f, ";\n");

I think we should use a common coding styles in MC codebase.

Agreed.

comment:3 Changed 10 years ago by metux

  • Status changed from new to accepted
  • Version changed from version not selected to master
  • Description modified (diff)
  • severity changed from no branch to on review

Okay, reworked it. Please review now.

Note: See TracTickets for help on using tickets.