[Asterisk-code-review] Fix #include poll.h and sys/cdefs.h (asterisk[13])

Joshua Colp asteriskteam at digium.com
Wed Jun 8 16:18:35 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: Fix #include poll.h and sys/cdefs.h
......................................................................


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
---
M include/asterisk/compat.h
M include/asterisk/poll-compat.h
M main/ast_expr2.c
M main/ast_expr2.y
4 files changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Matthew Fredrickson: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve; Verified



diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h
index c9c99c1..c7bc5b0 100644
--- a/include/asterisk/compat.h
+++ b/include/asterisk/compat.h
@@ -68,7 +68,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 cbb6109..72ac2c3 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 798e3d3..a9e4eff 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -93,6 +93,7 @@
 
 #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 83d3eff..869dfe9 100644
--- a/main/ast_expr2.y
+++ b/main/ast_expr2.y
@@ -14,6 +14,7 @@
 
 #include "asterisk.h"
 
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <stdio.h>
 

-- 
To view, visit https://gerrit.asterisk.org/2963
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I142930df53fe7585a06b854b6faddc5301e024be
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>



More information about the asterisk-code-review mailing list