aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-05-30 15:44:20 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-05-30 15:44:20 +0000
commit935d1834f18a86bed5292c9bfe55ecf81ba734fc (patch)
tree095255f1eb1114cb50575474e681499eaba07034 /gcc/cp
parent7758b73fae75b4462a0eb0cd79b03ae914f9f1fa (diff)
downloadgcc-935d1834f18a86bed5292c9bfe55ecf81ba734fc.zip
gcc-935d1834f18a86bed5292c9bfe55ecf81ba734fc.tar.gz
gcc-935d1834f18a86bed5292c9bfe55ecf81ba734fc.tar.bz2
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/cp-tree.h5
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/lex.c16
-rw-r--r--gcc/cp/tinfo2.cc1
5 files changed, 37 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c1ef5fb..e7f8552 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 3c6fd95..6e53ff2 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 25270d4..a5ee51a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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;
}
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index e9cd519..5c09fef 100644
--- a/gcc/cp/lex.c
+++ b/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)
{
diff --git a/gcc/cp/tinfo2.cc b/gcc/cp/tinfo2.cc
index 442967b..0c64e9e 100644
--- a/gcc/cp/tinfo2.cc
+++ b/gcc/cp/tinfo2.cc
@@ -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