[Asterisk-code-review] Fix clang-RAII implementation Removed the #error message (it... (asterisk[13])

Diederik de Groot asteriskteam at digium.com
Mon Apr 20 07:59:31 CDT 2015


Diederik de Groot has uploaded a new change for review.

  https://gerrit.asterisk.org/159

Change subject: Fix clang-RAII implementation Removed the #error message (it creates complications compiling external projects against asterisk, using a different compiler then the one used to compile asterisk)
......................................................................

Fix clang-RAII implementation
Removed the #error message (it creates complications compiling external projects against asterisk, using a different compiler then the one used to compile asterisk)

Change-Id: I12091228090e90831bf2b498293858f46ea7a8c2
---
M include/asterisk/utils.h
1 file changed, 2 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/59/159/1

diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index f3f5719..664e347 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -1031,19 +1031,13 @@
  */
 
 #if defined(__clang__)
-
-#if defined(__has_feature) && __has_feature(blocks)
 typedef void (^_raii_cleanup_block_t)(void);
 static inline void _raii_cleanup_block(_raii_cleanup_block_t *b) { (*b)(); }
 
 #define RAII_VAR(vartype, varname, initval, dtor)                                                                \
     _raii_cleanup_block_t _raii_cleanup_ ## varname __attribute__((cleanup(_raii_cleanup_block),unused)) = NULL; \
-    vartype varname = initval;                                                                                   \
-    _raii_cleanup_ ## varname = ^{ dtor(varname); }
-
-#else
-	#error "CLANG must support the 'blocks' feature to compile Asterisk."
-#endif /* #if defined(__has_feature) && __has_feature(blocks) */
+    __block vartype varname = initval;                                                                           \
+    _raii_cleanup_ ## varname = ^{ {(void)dtor(varname);} }
 
 #elif defined(__GNUC__)
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12091228090e90831bf2b498293858f46ea7a8c2
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Diederik de Groot <dkgroot at talon.nl>



More information about the asterisk-code-review mailing list