[Asterisk-code-review] headers: Replace typeof with typeof . (asterisk[15])

Alexander Traud asteriskteam at digium.com
Sat Jan 27 03:04:10 CST 2018


Alexander Traud has uploaded this change for review. ( https://gerrit.asterisk.org/8063


Change subject: headers: Replace typeof with __typeof__.
......................................................................

headers: Replace typeof with __typeof__.

This was required by clang 4.0 (for example on FreeBSD 11.1) while compiling
the module res_snmp.

ASTERISK-27629

Change-Id: I0d7a2c62ed256cca19a50340e3c337567ac78e58
---
M include/asterisk/strings.h
M include/asterisk/time.h
M include/asterisk/utils.h
3 files changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/63/8063/1

diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 85393b4..3660442 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -742,7 +742,7 @@
 char *ast_str_truncate(struct ast_str *buf, ssize_t len),
 {
 	if (len < 0) {
-		if ((typeof(buf->__AST_STR_USED)) -len >= buf->__AST_STR_USED) {
+		if ((__typeof__(buf->__AST_STR_USED)) -len >= buf->__AST_STR_USED) {
 			buf->__AST_STR_USED = 0;
 		} else {
 			buf->__AST_STR_USED += len;
diff --git a/include/asterisk/time.h b/include/asterisk/time.h
index f49d689..24acada 100644
--- a/include/asterisk/time.h
+++ b/include/asterisk/time.h
@@ -41,8 +41,8 @@
    note:dummy_tv_var_for_types never actually gets exported, only used as
    local place holder. */
 extern struct timeval dummy_tv_var_for_types;
-typedef typeof(dummy_tv_var_for_types.tv_sec) ast_time_t;
-typedef typeof(dummy_tv_var_for_types.tv_usec) ast_suseconds_t;
+typedef __typeof__(dummy_tv_var_for_types.tv_sec) ast_time_t;
+typedef __typeof__(dummy_tv_var_for_types.tv_usec) ast_suseconds_t;
 
 /*!
  * \brief Computes the difference (in seconds) between two \c struct \c timeval instances.
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index c6c3407..c919057 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -227,7 +227,7 @@
 #undef MAX
 #define MAX(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a < __b) ? __b : __a);})
 
-#define SWAP(a,b) do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
+#define SWAP(a,b) do { __typeof__(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
 
 /*!
  * \brief Encode data in base64

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d7a2c62ed256cca19a50340e3c337567ac78e58
Gerrit-Change-Number: 8063
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180127/485bca9f/attachment.html>


More information about the asterisk-code-review mailing list