This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug: Fatal ANSI Warning messages


Description:

When I try to compile the following simplified example with EGCS 1.1b, I 
get the warning messages listed below, however even though none of them
looks like an actual Error, no object file is produced.

The obvious workaround is to fix the declaration of foo() to explicitly
declare the return type as integer.  However, the actual source file in
which this occurs is not under our control.

In any case, if g++ is going to treat this as an error, it should report
it as such, not as just a warning.  Also, there should probably be
something inside the `' string in the warning.

If this should really be considered a fatal error, then it doesn't make
much sense to report that g++ will treat the return type as `int'.  Why
would the compiler attempt to correct invalid code?

Note: GCC and EGCS 1.0 do not report any warnings, and do produce an
object file without a problem.


The entire source file (try.cxx):

    extern "C" foo();

    void bar()
    {
        foo();
    }

The compiler messages:

    $ g++ -c try.cxx
    try.cxx:1: warning: ANSI C++ forbids declaration `' with no type
    try.cxx:1: abstract declarator `int' used as declaration
    try.cxx: In function `void bar()':
    try.cxx:5: warning: implicit declaration of function `int foo(...)'
    $ echo $?
    1
    $ ls
    try.cxx

OS Version:
    Red Hat Linux 5.1 for Intel

EGCS Version:
    % rpm -qa|grep egcs
    egcs-c++-1.1b-2
    egcs-1.1b-2
    egcs-g77-1.1b-2
    egcs-objc-1.1b-2
    % g++ -v
    Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.57/specs
    gcc version egcs-2.91.57 19980901 (egcs-1.1 release)


Charles Durst          .------------------------------------------------.
=======================|  cdurst@world.std.com                          |==
                       |  http://www.tiac.net/users/cdurst/cdurst.html  |
                       `------------------------------------------------'
P.S. - I am not subscribed to this list, so I apologize if this has
already been reported and request that you please CC: me on any further 
discussions of this bug report.  Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]