summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-10 16:47:52 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-10 16:47:52 +0000
commita442e18f8746bfdf59e7ce6c6d56a12ab091272c (patch)
treeed0e7bf4cb3957e067e0ff6072e1192fdded5502
parentb9b226b05a17ce627d9d5856e3d559b343429a6c (diff)
downloadgcc-a442e18f8746bfdf59e7ce6c6d56a12ab091272c.tar.gz
PR c++/10032
* doc/invoke.texi (C++ Dialect Options): Change documentation of -fpermissive. PR c++/10032 * decl.c (cxx_init_decl_processing): With -pedantic, pedwarns are still errors. PR c++/10527 * error.c (decl_to_string): Do not print default argument expressions. * cp-tree.h (break_out_calls): Remove declaration. * tree.c (break_out_calls): Remove. * typeck.c (build_modify_expr): Avoid invalid sharing of trees. PR c++/10032 * g++.dg/warn/pedantic1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69191 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cp/ChangeLog14
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/cp/tree.c80
-rw-r--r--gcc/cp/typeck.c40
-rw-r--r--gcc/doc/invoke.texi7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/pedantic1.C11
10 files changed, 43 insertions, 125 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 510512a061f..be28a684dfd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10032
+ * doc/invoke.texi (C++ Dialect Options): Change documentation of
+ -fpermissive.
+
2003-07-10 J"orn Rennecke <joern.rennecke@superh.com>
* tm.texi (RETURN_ADDR_OFFSET): Document.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0f91172fccc..e91e535c18b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,17 @@
+2003-07-09 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10032
+ * decl.c (cxx_init_decl_processing): With -pedantic, pedwarns are
+ still errors.
+
+ PR c++/10527
+ * error.c (decl_to_string): Do not print default argument
+ expressions.
+
+ * cp-tree.h (break_out_calls): Remove declaration.
+ * tree.c (break_out_calls): Remove.
+ * typeck.c (build_modify_expr): Avoid invalid sharing of trees.
+
2003-07-09 Nathan Sidwell <nathan@codesourcery.com>
PR c++ 9483
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 58eabc3a396..052c12ab09e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4174,7 +4174,6 @@ extern tree build_min (enum tree_code, tree,
extern tree build_min_nt (enum tree_code, ...);
extern tree build_cplus_new (tree, tree);
extern tree get_target_expr (tree);
-extern tree break_out_calls (tree);
extern tree build_cplus_method_type (tree, tree, tree);
extern tree build_cplus_staticfn_type (tree, tree, tree);
extern tree build_cplus_array_type (tree, tree);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8ed521341d4..966da3ca704 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6213,7 +6213,7 @@ cxx_init_decl_processing (void)
current_lang_name = NULL_TREE;
/* Adjust various flags based on command-line settings. */
- if (! flag_permissive && ! pedantic)
+ if (!flag_permissive)
flag_pedantic_errors = 1;
if (!flag_no_inline)
{
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 79803d2dfff..9edf118eee9 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2169,7 +2169,7 @@ decl_to_string (tree decl, int verbose)
|| TREE_CODE (decl) == UNION_TYPE || TREE_CODE (decl) == ENUMERAL_TYPE)
flags = TFF_CLASS_KEY_OR_ENUM;
if (verbose)
- flags |= TFF_DECL_SPECIFIERS | TFF_FUNCTION_DEFAULT_ARGUMENTS;
+ flags |= TFF_DECL_SPECIFIERS;
else if (TREE_CODE (decl) == FUNCTION_DECL)
flags |= TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE;
flags |= TFF_TEMPLATE_HEADER;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 366ea3ab01a..7f137343686 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -368,86 +368,6 @@ get_target_expr (tree init)
return build_target_expr_with_type (init, TREE_TYPE (init));
}
-/* Recursively perform a preorder search EXP for CALL_EXPRs, making
- copies where they are found. Returns a deep copy all nodes transitively
- containing CALL_EXPRs. */
-
-tree
-break_out_calls (tree exp)
-{
- register tree t1, t2 = NULL_TREE;
- register enum tree_code code;
- register int changed = 0;
- register int i;
-
- if (exp == NULL_TREE)
- return exp;
-
- code = TREE_CODE (exp);
-
- if (code == CALL_EXPR)
- return copy_node (exp);
-
- /* Don't try and defeat a save_expr, as it should only be done once. */
- if (code == SAVE_EXPR)
- return exp;
-
- switch (TREE_CODE_CLASS (code))
- {
- default:
- abort ();
-
- case 'c': /* a constant */
- case 't': /* a type node */
- case 'x': /* something random, like an identifier or an ERROR_MARK. */
- return exp;
-
- case 'd': /* A decl node */
- return exp;
-
- case 'b': /* A block node */
- {
- /* Don't know how to handle these correctly yet. Must do a
- break_out_calls on all DECL_INITIAL values for local variables,
- and also break_out_calls on all sub-blocks and sub-statements. */
- abort ();
- }
- return exp;
-
- case 'e': /* an expression */
- case 'r': /* a reference */
- case 's': /* an expression with side effects */
- for (i = TREE_CODE_LENGTH (code) - 1; i >= 0; i--)
- {
- t1 = break_out_calls (TREE_OPERAND (exp, i));
- if (t1 != TREE_OPERAND (exp, i))
- {
- exp = copy_node (exp);
- TREE_OPERAND (exp, i) = t1;
- }
- }
- return exp;
-
- case '<': /* a comparison expression */
- case '2': /* a binary arithmetic expression */
- t2 = break_out_calls (TREE_OPERAND (exp, 1));
- if (t2 != TREE_OPERAND (exp, 1))
- changed = 1;
- case '1': /* a unary arithmetic expression */
- t1 = break_out_calls (TREE_OPERAND (exp, 0));
- if (t1 != TREE_OPERAND (exp, 0))
- changed = 1;
- if (changed)
- {
- if (TREE_CODE_LENGTH (code) == 1)
- return build1 (code, TREE_TYPE (exp), t1);
- else
- return build (code, TREE_TYPE (exp), t1, t2);
- }
- return exp;
- }
-
-}
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments are described by ARGTYPES and whose values
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 189bda2dd35..58055eca08b 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5399,44 +5399,8 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
if (newrhs == error_mark_node)
return error_mark_node;
- if (TREE_CODE (newrhs) == COND_EXPR)
- {
- tree lhs1;
- tree cond = TREE_OPERAND (newrhs, 0);
-
- if (TREE_SIDE_EFFECTS (lhs))
- cond = build_compound_expr (tree_cons
- (NULL_TREE, lhs,
- build_tree_list (NULL_TREE, cond)));
-
- /* Cannot have two identical lhs on this one tree (result) as preexpand
- calls will rip them out and fill in RTL for them, but when the
- rtl is generated, the calls will only be in the first side of the
- condition, not on both, or before the conditional jump! (mrs) */
- lhs1 = break_out_calls (lhs);
-
- if (lhs == lhs1)
- /* If there's no change, the COND_EXPR behaves like any other rhs. */
- result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
- lhstype, lhs, newrhs);
- else
- {
- tree result_type = TREE_TYPE (newrhs);
- /* We have to convert each arm to the proper type because the
- types may have been munged by constant folding. */
- result
- = build (COND_EXPR, result_type, cond,
- build_modify_expr (lhs, modifycode,
- cp_convert (result_type,
- TREE_OPERAND (newrhs, 1))),
- build_modify_expr (lhs1, modifycode,
- cp_convert (result_type,
- TREE_OPERAND (newrhs, 2))));
- }
- }
- else
- result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
- lhstype, lhs, newrhs);
+ result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR,
+ lhstype, lhs, newrhs);
TREE_SIDE_EFFECTS (result) = 1;
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index bd491347203..83c2354d151 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1414,10 +1414,9 @@ a name having multiple meanings within a class.
@item -fpermissive
@opindex fpermissive
-Downgrade messages about nonconformant code from errors to warnings. By
-default, G++ effectively sets @option{-pedantic-errors} without
-@option{-pedantic}; this option reverses that. This behavior and this
-option are superseded by @option{-pedantic}, which works as it does for GNU C@.
+Downgrade some diagnostics about nonconformant code from errors to
+warnings. Thus, using @option{-fpermissive} will allow some
+nonconforming code to compile.
@item -frepo
@opindex frepo
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 491e8b4f382..100c0edf7c9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-07-10 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10032
+ * g++.dg/warn/pedantic1.C: New test.
+
2003-07-10 Nathan Sidwell <nathan@codesourcery.com>
PR c++ 9483
diff --git a/gcc/testsuite/g++.dg/warn/pedantic1.C b/gcc/testsuite/g++.dg/warn/pedantic1.C
new file mode 100644
index 00000000000..2a4d05536c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pedantic1.C
@@ -0,0 +1,11 @@
+// PR10032
+// { dg-options "-pedantic" }
+
+int main() {
+ goto label; // { dg-error "" }
+
+ int temp = 1; // { dg-error "" }
+
+ label: // { dg-error "" }
+ return 1;
+}