[patch, fortran] PR24784, PR28004 - about unused variables
Daniel Franke
franke.daniel@gmail.com
Wed Jul 4 05:58:00 GMT 2007
Depending on the command-line arguments -Wall and -Wextra, gfortran gives
different kinds of warnings for unused dummy arguments. In addition,
sometimes the middle-end chimes in and emits a default warning as well
(PR27484). Further, PR28004 requests a warning if dummy arguments of
INTENT(out) are not set.
This patch addresses all this in a single sweep, the corrected warnings are
emitted on -Wall regardless of -Wextra (via warn_unused_variable). The
changes should be self explanatory, those in function.c probably need to be
approved by a C- or global maintainer?!
Example:
SUBROUTINE f(i)
INTEGER, INTENT(out) :: i
END SUBROUTINE
before (-Wall):
Warning: Unused variable i declared at (1)
before (-Wall -Wextra):
Warning: Unused parameter i declared at (1)
function.f90:3: warning: unused parameter 'i'
after (-Wall, -Wall -Wextra):
Warning: dummy argument 'i' at (1) was declared INTENT(OUT) but was not set
SUBROUTINE g(i)
INTEGER :: i
END SUBROUTINE
before, same as above
after: Warning: unused dummy argument 'i' at (1)
:ADDPATCH fortran:
gcc:
2007-07-04 Daniel Franke <franke.daniel@gmail.com>
* function.c (do_warn_unused_parameter): Do not warn if TREE_NO_WARNING is
set.
gcc/fortran:
2007-07-04 Daniel Franke <franke.daniel@gmail.com>
PR fortran/24784
PR fortran/28004
* trans-decl.c (generate_local_decl): Adjusted warning on unused
dummy arguments, tell middle-end not to emit additional warnings.
Bootstrapped and regtested c and fortran on i686-pc-linux-gnu.
Ok for trunk?
Regards
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr24784-pr28004.patch
Type: text/x-diff
Size: 2266 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070704/e3d0a97b/attachment.bin>
More information about the Fortran
mailing list