cp-tree.h (DECL_ANTICIPATED): New macro.
* cp-tree.h (DECL_ANTICIPATED): New macro. Document new use of DECL_LANG_FLAG_7. * decl.c (builtin_function): Set DECL_ANTICIPATED on builtins in the user namespace. * lex.c (do_identifier): If the identifier's declaration has DECL_ANTICIPATED on, it has not yet been declared. But do not replace it with an ordinary implicit declaration. * tinfo2.cc: Include stdlib.h. From-SVN: r34267
This commit is contained in:
parent
7758b73fae
commit
935d1834f1
5 changed files with 37 additions and 3 deletions
|
@ -1,3 +1,15 @@
|
|||
2000-05-30 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* cp-tree.h (DECL_ANTICIPATED): New macro.
|
||||
Document new use of DECL_LANG_FLAG_7.
|
||||
* decl.c (builtin_function): Set DECL_ANTICIPATED on builtins
|
||||
in the user namespace.
|
||||
* lex.c (do_identifier): If the identifier's declaration has
|
||||
DECL_ANTICIPATED on, it has not yet been declared. But do not
|
||||
replace it with an ordinary implicit declaration.
|
||||
|
||||
* tinfo2.cc: Include stdlib.h.
|
||||
|
||||
2000-05-29 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* cp-tree.h (CLASSTYPE_ALIGN_UNIT): New macro.
|
||||
|
|
|
@ -101,6 +101,7 @@ Boston, MA 02111-1307, USA. */
|
|||
5: DECL_INTERFACE_KNOWN.
|
||||
6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
|
||||
7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
|
||||
DECL_ANTICIPATED (in FUNCTION_DECL).
|
||||
|
||||
Usage of language-independent fields in a language-dependent manner:
|
||||
|
||||
|
@ -2491,6 +2492,10 @@ extern int flag_new_for_scope;
|
|||
#define DECL_LOCAL_FUNCTION_P(NODE) \
|
||||
DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
|
||||
|
||||
/* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have
|
||||
not yet seen a prototype for that function. */
|
||||
#define DECL_ANTICIPATED(NODE) DECL_LANG_FLAG_7 (FUNCTION_DECL_CHECK (NODE))
|
||||
|
||||
/* This _DECL represents a compiler-generated entity. */
|
||||
#define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
|
||||
|
||||
|
|
|
@ -6770,6 +6770,12 @@ builtin_function (name, type, code, class, libname)
|
|||
if (libname)
|
||||
DECL_ASSEMBLER_NAME (decl) = get_identifier (libname);
|
||||
make_function_rtl (decl);
|
||||
|
||||
/* Warn if a function in the namespace for users
|
||||
is used without an occasion to consider it declared. */
|
||||
if (name[0] != '_' || name[1] != '_')
|
||||
DECL_ANTICIPATED (decl) = 1;
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
|
|
16
gcc/cp/lex.c
16
gcc/cp/lex.c
|
@ -3111,8 +3111,9 @@ do_identifier (token, parsing, args)
|
|||
id = lookup_name (token, 0);
|
||||
return error_mark_node;
|
||||
}
|
||||
|
||||
if (!id)
|
||||
|
||||
if (!id || (TREE_CODE (id) == FUNCTION_DECL
|
||||
&& DECL_ANTICIPATED (id)))
|
||||
{
|
||||
if (current_template_parms)
|
||||
return build_min_nt (LOOKUP_EXPR, token);
|
||||
|
@ -3124,7 +3125,16 @@ do_identifier (token, parsing, args)
|
|||
}
|
||||
else if (in_call && ! flag_strict_prototype)
|
||||
{
|
||||
id = implicitly_declare (token);
|
||||
if (!id)
|
||||
id = implicitly_declare (token);
|
||||
else
|
||||
{
|
||||
/* Implicit declaration of built-in function. Don't
|
||||
change the built-in declaration, but don't let this
|
||||
go by silently, either. */
|
||||
cp_pedwarn ("implicit declaration of function `%D'", token);
|
||||
DECL_ANTICIPATED (id) = 0; /* only issue this warning once */
|
||||
}
|
||||
}
|
||||
else if (current_function_decl == 0)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
// the GNU General Public License.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h> // for abort
|
||||
#include "tinfo.h"
|
||||
#include "new" // for placement new
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue