This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++: enable-checking patches
- To: martin at mira dot isdn dot cs dot tu-berlin dot de
- Subject: Re: C++: enable-checking patches
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 02 Nov 1999 10:22:40 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <199911021002.LAA00641@mira.isdn.cs.tu-berlin.de>
>>>>> "Martin" == Martin v Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:
Martin> type-unsafe constructs.
Martin> In particular, the following changes are made:
Martin> 1. It seems that DECL_TEMPLATE_INFO, contrary to its
Martin> documentation, is used for TEMPLATE_DECLs and TYPE_DECLs
Martin> as well. Widen the documentation, and relax the check.
This is fine.
Martin> 2. In warn_extern_redeclared_static, DECL_THIS_STATIC was
Martin> invoked for a TEMPLATE_DECL. Do not consider
Martin> TEMPLATE_DECLs in warn_extern_redeclared_static now.
Hmm. Will we still catch:
template <class T> extern void f();
template <class T> static void f();
?
Martin> 3. In warn_extern_redeclared_static, there was a check
Martin> that it is not a TEMPLATE_DECL, when the comment said it
Martin> should be a function or a variable. enable-checking
Martin> detected that DECL_TEMPLATE_INFO was invoked for a
Martin> CONST_DECL (which had no template info). Explicitly check
Martin> for function or variable now.
But you didn't. You have:
! if (TREE_CODE (newdecl) == TYPE_DECL
! || TREE_CODE (newdecl) == TEMPLATE_DECL)
return;
If you want to make this explicitly for functions or variables, you
should have:
if (TREE_CODE (newdecl) != FUNCTION_DECL
&& TREE_CODE (newdecl) != VAR_DECL)
return;
right?
Martin> 4. finish_unary_op_expr reported a problem when
Martin> TREE_NEGATED_INT was set for a NEGATE_EXPR (when it was
Martin> documented only for INTEGER_CSTs). The problem was that
Martin> build_x_unary_op would normally fold INTEGER_CSTs - except
Martin> inside templates. Fold these constants now even inside
Martin> templates.
I don't think we should do this. I'm nervous about doing much of
anything inside a template. Instead, just have finish_unary_op_expr
check to see that the resulting thing is an INTEGER_CST.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com