]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Add support for the clang compiler; update RAII_VAR to use BlocksRuntime
authorMatthew Jordan <mjordan@digium.com>
Thu, 12 Mar 2015 12:26:57 +0000 (12:26 +0000)
committerMatthew Jordan <mjordan@digium.com>
Thu, 12 Mar 2015 12:26:57 +0000 (12:26 +0000)
commit69e30dfcb5d443b80fd5f0919388d180a04e0203
tree54e4aec0527985b60d9526082e0fe2ec527a9c3c
parent964000772d27b11b31ab711e16503479467024f8
Add support for the clang compiler; update RAII_VAR to use BlocksRuntime

RAII_VAR, which is used extensively in Asterisk to manage reference counted
resources, uses a GCC extension to automatically invoke a cleanup function
when a variable loses scope. While this functionality is incredibly useful
and has prevented a large number of memory leaks, it also prevents Asterisk
from being compiled with clang.

This patch updates the RAII_VAR macro such that it can be compiled with clang.
It makes use of the BlocksRuntime, which allows for a closure to be created
that performs the actual cleanup.

Note that this does not attempt to address the numerous warnings that the clang
compiler catches in Asterisk.

Much thanks for this patch goes to:
* The folks on StackOverflow who asked this question and Leushenko for
  providing the answer that formed the basis of this code:
  http://stackoverflow.com/questions/24959440/rewrite-gcc-cleanup-macro-with-nested-function-for-clang
* Diederik de Groot, who has been extremely patient in working on getting this
  patch into Asterisk.

Review: https://reviewboard.asterisk.org/r/4370/

ASTERISK-24133
ASTERISK-23666
ASTERISK-20399
ASTERISK-20850 #close
Reported by: Diederik de Groot
patches:
  RAII_CLANG.patch uploaded by Diederik de Groot (License 6600)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Makefile
configure
configure.ac
include/asterisk/inline_api.h
include/asterisk/utils.h
main/Makefile
makeopts.in