1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Check instead of relying on NOTREACHED

NOTREACHED was designed for traditional lint decades ago,
and _Noreturn now normally subsumes its function.
In the one case in Emacs where NORETURN might help and _Noreturn does
not, check for NOTREACHED instead of assuming it.
* lib-src/etags.c (main):
* src/xterm.c (x_connection_closed):
Remove NOTREACHED after a call to a _Noreturn function, as NOTREACHED
is no longer needed there.  Also, one of the NOTREACHEDs was
misplaced, which defeated traditional lint checking anyway.
* lib-src/pop.c (pop_getline): Redo so as to not need NOTREACHED.
* src/emacs.c (main): Use eassume (false) rather than NOTREACHED,
so that running with ENABLE_CHECKING catches any internal error
causing the toplevel Frecursive_edit to return.
This commit is contained in:
Paul Eggert 2019-08-31 10:35:08 -07:00
parent 2de46be662
commit 7791005544
4 changed files with 6 additions and 12 deletions

View file

@ -1275,7 +1275,7 @@ pop_getline (popserver server, char **line)
server->buffer_index = 0;
}
while (1)
while (true)
{
/* There's a "- 1" here to leave room for the null that we put
at the end of the read data below. We put the null there so
@ -1288,7 +1288,7 @@ pop_getline (popserver server, char **line)
{
strcpy (pop_error, "Out of memory in pop_getline");
pop_trash (server);
return (-1);
break;
}
}
ret = RECV (server->file, server->buffer + server->data,
@ -1298,13 +1298,13 @@ pop_getline (popserver server, char **line)
snprintf (pop_error, ERROR_MAX, "%s%s",
GETLINE_ERROR, strerror (errno));
pop_trash (server);
return (-1);
break;
}
else if (ret == 0)
{
strcpy (pop_error, "Unexpected EOF from server in pop_getline");
pop_trash (server);
return (-1);
break;
}
else
{
@ -1332,7 +1332,7 @@ pop_getline (popserver server, char **line)
}
}
/* NOTREACHED */
return -1;
}
/*