[asterisk-dev] [Code Review] 3488: RAII_VAR: nested functions aren't portable. Adapting RAII_VAR to use clang/llvm blocks to get the same/similar functionality.
Diederik de Groot
reviewboard at asterisk.org
Thu May 15 03:57:31 CDT 2014
> On May 15, 2014, 4:50 a.m., Matt Jordan wrote:
> >
Hi Matt, Thank you for your review !
> On May 15, 2014, 4:50 a.m., Matt Jordan wrote:
> > /trunk/configure.ac, line 1092
> > <https://reviewboard.asterisk.org/r/3488/diff/1/?file=57985#file57985line1092>
> >
> > red blob
> On May 15, 2014, 4:50 a.m., Matt Jordan wrote:
> > /trunk/include/asterisk/utils.h, lines 989-993
> > <https://reviewboard.asterisk.org/r/3488/diff/1/?file=57986#file57986line989>
> >
> > Coding style guidelines dictate not to use C++ style comments.
> >
> > That being said, since you've removed this, you should just delete the whole thing.
Point taken.
The patch i send in was meant as a proof of concept, not as a patch to be merged directly. I should have mentioned that in the description. Move changes will be necessary to make compiling using clang work correctly and nicely. I only wanted to show that the dependency on gcc nested fuctions should not preclude compiling with clang, where a block could be used instead.
I remarked the original part to show how it could be replaced with a version that would work for both gcc and clang.
- Diederik
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3488/#review11849
-----------------------------------------------------------
On May 15, 2014, 10:57 a.m., Diederik de Groot wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3488/
> -----------------------------------------------------------
>
> (Updated May 15, 2014, 10:57 a.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Bugs: ASTERISK-20850
> https://issues.asterisk.org/jira/browse/ASTERISK-20850
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> RAII_VAR: nested functions aren't portable. Adapting RAII_VAR to use clang/llvm blocks to get the same/similar functionality.
> Making it possible again to use clang as a compiler, instead of depending on gcc completely.
>
> Compile instructions:
> ================
> ./bootstrap.sh
> CC=clang CXX=clang++ ./configure --enable-dev-mode
> Needed to set DISABLE_INLINE to get passed the double declaration error in api-inline.h, i guess someone needs to figure out how to get this passed clang, correctly
> make menuselect.makeopts
> menuselect/menuselect --enable DISABLE_INLINE
> Needed to suppresse some of the warnings to get clang to compile (for now), clang can be a little panicky, but for a good reason.
>
> -Wno-unknown-warning-option. When gcc doesn't know a compiler option it returns NON-ZERO errorlevel, clang returns ZERO errorlevel, which is annoying. Even the linux kernel developers group complained about this. Will be fixed/changed (hopefully soon). For now, when checking clang compiler options, you would need to grep and parse the error output
> -Wno-error needed to quite down clang being panicky (Standard asterisk -Werror is a good idea in general, but not when compiling against a 'new' compiler )
>
> ASTCFLAGS="-Wno-unknown-warning-option -Wno-error" make
> make install
> RAII_VAR seems to work, but i guess there is still a bit of work before clang support for the rest of asterisk can be announced.
>
>
> Diffs
> -----
>
> /trunk/makeopts.in 413043
> /trunk/main/Makefile 413043
> /trunk/include/asterisk/utils.h 413043
> /trunk/configure.ac 413043
> /trunk/configure UNKNOWN
> /trunk/Makefile 413043
>
> Diff: https://reviewboard.asterisk.org/r/3488/diff/
>
>
> Testing
> -------
>
> Just a proof of concept, to show how asterisk could be made clang compatible again.
>
>
> Thanks,
>
> Diederik de Groot
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140515/ae45eafa/attachment-0001.html>
More information about the asterisk-dev
mailing list