[asterisk-bugs] [JIRA] (ASTERISK-25591) [patch] Complete List of Header Files (#include): iwyu

Alexander Traud (JIRA) noreply at issues.asterisk.org
Wed Nov 25 08:04:32 CST 2015


     [ https://issues.asterisk.org/jira/browse/ASTERISK-25591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Traud updated ASTERISK-25591:
---------------------------------------

    Description: 
Recently, I had to add a new module. Therefore, I had to list all its header files. Thanks to the Clang support added in May 2015, one can use the Google project include-what-you-use ([iwyu|http://include-what-you-use.org/]) with Asterisk now.

For example, in Ubuntu 14.04 LTS:
{{sudo apt-get -y install build-essential libssl-dev libncurses-dev libnewt-dev libxml2-dev libsqlite3-dev uuid-dev libjansson-dev libblocksruntime-dev git iwyu}}
{{cd /usr/src/}}
{{git clone http://gerrit.asterisk.org/asterisk}}
{{cd asterisk/}}
{{./configure}}
{{make}}
{{include-what-you-use -fblocks -DAST_MODULE=NULL -DAST_MODULE_SELF=NULL -I$PWD/include res/res_format_attr_opus.c}}

Asterisk uses the two proxy/wrapper headers {{asterisk/compat.h}} and {{asterisk/astmm.h}} which should never be included. Instead, {{asterisk.h}} should be used. To automate this, I had to add three [pragma statements|http://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md]. With the attached patch, iwyu works out of the box. If more headers should never be included, Asterisk team, please say so!

Thanks to iwyu, the list of header files was a simple copy-and-paste experience. Hopefully, this helps others to create better lists of header files, too. Therefore, please, consider this change/feature for inclusion.

  was:
Recently, I had to add a new module. Therefore, I had to list all its header files. Thanks to the Clang support added in May 2015, one can use the Google project include-what-you-use ([iwyu|http://include-what-you-use.org/]) with Asterisk now.

For example, in Ubuntu 14.04 LTS:
{{sudo apt-get -y install build-essential libssl-dev libncurses-dev libnewt-dev libxml2-dev libsqlite3-dev uuid-dev libjansson-dev libblocksruntime-dev git iwyu}}
{{cd /usr/src/}}
{{git clone http://gerrit.asterisk.org/asterisk}}
{{cd asterisk/}}
{{./configure}}
{{make}}
{{include-what-you-use -fblocks -DAST_MODULE=NULL -DAST_MODULE_SELF=NULL -I$PWD/include res/res_format_attr_opus.c}}

Asterisk uses the two proxy/wrapper headers {{asterisk/compat.h}} and {{asterisk/astmm.h}} which should never be included. Instead, {{asterisk.h}} should be used. To automate this, I had to add three pragma statements. With the attached patch, iwyu works out of the box. If more headers should never be included, Asterisk team, please say so!

Thanks to iwyu, the list of header files was a simple copy-and-paste experience. Hopefully, this helps others to create better lists of header files, too. Therefore, please, consider this change/feature for inclusion.


> [patch] Complete List of Header Files (#include): iwyu
> ------------------------------------------------------
>
>                 Key: ASTERISK-25591
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25591
>             Project: Asterisk
>          Issue Type: New Feature
>      Security Level: None
>            Reporter: Alexander Traud
>            Severity: Trivial
>         Attachments: iwyu.patch
>
>
> Recently, I had to add a new module. Therefore, I had to list all its header files. Thanks to the Clang support added in May 2015, one can use the Google project include-what-you-use ([iwyu|http://include-what-you-use.org/]) with Asterisk now.
> For example, in Ubuntu 14.04 LTS:
> {{sudo apt-get -y install build-essential libssl-dev libncurses-dev libnewt-dev libxml2-dev libsqlite3-dev uuid-dev libjansson-dev libblocksruntime-dev git iwyu}}
> {{cd /usr/src/}}
> {{git clone http://gerrit.asterisk.org/asterisk}}
> {{cd asterisk/}}
> {{./configure}}
> {{make}}
> {{include-what-you-use -fblocks -DAST_MODULE=NULL -DAST_MODULE_SELF=NULL -I$PWD/include res/res_format_attr_opus.c}}
> Asterisk uses the two proxy/wrapper headers {{asterisk/compat.h}} and {{asterisk/astmm.h}} which should never be included. Instead, {{asterisk.h}} should be used. To automate this, I had to add three [pragma statements|http://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md]. With the attached patch, iwyu works out of the box. If more headers should never be included, Asterisk team, please say so!
> Thanks to iwyu, the list of header files was a simple copy-and-paste experience. Hopefully, this helps others to create better lists of header files, too. Therefore, please, consider this change/feature for inclusion.



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



More information about the asterisk-bugs mailing list