[asterisk-bugs] [JIRA] (ASTERISK-20850) nested functions aren't portable
Diederik de Groot (JIRA)
noreply at issues.asterisk.org
Mon Apr 28 08:13:19 CDT 2014
[ https://issues.asterisk.org/jira/browse/ASTERISK-20850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=217638#comment-217638 ]
Diederik de Groot edited comment on ASTERISK-20850 at 4/28/14 8:12 AM:
-----------------------------------------------------------------------
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 can be announced.
was (Author: dkdegroot):
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 can be announced.
> nested functions aren't portable
> --------------------------------
>
> Key: ASTERISK-20850
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-20850
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: General
> Affects Versions: 11.1.0
> Environment: CLANG
> Reporter: Diederik de Groot
> Assignee: Diederik de Groot
> Attachments: RAII_CLANG.patch
>
>
> Nested functions are a GCC extension that is not sanctioned by C standards, thus the use of them is non-portable. Specifically, CLANG does not support them. CLANG is used by OSX, current versions of FreeBSD, and NetBSD is experimenting with it. The RAII_VAR macro in include/asterisk/utils.h creates nested functions. This prevents Asterisk 11.* from compiling with CLANG.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list