[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50972: src/ls.c fails to build when __GNUC_PREREQ is not defined (e.
From: |
Paul Eggert |
Subject: |
bug#50972: src/ls.c fails to build when __GNUC_PREREQ is not defined (e.g., OpenBSD) |
Date: |
Sun, 3 Oct 2021 10:35:50 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
On 10/3/21 4:38 AM, Pádraig Brady wrote:
I'm confused as to why some functions need _Noreturn and some don't.
Yes, it's a bit of a pain. _Noreturn is useful on extern functions,
since otherwise GCC typically won't know the function doesn't return. On
static functions, though, _Noreturn generally isn't needed since GCC can
figure it out.
Unfortunately, I needed to keep _Noreturn on three static functions in
Coreutils to pacify GCC into not generating the following false alarms.
Today I reported this issue as GCC bug 102578
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102578>.
src/csplit.c: In function 'xalloc_die':
src/csplit.c:235:1: error: 'noreturn' function does return [-Werror]
235 | }
| ^
src/sort.c: In function 'open_temp':
src/sort.c:1206:7: error: this statement may fall through
[-Werror=implicit-fallthrough=]
1206 | async_safe_die (errno, "couldn't execute compress
program (with -d)");
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/sort.c:1208:5: note: here
1208 | default:
| ^~~~~~~
src/test.c: In function 'find_int':
src/test.c:161:1: error: control reaches end of non-void function
[-Werror=return-type]
161 | }
| ^