[Home]

Summary:ASTERISK-10257: Compile failure in lock.h
Reporter:jeffery palmer (darren1713)Labels:
Date Opened:2007-09-08 13:57:16Date Closed:2007-09-08 21:26:35
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk_lock_h.patch
Description:Attached is a patch for the compile error below. The inline definitions cannot be inside a macro function. I'm surprised this made it into trunk.

****** ADDITIONAL INFORMATION ******

In file included from pbx.c:41:
/usr/src/asterisk-1.4/include/asterisk/lock.h:792:1: directives may not be used inside a macro argument
/usr/src/asterisk-1.4/include/asterisk/lock.h:791:26: unterminated argument list invoking macro "AST_INLINE_API"
In file included from pbx.c:41:
/usr/src/asterisk-1.4/include/asterisk/lock.h:795: parse error before string constant
/usr/src/asterisk-1.4/include/asterisk/lock.h:831: warning: no previous prototype for `ast_atomic_dec_and_test'
/usr/src/asterisk-1.4/include/asterisk/lock.h: In function `ast_atomic_dec_and_test':
/usr/src/asterisk-1.4/include/asterisk/lock.h:831: warning: implicit declaration of function `ast_atomic_fetchadd_int'
make[1]: *** [pbx.o] Error 1
make: *** [main] Error 2
Comments:By: Tilghman Lesher (tilghman) 2007-09-08 15:03:40

What compiler and version are you using?

By: Michiel van Baak (mvanbaak) 2007-09-08 18:18:42

for the record: everything compiles and works fine on Linux X86_64:

~/dev/personal/asterisk/asterisk-trunk% uname -a
Linux pandemona 2.6.21-2-amd64 #1 SMP Tue Jul 10 21:39:38 UTC 2007 x86_64 GNU/Linux
~/dev/personal/asterisk/asterisk-trunk% gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
~/dev/personal/asterisk/asterisk-trunk%

By: Tilghman Lesher (tilghman) 2007-09-08 20:02:39

And everything works fine on gcc 3.4.6 on Solaris x86, and on gcc 4.1.2 on Ubuntu x86.  This is why I'd like to know the platform, compiler, and compiler version on which it failed.

By: Tilghman Lesher (tilghman) 2007-09-08 20:11:14

A little research reveals that the ability to do directives inside macro definitions was introduced in gcc 3.2, which was a version released over 5 years ago.  So you're either not using gcc (which we don't support) or you're using a version which is well over 5 years old.

By: Digium Subversion (svnbot) 2007-09-08 21:26:35

Repository: asterisk
Revision: 82029

------------------------------------------------------------------------
r82029 | tilghman | 2007-09-08 21:26:35 -0500 (Sat, 08 Sep 2007) | 10 lines

Merged revisions 82028 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r82028 | tilghman | 2007-09-08 21:35:18 -0500 (Sat, 08 Sep 2007) | 2 lines

Fix inline compiles on really old compilers (who uses gcc 2.7 anymore, really?) (closes issue ASTERISK-10257)

........

------------------------------------------------------------------------