You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "Marko Kiiskila (JIRA)" <ji...@apache.org> on 2017/03/28 22:35:41 UTC

[jira] [Resolved] (MYNEWT-688) error: ignoring return value of 'write', declared with attribute warn_unused_result

     [ https://issues.apache.org/jira/browse/MYNEWT-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marko Kiiskila resolved MYNEWT-688.
-----------------------------------
    Resolution: Fixed

I started seeing this too. Maybe some additional compiler warning flags are now on.

Disabled that warning when compiling hw/mcu/native, and assigned the value in kernel/os/arch/sim/os_fault.c:__assert_func().

I checked this fix into develop branch, so you can either cherry-pick that change, or continue what you have, or check out develop.


> error: ignoring return value of 'write', declared with attribute warn_unused_result
> -----------------------------------------------------------------------------------
>
>                 Key: MYNEWT-688
>                 URL: https://issues.apache.org/jira/browse/MYNEWT-688
>             Project: Mynewt
>          Issue Type: Bug
>          Components: HAL
>    Affects Versions: v1_0_0_beta1
>         Environment: OS X w/ newt docker container
>            Reporter: Jeff Chan
>            Assignee: Marko Kiiskila
>            Priority: Minor
>             Fix For: v1_0_0_rel
>
>
> Using docker image (local toolchain gcc-5 install seems to avoid these warnings)
> mynewt/newt                     latest              190ce9ee7de9        5 days ago          1.05 GB
> Compile fails for native sim target.  Would love to help, but unsure what the official way to ignore the return value is.  GCC compile flag? Macro that uses and discards the result?
> Error: repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c: In function 'hal_uart_blocking_tx':
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:317:5: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>      (void) write(uarts[port].u_fd, &data, sizeof(data));
>      ^
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c: In function 'uart_pty':
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:267:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>          write(1, msg, sizeof(msg));
>          ^
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:276:5: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>      write(1, msg, strlen(msg));
>      ^
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c: In function 'uart_set_attr':
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:240:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>          write(1, msg, sizeof(msg));
>          ^
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:251:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>          write(1, msg, sizeof(msg));
>          ^
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c: In function 'set_nonblock':
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:223:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>          write(1, msg, sizeof(msg));
>          ^
> repos/apache-mynewt-core/hw/mcu/native/src/hal_uart.c:228:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>          write(1, msg, sizeof(msg));
>          ^
> Error: repos/apache-mynewt-core/hw/mcu/native/src/hal_system.c: In function 'usage':
> repos/apache-mynewt-core/hw/mcu/native/src/hal_system.c:58:5: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
>      (void) write(2, msg, strlen(msg));
>      ^
> cc1: all warnings being treated as errors



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)