https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89031

            Bug ID: 89031
           Summary: Should not report unused result when explicitly cast
                    to void
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: porton at narod dot ru
  Target Milestone: ---

GCC reports unused result even when explicitly converted to void to show the
developer's intent not to report a warning.

lib.c: In function ‘libcomcom_run_command’:
lib.c:263:15: error: ignoring return value of ‘write’, declared with attribute
warn_unused_result [-Werror=unused-result]
         (void)write(process.child[WRITE_END], &errno, sizeof(errno)); /*
deliberately don't check error */
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Should not report unused result when explicitly cast to void.

Reply via email to