Summary:ASTERISK-06283: [patch] Compilation problem with chan_h323 and gcc 3.3.2
Reporter:Sergey Basmanov (sb)Labels:
Date Opened:2006-02-09 04:41:57.000-0600Date Closed:2006-04-03 14:43:02
Versions:Frequency of
Environment:Attachments:( 0) chan_h323.diff
( 1) h323-compile.diff
( 2) patch.listbugofg++
Description:Compilation of ast_h323 fails with current asterisk trunk:
g++ -DNDEBUG   -I../../include -Wmissing-prototypes -fPIC  -DP_USE_PRAGMA -D_REENTRANT -Wall  -fPIC -I/usr/src/openh323/../pwlib/include -DPTRACING -I/usr/src/openh323/include -Os  -pipe -felide-constructors -x c++ -c ast_h323.cxx -o ast_h323.o
In file included from ast_h323.cxx:47:
../../include/asterisk/channel.h:429: error: semicolon missing after struct declaration
../../include/asterisk/channel.h:429: error: abstract declarator `ast_channel::<anonymous struct>' used as declaration
../../include/asterisk/channel.h:429: error: namespace-scope anonymous aggregates must be static

Anything is ok with 1.2.4 or previous.
This error is because of:
       AST_LIST_ENTRY(ast_channel) list;
in channel.h


g++ -v:
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,ada,f77,objc,java,pascal --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
Comments:By: Peng Yong (ppyy) 2006-02-09 06:39:50.000-0600

this is bug in early version g++. g++ in Debian woody also has this problem.

gcc version 2.95.4 20011002 (Debian prerelease)

pls use following program to test the problem:

#include <list>

#define AST_LIST_ENTRY(type)    \
struct {                    \
   struct type *next;      \

struct ast_channel {
       int32_t a;
       AST_LIST_ENTRY(ast_channel) list;

int main () {
       struct ast_channel foo;
           return 0;

when we change the code from:
       AST_LIST_ENTRY(ast_channel) list;
       AST_LIST_ENTRY(ast_channel) test_list;

By: Peng Yong (ppyy) 2006-02-09 06:40:38.000-0600

i will upload a patch soon

By: Sergey Basmanov (sb) 2006-02-09 07:59:17.000-0600

Hmm... Seems it works. Funny bug :)
Many thanks!
Added patch to chan_h323.c
Not sure if I doing it right, but at least all warnings gone.

By: Peng Yong (ppyy) 2006-02-09 08:38:05.000-0600

the included "#include <list>" conflict with struct named "list". it's not allowed in old g++

By: Paul Cadach (pcadach) 2006-03-06 13:28:02.000-0600

Any process on this ticket?

By: Paul Cadach (pcadach) 2006-03-06 14:10:15.000-0600

h323-compile.diff makes chan_h323 compilation clean after applying patch.listbugofg++. chan_h323.diff isn't needed anymore.

By: Paul Cadach (pcadach) 2006-03-07 06:31:08.000-0600

ppyy: Is your disclaimer is on Digium's file? I think disclaimer is required to apply your patch.listbugofg++

By: Peng Yong (ppyy) 2006-03-07 07:30:43.000-0600

sure. Disclaimer on File

By: Paul Cadach (pcadach) 2006-03-07 10:51:09.000-0600

Priority changed to "high" and severity upgraded to "major" just because without patches attached to this ticket chan_h323 could not be compiled yet.

By: Andrey S Pankov (casper) 2006-03-07 11:47:19.000-0600

chan_h323 compilation fixes almost duplicate ASTERISK-6466521 and ASTERISK-6506560.

By: Paul Cadach (pcadach) 2006-04-03 13:06:08

IMHO we should have attached patches applied to SVN trunk BEFORE next release just because current SVN totally fails to build chan_h323 due to problems described here.

By: Paul Cadach (pcadach) 2006-04-03 13:16:29

Reminder: Disclaimer is on file.

By: Matt O'Gorman (mogorman) 2006-04-03 13:37:53

Committed revision 17104.

thanks for patch pcadach

By: Matt O'Gorman (mogorman) 2006-04-03 14:43:02

Committed revision 17130.
g++ problem also fixed.