aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/misc.c3
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-common.c17
-rw-r--r--gcc/c-family/c-common.h1
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-decl.c4
-rw-r--r--gcc/cgraphunit.c4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/function.c14
-rw-r--r--gcc/function.h1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/wunused-parameter.f9015
15 files changed, 78 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd533ab..0de1ead 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR fortran/66605
+ * cgraphunit.c (cgraph_node::finalize_function): Do not call
+ do_warn_unused_parameter.
+ * function.c (do_warn_unused_parameter): Move from here.
+ * function.h (do_warn_unused_parameter): Do not declare.
+
2015-06-29 Matthew Wahab <matthew.wahab@arm.com>
PR target/65697
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 89d8898..97e293d 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR fortran/66605
+ * gcc-interface/misc.c (gnat_post_options): No need to disable
+ warn_unused_parameter anymore.
+
2015-06-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Handled_Sequence_Of_Statements_to_gnu): When
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 2f397ba..fec7199 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -262,9 +262,6 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
sorry ("-fexcess-precision=standard for Ada");
flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
- /* ??? The warning machinery is outsmarted by Ada. */
- warn_unused_parameter = 0;
-
/* No psABI change warnings for Ada. */
warn_psabi = 0;
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 2d6e3c5..0e03e7e 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR fortran/66605
+ * c-common.c (do_warn_unused_parameter): Move here.
+ * c-common.h (do_warn_unused_parameter): Declare.
+
2015-06-29 Marek Polacek <polacek@redhat.com>
PR c/66322
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 8156d6a..ac42e4a 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -12103,6 +12103,23 @@ do_warn_double_promotion (tree result_type, tree type1, tree type2,
warning_at (loc, OPT_Wdouble_promotion, gmsgid, source_type, result_type);
}
+/* Possibly warn about unused parameters. */
+
+void
+do_warn_unused_parameter (tree fn)
+{
+ tree decl;
+
+ for (decl = DECL_ARGUMENTS (fn);
+ decl; decl = DECL_CHAIN (decl))
+ if (!TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
+ && DECL_NAME (decl) && !DECL_ARTIFICIAL (decl)
+ && !TREE_NO_WARNING (decl))
+ warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_parameter,
+ "unused parameter %qD", decl);
+}
+
+
/* Setup a TYPE_DECL node as a typedef representation.
X is a TYPE_DECL for a typedef statement. Create a brand new
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 2b03703..dd98396 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1045,6 +1045,7 @@ extern void warn_for_sign_compare (location_t,
tree op0, tree op1,
tree result_type,
enum tree_code resultcode);
+extern void do_warn_unused_parameter (tree);
extern void do_warn_double_promotion (tree, tree, tree, const char *,
location_t);
extern void set_underlying_type (tree);
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 2c5ba6d..15c2303 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR fortran/66605
+ * c-decl.c (finish_function): Call do_warn_unused_parameter.
+
2015-06-29 Marek Polacek <polacek@redhat.com>
PR c/66322
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 6aac8c3..383f0a7 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -9028,6 +9028,10 @@ finish_function (void)
function. */
maybe_warn_unused_local_typedefs ();
+ /* Possibly warn about unused parameters. */
+ if (warn_unused_parameter)
+ do_warn_unused_parameter (fndecl);
+
/* Store the end of the function, so that we get good line number
info for the epilogue. */
cfun->function_end_locus = input_location;
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 1b35646..7e78bf7 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -472,10 +472,6 @@ cgraph_node::finalize_function (tree decl, bool no_collect)
if (!TREE_ASM_WRITTEN (decl))
(*debug_hooks->deferred_inline_function) (decl);
- /* Possibly warn about unused parameters. */
- if (warn_unused_parameter)
- do_warn_unused_parameter (decl);
-
if (!no_collect)
ggc_collect ();
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c16b068..aad780f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR fortran/66605
+ * decl.c (finish_function): Call do_warn_unused_parameter.
+
2015-06-29 Marek Polacek <polacek@redhat.com>
PR c/66322
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 498ed71..3f1cd34 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14323,6 +14323,12 @@ finish_function (int flags)
function. */
maybe_warn_unused_local_typedefs ();
+ /* Possibly warn about unused parameters. */
+ if (warn_unused_parameter
+ && !processing_template_decl
+ && !DECL_CLONED_FUNCTION_P (fndecl))
+ do_warn_unused_parameter (fndecl);
+
/* Genericize before inlining. */
if (!processing_template_decl)
{
diff --git a/gcc/function.c b/gcc/function.c
index 4389bbd..de0b38f 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5210,20 +5210,6 @@ use_return_register (void)
diddle_return_value (do_use_return_reg, NULL);
}
-/* Possibly warn about unused parameters. */
-void
-do_warn_unused_parameter (tree fn)
-{
- tree decl;
-
- for (decl = DECL_ARGUMENTS (fn);
- decl; decl = DECL_CHAIN (decl))
- if (!TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL
- && DECL_NAME (decl) && !DECL_ARTIFICIAL (decl)
- && !TREE_NO_WARNING (decl))
- warning (OPT_Wunused_parameter, "unused parameter %q+D", decl);
-}
-
/* Set the location of the insn chain starting at INSN to LOC. */
static void
diff --git a/gcc/function.h b/gcc/function.h
index dc4a8cc..e92c17c 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -614,7 +614,6 @@ extern void expand_dummy_function_end (void);
extern void thread_prologue_and_epilogue_insns (void);
extern void diddle_return_value (void (*)(rtx, void*), void*);
extern void clobber_return_register (void);
-extern void do_warn_unused_parameter (tree);
extern void expand_function_end (void);
extern rtx get_arg_pointer_save_area (void);
extern void maybe_copy_prologue_epilogue_insn (rtx, rtx);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3163ba6..b4e9732 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR fortran/66605
+ * gfortran.dg/wunused-parameter.f90: New test.
+
2015-06-29 Richard Henderson <rth@redhat.com>
* gcc.target/i386/asm-flag-1.c: New.
diff --git a/gcc/testsuite/gfortran.dg/wunused-parameter.f90 b/gcc/testsuite/gfortran.dg/wunused-parameter.f90
new file mode 100644
index 0000000..df39af8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/wunused-parameter.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-Wunused-parameter" }
+! PR66605
+MODULE test
+ IMPLICIT NONE
+ INTEGER, PARAMETER :: wp = KIND(1.0D0)
+CONTAINS
+SUBROUTINE sub (neq, time, y, dydt)
+ IMPLICIT NONE
+ INTEGER :: neq
+ REAL(WP) :: time, y(neq), dydt(neq)
+
+ dydt(1) = 1.0 / y(1)
+END SUBROUTINE sub
+END MODULE