[asterisk-dev] [Code Review] 4370: RAII_VAR: nested functions aren't portable. Adapting RAII_VAR to use clang/llvm blocks to get the same/similar functionality. TAKE 2

Diederik de Groot reviewboard at asterisk.org
Fri Feb 20 07:22:59 CST 2015



> On Feb. 4, 2015, 3:43 p.m., Joshua Colp wrote:
> > /branches/11/configure.ac, lines 1082-1085
> > <https://reviewboard.asterisk.org/r/4370/diff/1/?file=71055#file71055line1082>
> >
> >     If the compiler being used is clang I think this should be required here and not just a warning when you actually try to compile. If the support doesn't exist it's just not going to work and having configure succeed is just putting off the inevitable failure.
> 
> Matt Jordan wrote:
>     AC_MSG_ERROR it is.
> 
> Diederik de Groot wrote:
>     There is another little issue, in my initial configure.ac patch. I was using clang not ${CC}, which does not really work, when using for example clang-3.6
>     --- configure.ac    2015-02-20 13:39:07.998931202 +0100
>     +++ configure.ac~    2015-02-20 13:38:43.000000000 +0100
>     @@ -39,7 +39,7 @@
>      
>      # Note: AC_PROG_CC *must* be specified before AC_USE_SYSTEM_EXTENSIONS or any
>      # other macro that uses the C compiler, or the default order will be used.
>     -AC_PROG_CC([gcc clang cc])
>     +AC_PROG_CC([gcc cc])
>      
>      AC_USE_SYSTEM_EXTENSIONS    dnl note- does not work on FreeBSD
>      
>     @@ -1070,11 +1070,11 @@
>              AC_SUBST(AST_NESTED_FUNCTIONS)
>          ],[
>              AC_MSG_CHECKING(for clang -fblocks)
>     -        if test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c - 2>&1`" = ""; then
>     +        if test "`echo "int main(){return ^{return 42;}();}" | clang -o /dev/null -fblocks -x c - 2>&1`" = ""; then
>                  [AST_CLANG_BLOCKS_LIBS=""]
>                  [AST_CLANG_BLOCKS="-Wno-unknown-warning-option -fblocks"]
>                  AC_MSG_RESULT(yes)
>     -        elif test "`echo "int main(){return ^{return 42;}();}" | ${CC} -o /dev/null -fblocks -x c -lBlocksRuntime - 2>&1`" = ""; then
>     +        elif test "`echo "int main(){return ^{return 42;}();}" | clang -o /dev/null -fblocks -x c -lBlocksRuntime - 2>&1`" = ""; then
>                  [AST_CLANG_BLOCKS_LIBS="-lBlocksRuntime"]
>                  [AST_CLANG_BLOCKS="-fblocks"]
>                  AC_MSG_RESULT(yes)

Diff was reverse, sorry about that.


- Diederik


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4370/#review14408
-----------------------------------------------------------


On Feb. 20, 2015, 5:09 a.m., Matt Jordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4370/
> -----------------------------------------------------------
> 
> (Updated Feb. 20, 2015, 5:09 a.m.)
> 
> 
> Review request for Asterisk Developers and Diederik de Groot.
> 
> 
> Bugs: ASTERISK-20850
>     https://issues.asterisk.org/jira/browse/ASTERISK-20850
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> This is a continuation of the patch put up for review on r3488. It addresses the issues found on that review.
> 
> This patch *should* make Asterisk compile under clang. Note that compiling with --enable-dev-mode will cause Asterisk to fail to compile under clang, as it detects a number of warnings that aren't fixed under this patch.
> 
> 
> Diffs
> -----
> 
>   /branches/11/makeopts.in 432011 
>   /branches/11/main/Makefile 432011 
>   /branches/11/include/asterisk/utils.h 432011 
>   /branches/11/include/asterisk/inline_api.h 432011 
>   /branches/11/configure.ac 432011 
>   /branches/11/configure UNKNOWN 
>   /branches/11/Makefile 432011 
> 
> Diff: https://reviewboard.asterisk.org/r/4370/diff/
> 
> 
> Testing
> -------
> 
> * Compiled Asterisk with and without --enable-dev-mode using gcc. Asterisk compiles correctly.
> * Compiled Asterisk without --enable-dev-mode using clang. Asterisk compiles, links, and executes.
> 
> Note that you will need the BlocksRuntime to run Asterisk when it is compiled with clang.
> 
> 
> Thanks,
> 
> Matt Jordan
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150220/cc335059/attachment-0001.html>


More information about the asterisk-dev mailing list