[Home]

Summary:ASTERISK-03127: Bug# 0003167 Creates GCC-2.95.4 problem with __builtin_expect
Reporter:thekernel32 (thekernel32)Labels:
Date Opened:2004-12-29 11:07:40.000-0600Date Closed:2005-01-03 12:07:12.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When compiling chan_sip.c this warning is shown:
chan_sip.c:1162: warning: implicit declaration of function `__builtin_expect'

After make install I try to start asterisk and it exits when it can't resolve the symbol __builtin_expect.

This looks like a GCC-2.95.4 issue as when I compiled it with gcc-3.0 it works.  From my other reading I also understood __builtin_expect to be new with gcc-3.

__builtin_expect is used on lines 81 and 106 of include/asterisk/astobj.h
Comments:By: Olle Johansson (oej) 2004-12-29 11:14:05.000-0600

Which platform (operating system, distribution, version)?

By: thekernel32 (thekernel32) 2004-12-29 11:19:30.000-0600

Debian 3.0 stable/testing mixed (installed stable, added packages from testing).  /usr/bin/gcc points to /usr/bin/gcc-2.95 by default.
Hardware is a PIII 550 with 128mb ram.

Installed GCC packages (dpkg -l |grep gcc)
ii  gcc            2.95.4-14      The GNU C compiler.
ii  gcc-2.95       2.95.4-11woody The GNU C compiler.
ii  gcc-3.0        3.0.4-7        The GNU C compiler.
ii  gcc-3.0-base   3.0.4-7        The GNU Compiler Collection (base package).
ii  gcc-3.3-base   3.3.4-13       The GNU Compiler Collection (base package)
ii  libgcc1        3.4.2-2        GCC support library

By: Kevin P. Fleming (kpfleming) 2004-12-29 17:31:50.000-0600

This is correct; __builtin_expect was added in GCC-3.

I don't know what the official policy for Asterisk is regarding old compiler compatibility; if we need to support GCC prior to version 3, I can figure out some Makefile magic to disable this if the compiler doesn't support it. However, there are large parts of Asterisk that are already somewhat incompatible with older versions of GCC (using C99 named struct initializers, for example), so I wonder if it would be better to just document a requirement that Asterisk must be compiled with gcc-3.0 or higher?

By: Mark Spencer (markster) 2004-12-31 10:35:39.000-0600

Fixed by another bug