mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-17 11:20:39 -08:00
Port --enable-gcc-warnings to GCC 6.2.1
Backport from master. * src/conf_post.h (GNUC_PREREQ): New macro. * src/keyboard.c: Use it to work around GCC bug 54561. * src/process.c (would_block): New function. (server_accept_connection, wait_reading_process_output, send_process): Use it.
This commit is contained in:
parent
40c426a150
commit
eb17d6f575
3 changed files with 33 additions and 25 deletions
|
|
@ -34,6 +34,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later.
|
||||||
|
It can be used in a preprocessor expression. */
|
||||||
|
#ifndef __GNUC_MINOR__
|
||||||
|
# define GNUC_PREREQ(v, w, x) false
|
||||||
|
#elif ! defined __GNUC_PATCHLEVEL__
|
||||||
|
# define GNUC_PREREQ(v, w, x) ((v) < __GNUC__ + ((w) <= __GNUC_MINOR__))
|
||||||
|
#else
|
||||||
|
# define GNUC_PREREQ(v, w, x) \
|
||||||
|
((v) < __GNUC__ + ((w) <= __GNUC_MINOR__ + ((x) <= __GNUC_PATCHLEVEL__)))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The type of bool bitfields. Needed to compile Objective-C with
|
/* The type of bool bitfields. Needed to compile Objective-C with
|
||||||
standard GCC. It was also needed to port to pre-C99 compilers,
|
standard GCC. It was also needed to port to pre-C99 compilers,
|
||||||
although we don't care about that any more. */
|
although we don't care about that any more. */
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
#include TERM_HEADER
|
#include TERM_HEADER
|
||||||
#endif /* HAVE_WINDOW_SYSTEM */
|
#endif /* HAVE_WINDOW_SYSTEM */
|
||||||
|
|
||||||
|
/* Work around GCC bug 54561. */
|
||||||
|
#if GNUC_PREREQ (4, 3, 0)
|
||||||
|
# pragma GCC diagnostic ignored "-Wclobbered"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Variables for blockinput.h: */
|
/* Variables for blockinput.h: */
|
||||||
|
|
||||||
/* Positive if interrupt input is blocked right now. */
|
/* Positive if interrupt input is blocked right now. */
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,18 @@ bool inhibit_sentinels;
|
||||||
# define SOCK_CLOEXEC 0
|
# define SOCK_CLOEXEC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* True if ERRNUM represents an error where the system call would
|
||||||
|
block if a blocking variant were used. */
|
||||||
|
static bool
|
||||||
|
would_block (int errnum)
|
||||||
|
{
|
||||||
|
#ifdef EWOULDBLOCK
|
||||||
|
if (EWOULDBLOCK != EAGAIN && errnum == EWOULDBLOCK)
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
return errnum == EAGAIN;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef HAVE_ACCEPT4
|
#ifndef HAVE_ACCEPT4
|
||||||
|
|
||||||
/* Emulate GNU/Linux accept4 and socket well enough for this module. */
|
/* Emulate GNU/Linux accept4 and socket well enough for this module. */
|
||||||
|
|
@ -4262,15 +4274,7 @@ server_accept_connection (Lisp_Object server, int channel)
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
{
|
{
|
||||||
int code = errno;
|
int code = errno;
|
||||||
|
if (!would_block (code) && !NILP (ps->log))
|
||||||
if (code == EAGAIN)
|
|
||||||
return;
|
|
||||||
#ifdef EWOULDBLOCK
|
|
||||||
if (code == EWOULDBLOCK)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!NILP (ps->log))
|
|
||||||
call3 (ps->log, server, Qnil,
|
call3 (ps->log, server, Qnil,
|
||||||
concat3 (build_string ("accept failed with code"),
|
concat3 (build_string ("accept failed with code"),
|
||||||
Fnumber_to_string (make_number (code)),
|
Fnumber_to_string (make_number (code)),
|
||||||
|
|
@ -4687,12 +4691,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
|
||||||
int nread = read_process_output (proc, wait_proc->infd);
|
int nread = read_process_output (proc, wait_proc->infd);
|
||||||
if (nread < 0)
|
if (nread < 0)
|
||||||
{
|
{
|
||||||
if (errno == EIO || errno == EAGAIN)
|
if (errno == EIO || would_block (errno))
|
||||||
break;
|
break;
|
||||||
#ifdef EWOULDBLOCK
|
|
||||||
if (errno == EWOULDBLOCK)
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -5073,11 +5073,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
|
||||||
if (do_display)
|
if (do_display)
|
||||||
redisplay_preserve_echo_area (12);
|
redisplay_preserve_echo_area (12);
|
||||||
}
|
}
|
||||||
#ifdef EWOULDBLOCK
|
else if (nread == -1 && would_block (errno))
|
||||||
else if (nread == -1 && errno == EWOULDBLOCK)
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
else if (nread == -1 && errno == EAGAIN)
|
|
||||||
;
|
;
|
||||||
#ifdef WINDOWSNT
|
#ifdef WINDOWSNT
|
||||||
/* FIXME: Is this special case still needed? */
|
/* FIXME: Is this special case still needed? */
|
||||||
|
|
@ -5801,11 +5797,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
|
||||||
|
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
{
|
{
|
||||||
if (errno == EAGAIN
|
if (would_block (errno))
|
||||||
#ifdef EWOULDBLOCK
|
|
||||||
|| errno == EWOULDBLOCK
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
/* Buffer is full. Wait, accepting input;
|
/* Buffer is full. Wait, accepting input;
|
||||||
that may allow the program
|
that may allow the program
|
||||||
to finish doing output and read more. */
|
to finish doing output and read more. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue