diff mbox

[fortran] PR38407 - add -W[no-]unused-dummy-argument

Message ID alpine.LNX.2.00.1007101939340.5661@acrux.dbai.tuwien.ac.at
State New
Headers show

Commit Message

Gerald Pfeifer July 10, 2010, 5:54 p.m. UTC
Hi Daniel,

On Thu, 20 May 2010, Daniel Franke wrote:
> Attached patch seperates warnings for unused variables and unused dummy 
> arguments.
> 
> 
> gcc/fortran/:
> 2010-05-20  Daniel Franke  <franke.daniel@gmail.com>
> 
> 	PR fortran/38407
> 	* lang.opt (Wunused-dummy-argument): New option.

any chance you could add a note to 
  http://gcc.gnu.org/gcc-4.6/changes.html?
documenting this?  In fact, let me suggest a patch below.

Okay?

Gerald

Comments

Tobias Burnus July 12, 2010, 7:35 a.m. UTC | #1
On 07/10/2010 07:54 PM, Gerald Pfeifer wrote:
> On Thu, 20 May 2010, Daniel Franke wrote:
>   
>> Attached patch seperates warnings for unused variables and unused dummy 
>> arguments.
>>
>>
>> gcc/fortran/:
>> 2010-05-20  Daniel Franke  <franke.daniel@gmail.com>
>>
>> 	PR fortran/38407
>> 	* lang.opt (Wunused-dummy-argument): New option.
>>     
> any chance you could add a note to 
>   http://gcc.gnu.org/gcc-4.6/changes.html?
> documenting this?  In fact, let me suggest a patch below.
>
> --- changes.html.orig	2010-07-05 19:24:52.000000000 +0200
> +++ changes.html	2010-07-10 19:54:11.000000000 +0200
> @@ -181,6 +181,11 @@
>  	statement.</li>
>        </ul>
>      </li>
> +    <li>A new command-line option <code>-Wunused-dummy-argument</code> warns
> +       about unused dummy arguments and is included in <code>-Wall</code>.
> +       The original <code>-Wunused-parameter</code> option no longer warns
> +       about unused dummy arguments (and is not part of <code>-Wall</code>
> +       but only <code>-Wextra</code>).</li>
>    </ul>
>   

The first part of the patch is OK. The second part is not.
"-Wunused-parameter" is not touched by the patch. (The latter is about
constants, which for historic reasons are called "PARAMETER" in Fortran;
it's called "parameter" probably because one set up the parameters first
and then compiles & ran the program. By contrast,  in C function
arguments are called "parameter".)

What the patch does is to separates the warnings about uninitialized
local variables and procedure arguments. Note: both -Wunused-variable
and -Wunused-dummy-argument are enabled by -Wall.

How about something like the following?

+    <li>A new command-line option <code>-Wunused-dummy-argument</code> warns
+       about unused dummy arguments and is included in <code>-Wall</code>.
+       Before <code>-Wunused-variable</code> also warned about unused dummy
+       arguments.</li>
   </ul>


Tobias
diff mbox

Patch

--- changes.html.orig	2010-07-05 19:24:52.000000000 +0200
+++ changes.html	2010-07-10 19:54:11.000000000 +0200
@@ -181,6 +181,11 @@ 
 	statement.</li>
       </ul>
     </li>
+    <li>A new command-line option <code>-Wunused-dummy-argument</code> warns
+       about unused dummy arguments and is included in <code>-Wall</code>.
+       The original <code>-Wunused-parameter</code> option no longer warns
+       about unused dummy arguments (and is not part of <code>-Wall</code>
+       but only <code>-Wextra</code>).</li>
   </ul>
 
 <h3>Java (GCJ)</h3>