aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1999-01-20 13:11:59 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-01-20 13:11:59 +0000
commit61cd552e3b7e3dab5036a4be1a2a2c28707e6acf (patch)
tree3ac0bc7867ca45fa2c558c4486cf8cdfdc93020d /gcc
parent876d1fa3baa7094a5d2690c0d8d8580e9ea35aac (diff)
downloadgcc-61cd552e3b7e3dab5036a4be1a2a2c28707e6acf.zip
gcc-61cd552e3b7e3dab5036a4be1a2a2c28707e6acf.tar.gz
gcc-61cd552e3b7e3dab5036a4be1a2a2c28707e6acf.tar.bz2
error.c (dump_function_decl): Don't print the argument types for a function when the verbosity level is negative.
* error.c (dump_function_decl): Don't print the argument types for a function when the verbosity level is negative. * call.c (build_over_call): Check format attributes at call-time. * pt.c (tsubst_copy): Fix comment. (unify): Don't allow unification with variable-sized arrays. * semantics.c (finish_stmt_expr): When processing a template make the BIND_EXPR long-lived. From-SVN: r24788
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog13
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/error.c17
-rw-r--r--gcc/cp/pt.c16
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/printf1.C14
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash27.C13
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash28.C14
8 files changed, 86 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2b3a14f..9b14cda 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,16 @@
+1999-01-20 Mark Mitchell <mark@markmitchell.com>
+
+ * error.c (dump_function_decl): Don't print the argument types for
+ a function when the verbosity level is negative.
+
+ * call.c (build_over_call): Check format attributes at call-time.
+
+ * pt.c (tsubst_copy): Fix comment.
+ (unify): Don't allow unification with variable-sized arrays.
+
+ * semantics.c (finish_stmt_expr): When processing a template make
+ the BIND_EXPR long-lived.
+
1999-01-19 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (finish_vtable_vardecl): Make vtables comdat here.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index dd1f33b..356a57d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3364,6 +3364,10 @@ build_over_call (cand, args, flags)
converted_args = nreverse (converted_args);
+ if (warn_format && (DECL_NAME (fn) || DECL_ASSEMBLER_NAME (fn)))
+ check_function_format (DECL_NAME (fn), DECL_ASSEMBLER_NAME (fn),
+ converted_args);
+
/* Avoid actually calling copy constructors and copy assignment operators,
if possible. */
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index d5e2877..fd3f5f5 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -958,8 +958,9 @@ dump_decl (t, v)
}
/* Pretty printing for announce_function. T is the declaration of the
- function we are interested in seeing. V is non-zero if we should print
- the type that this function returns. */
+ function we are interested in seeing. If V is zero, we print the
+ argument types. If V is positive, we also print the return types.
+ If V is negative, we do not even print the argument types. */
static void
dump_function_decl (t, v)
@@ -985,9 +986,8 @@ dump_function_decl (t, v)
else if (TREE_CODE (fntype) == METHOD_TYPE)
cname = TREE_TYPE (TREE_VALUE (parmtypes));
- v = (v > 0);
-
- if (v)
+ /* Print the return type. */
+ if (v > 0)
{
if (DECL_STATIC_FUNCTION_P (t))
OB_PUTS ("static ");
@@ -1001,6 +1001,7 @@ dump_function_decl (t, v)
}
}
+ /* Print the function name. */
if (cname)
{
dump_type (cname, 0);
@@ -1021,7 +1022,11 @@ dump_function_decl (t, v)
parmtypes = TREE_CHAIN (parmtypes);
dump_function_name (t);
-
+
+ /* If V is negative, we don't print the argument types. */
+ if (v < 0)
+ return;
+
OB_PUTC ('(');
if (parmtypes)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ad0acae..0a67535 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6329,7 +6329,7 @@ tsubst_copy (t, args, in_decl)
if (code == BIND_EXPR && !processing_template_decl)
{
- /* This processing should really occur in tsubst_expr,
+ /* This processing should really occur in tsubst_expr,
However, tsubst_expr does not recurse into expressions,
since it assumes that there aren't any statements
inside them. Instead, it simply calls
@@ -7504,6 +7504,20 @@ unify (tparms, targs, parm, arg, strict, explicit_mask)
return 0;
else if (targ)
return 1;
+
+ /* Make sure that ARG is not a variable-sized array. (Note that
+ were talking about variable-sized arrays (like `int[n]'),
+ rather than arrays of unknown size (like `int[]').) We'll
+ get very confused by such a type since the bound of the array
+ will not be computable in an instantiation. Besides, such
+ types are not allowed in ISO C++, so we can do as we please
+ here. */
+ if (TREE_CODE (arg) == ARRAY_TYPE
+ && !uses_template_parms (arg)
+ && (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (arg)))
+ != INTEGER_CST))
+ return 1;
+
TREE_VEC_ELT (targs, idx) = arg;
return 0;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index e4d4371..fd6f3d0 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -809,8 +809,8 @@ finish_stmt_expr (rtl_expr, expr)
{
/* Make a BIND_EXPR for the BLOCK already made. */
if (processing_template_decl)
- result = build (BIND_EXPR, NULL_TREE,
- NULL_TREE, last_tree, expr);
+ result = build_min_nt (BIND_EXPR, NULL_TREE, last_tree,
+ NULL_TREE);
else
result = build (BIND_EXPR, TREE_TYPE (rtl_expr),
NULL_TREE, rtl_expr, expr);
diff --git a/gcc/testsuite/g++.old-deja/g++.other/printf1.C b/gcc/testsuite/g++.old-deja/g++.other/printf1.C
new file mode 100644
index 0000000..04c4d9f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/printf1.C
@@ -0,0 +1,14 @@
+// Build don't link:
+// Special g++ Options: -Wall
+
+struct a
+{
+ void x(char *f,...) __attribute__((format(printf,2,3)));
+};
+
+int main()
+{
+ a A;
+ A.x("%d"); // WARNING - too few arguments for format
+ return 0;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash27.C b/gcc/testsuite/g++.old-deja/g++.pt/crash27.C
new file mode 100644
index 0000000..f52f1ba
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash27.C
@@ -0,0 +1,13 @@
+// Build don't link:
+
+template<int i> int f (void)
+{
+ if (__extension__ ({ 1; }))
+ return 0;
+ return 1;
+}
+
+void g (void)
+{
+ f<1> ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash28.C b/gcc/testsuite/g++.old-deja/g++.pt/crash28.C
new file mode 100644
index 0000000..752c970
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash28.C
@@ -0,0 +1,14 @@
+// Build don't link:
+// Special g++ Options:
+
+template <class ARRY>
+inline unsigned int asize(ARRY &a)
+{
+ return sizeof(a) / sizeof(a[0]);
+}
+
+int f(unsigned int n) {
+ int x[n];
+
+ asize(x); // ERROR - no matching function
+};