From 2648ccc231b38206e2dafe9a6cc1ca0978bcef5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 14 Nov 2018 08:10:43 +0700 Subject: git-compat-util: prefer poll.h to sys/poll.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POSIX specifies that is the correct header for poll(2) whereas is only needed for some old libc. Let's follow the POSIX way by default. This effectively eliminates musl's warning: warning redirecting incorrect #include to Signed-off-by: Đoàn Trần Công Danh Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 016fdcd..fe3d322 100644 --- a/Makefile +++ b/Makefile @@ -207,10 +207,12 @@ all:: # Define MMAP_PREVENTS_DELETE if a file that is currently mmapped cannot be # deleted or cannot be replaced using rename(). # +# Define NO_POLL_H if you don't have poll.h. +# # Define NO_SYS_POLL_H if you don't have sys/poll.h. # # Define NO_POLL if you do not have or don't want to use poll(). -# This also implies NO_SYS_POLL_H. +# This also implies NO_POLL_H and NO_SYS_POLL_H. # # Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile, # *PLEASE* REPORT to git@vger.kernel.org if your platform needs this; @@ -1460,6 +1462,7 @@ ifdef NO_GETTEXT USE_GETTEXT_SCHEME ?= fallthrough endif ifdef NO_POLL + NO_POLL_H = YesPlease NO_SYS_POLL_H = YesPlease COMPAT_CFLAGS += -DNO_POLL -Icompat/poll COMPAT_OBJS += compat/poll/poll.o @@ -1498,6 +1501,9 @@ endif ifdef NO_SYS_SELECT_H BASIC_CFLAGS += -DNO_SYS_SELECT_H endif +ifdef NO_POLL_H + BASIC_CFLAGS += -DNO_POLL_H +endif ifdef NO_SYS_POLL_H BASIC_CFLAGS += -DNO_SYS_POLL_H endif diff --git a/configure.ac b/configure.ac index e11b797..908e66a 100644 --- a/configure.ac +++ b/configure.ac @@ -792,6 +792,12 @@ AC_CHECK_HEADER([sys/select.h], [NO_SYS_SELECT_H=UnfortunatelyYes]) GIT_CONF_SUBST([NO_SYS_SELECT_H]) # +# Define NO_POLL_H if you don't have poll.h +AC_CHECK_HEADER([poll.h], +[NO_POLL_H=], +[NO_POLL_H=UnfortunatelyYes]) +GIT_CONF_SUBST([NO_POLL_H]) +# # Define NO_SYS_POLL_H if you don't have sys/poll.h AC_CHECK_HEADER([sys/poll.h], [NO_SYS_POLL_H=], diff --git a/git-compat-util.h b/git-compat-util.h index 3a08d99..f160581 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -180,9 +180,12 @@ #include #include #include -#ifndef NO_SYS_POLL_H +#if !defined(NO_POLL_H) +#include +#elif !defined(NO_SYS_POLL_H) #include #else +/* Pull the compat stuff */ #include #endif #ifdef HAVE_BSD_SYSCTL -- cgit v0.10.2-6-g49f6