[asterisk-bugs] [JIRA] (ASTERISK-27629) [patch] headers: Replace typeof with __typeof__.

Corey Farrell (JIRA) noreply at issues.asterisk.org
Mon Jan 29 07:51:13 CST 2018


    [ https://issues.asterisk.org/jira/browse/ASTERISK-27629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241871#comment-241871 ] 

Corey Farrell commented on ASTERISK-27629:
------------------------------------------

I think maybe {{USE_CSTD=       c99}} at \[1\] is the problem.  It looks like net-snmp-config.in from upstream \[2\] has {{@CFLAGS@}} included in the output for {{net-snmp-config --cflags}}.  I suspect the USE_CSTD ultimately results in something like {{CFLAGS="-std=c99" ./configure}} being used to configure net-snmp.

I do wonder about what other CFLAGS are being set by the FreeBSD net-snmp package.  On Fedora 26 I get:
{noformat}
$ net-snmp-config --cflags
-I. -I/usr/include
{noformat}

I'm unsure how to proceed, like I said on gerrit Asterisk requires GCC extensions.  Would you be willing to report a bug to FreeBSD for the net-snmp package?  If so please cross-link the bugs between here and there.

\[1\] https://svnweb.freebsd.org/ports/head/net-mgmt/net-snmp/Makefile?revision=459281&view=markup#l48
\[2\] https://sourceforge.net/p/net-snmp/code/ci/master/tree/net-snmp-config.in

> [patch] headers: Replace typeof with __typeof__.
> ------------------------------------------------
>
>                 Key: ASTERISK-27629
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27629
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Core/Portability
>    Affects Versions: 13.19.0, 15.2.0
>         Environment: FreeBSD 11.1 with clang 4.0
>            Reporter: Alexander Traud
>            Assignee: Unassigned
>            Severity: Minor
>              Labels: patch
>         Attachments: typeof_in_headers.patch
>
>
> The documentation of GCC [states|http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html#Alternate-Keywords] one should not use {{typeof}} in header files. Instead, {{\_\_typeof\_\_}} should be used. In Asterisk, {{typeof}} is used 117 times in header files. If {{typeof}} is within a DEFINE and referenced only by C code, {{typeof}} is not really used in a header file because it is eliminated by the preprocessor already. Of these 117, only 4 occasions were identified to be used within a header file itself. 3 were directly used and were found by a text search. 1 occasion (utils.h) is a DEFINE which is then used within the function {{ast_alertpipe_swap(.)}}, which is coded in a header file.
> These issues were found by compiling {{res_snmp.c}} within FreeBSD 11.1 with its default compiler _clang_ 4.0. Although the root cause is quite obvious, uncertainty remains why these errors happened only with the module {{res_snmp.c}}. These headers are included by other modules before. Therefore, something else in the build system must be wrong, because this got obvious only when trying to compile {{res_snmp.c}} and did not happen with clang 4.0 (and clang 5.0) on Debian, Ubuntu, CentOS, or Fedora.
> Workaround: Disable res_snmp via {{menuselect}} or to  remove the package {{net-snmp}} from the installation, for example via {{pkg delete net-snmp}}.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list