Add -fnested-functions compile flag, if needed.

In order to use nested functions on some versions of GCC (e.g. GCC on OS X),
the -fnested-functions flag must be passed to the compiler. This patch adds
detection logic to ./configure to add the flag if necessary. It also adds
a comment to utils.h as to why the nested function needs a prototype.

(closes issue ASTERISK-20399)
Reported by: David M. Lee
Review: https://reviewboard.asterisk.org/r/2102/
........

Merged revisions 373119 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David M. Lee
2012-09-18 15:50:35 +00:00
parent b0f01e5a6f
commit f8d815e19f
6 changed files with 5326 additions and 32615 deletions

View File

@@ -919,8 +919,9 @@ char *ast_utils_which(const char *binary, char *fullpath, size_t fullpath_size);
* \endcode
*/
#define RAII_VAR(vartype, varname, initval, dtor) \
/* Prototype needed due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36774 */ \
auto void _dtor_ ## varname (vartype * v); \
auto void _dtor_ ## varname (vartype * v) { dtor(*v); } \
void _dtor_ ## varname (vartype * v) { dtor(*v); } \
vartype varname __attribute__((cleanup(_dtor_ ## varname))) = (initval)
#endif /* _ASTERISK_UTILS_H */