This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ Bug (was: Implicit declaration warnings for builtins)
- To: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>, Mark Mitchell <mark at codesourcery dot com>
- Subject: Re: C++ Bug (was: Implicit declaration warnings for builtins)
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Sat, 27 May 2000 16:24:21 -0700
- Cc: gcc-patches at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- References: <20000522193809.I3314@wolery.cumb.org> <Pine.BSF.4.21.0005272248290.58536-100000@deneb.dbai.tuwien.ac.at>
On Sat, May 27, 2000 at 10:50:34PM +0200, Gerald Pfeifer wrote:
> On Mon, 22 May 2000, Zack Weinberg wrote:
> > I got tired of not being warned about implicitly declaring strcmp or
> > something like that. This patch changes the logic to detect implicit
> > declarations, so that builtin function decls genuinely don't count.
> > [...]
> > A similar patch may be appropriate for C++, I haven't looked.
>
> Yes, I just checked and this bug is also present in the C++ frontend.
Fortunately, the code in the C++ front end is much better factored.
The actual fix will be just a few lines, but there's a problem.
c-decl.c sets C_DECL_ANTICIPATED on builtin decls; that's the only way
to distinguish them from normal decls. DECL_BUILT_IN cannot be used
in this context, because it is not true for several functions which
have builtin prototypes, and because it is not cleared when a
prototype appears.
cp/decl.c's builtin_function() does not set any special flags. Okay,
so we add one? Well, there isn't a free DECL_LANG_FLAG to use. I
think. It might be safe to use flag #7 (documented as
DECL_DEAD_FOR_LOCAL, VAR_DECLs only) but I don't know the C++ front
end well enough to be certain. I'm going to try this anyway; any
advice would be appreciated.
zw