From 9c1d95e87358b17aec9fbb0a13c31b7bb9350450 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Thu, 2 Jun 2016 22:53:39 +0300
Subject: [PATCH] Fix #include poll.h and sys/cdefs.h

POSIX defines poll.h, sys/poll.h should not be used at is c-library
internal header which may or may not exist. Notable in musl it
generates warning of being incorrect. And add explict include of
sys/cdefs.h where needed.

Change-Id: I142930df53fe7585a06b854b6faddc5301e024be
---
 include/asterisk/compat.h      | 2 +-
 include/asterisk/poll-compat.h | 2 +-
 main/ast_expr2.c               | 1 +
 main/ast_expr2.y               | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h
index 3eb6c96a2d..252ce914a2 100644
--- a/include/asterisk/compat.h
+++ b/include/asterisk/compat.h
@@ -70,7 +70,7 @@
 #endif
 
 #ifndef AST_POLL_COMPAT
-#include <sys/poll.h>
+#include <poll.h>
 #else
 #include "asterisk/poll-compat.h"
 #endif
diff --git a/include/asterisk/poll-compat.h b/include/asterisk/poll-compat.h
index cbb6109251..72ac2c3e2f 100644
--- a/include/asterisk/poll-compat.h
+++ b/include/asterisk/poll-compat.h
@@ -83,7 +83,7 @@
 
 #ifndef AST_POLL_COMPAT
 
-#include <sys/poll.h>
+#include <poll.h>
 
 #define ast_poll(a, b, c) poll(a, b, c)
 
diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index d41072d6e4..c700b01d73 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -94,6 +94,7 @@
 #define ASTMM_LIBC ASTMM_REDIRECT
 #include "asterisk.h"
 
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <stdio.h>
 
diff --git a/main/ast_expr2.y b/main/ast_expr2.y
index 762e83d840..df87bcc7f6 100644
--- a/main/ast_expr2.y
+++ b/main/ast_expr2.y
@@ -15,6 +15,7 @@
 #define ASTMM_LIBC ASTMM_REDIRECT
 #include "asterisk.h"
 
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <stdio.h>
 
-- 
GitLab