public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
@ 2014-05-20 18:21 ` dominiq at lps dot ens.fr
  2014-05-20 18:32 ` Joost.VandeVondele at mat dot ethz.ch
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-05-20 18:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-05-20
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> It would be nice to have a warning (-Wuse-only) for a use-stmt without explicit
> only-list. It would allow for enforcing this good style with -Werror.
>
> Extra useful would be if the warning message would list everything that would
> be required on the only-list.

IMO such a warning will generate zillions of useless diagnostics, especially on
codes factored such that most of, if not all, the public objects are supposed
to be used.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
  2014-05-20 18:21 ` [Bug fortran/61234] Warn for use-stmt without explicit only-list dominiq at lps dot ens.fr
@ 2014-05-20 18:32 ` Joost.VandeVondele at mat dot ethz.ch
  2014-05-20 21:04 ` anlauf at gmx dot de
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2014-05-20 18:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Joost.VandeVondele at mat dot ethz
                   |                            |.ch

--- Comment #2 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
(In reply to Dominique d'Humieres from comment #1)
> IMO such a warning will generate zillions of useless diagnostics, especially
> on codes factored such that most of, if not all, the public objects are
> supposed to be used.

of course, such a code doesn't need to enable the warning. 

Our code base has the rule that use statements must list explicitly what
symbols are imported, I believe this is very useful (for example, it documents
from where a symbol is actually coming). Such a warning (together with
-Werror), would make it easier to automatically enforce that rule.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
  2014-05-20 18:21 ` [Bug fortran/61234] Warn for use-stmt without explicit only-list dominiq at lps dot ens.fr
  2014-05-20 18:32 ` Joost.VandeVondele at mat dot ethz.ch
@ 2014-05-20 21:04 ` anlauf at gmx dot de
  2014-05-21  5:32 ` Joost.VandeVondele at mat dot ethz.ch
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: anlauf at gmx dot de @ 2014-05-20 21:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

Harald Anlauf <anlauf at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gmx dot de

--- Comment #3 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Dominique d'Humieres from comment #1)
> > It would be nice to have a warning (-Wuse-only) for a use-stmt without explicit
> > only-list. It would allow for enforcing this good style with -Werror.
> >
> > Extra useful would be if the warning message would list everything that would
> > be required on the only-list.
> 
> IMO such a warning will generate zillions of useless diagnostics, especially
> on codes factored such that most of, if not all, the public objects are
> supposed to be used.

A project that I work on has a (formal) requirement that use-clauses
must restrict imported symbols via "only".  (However, many contributors
simply ignore that rule, since the compiler used does not complain.)

g95 provides -Wunused-module-procs and -Wunused-module-vars to
provide this diagnostics which is what I use for "cleaning up".
I do not consider this useless diagnostics.

Obviously, this only works as long as the code is still compilable by g95 ...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-05-20 21:04 ` anlauf at gmx dot de
@ 2014-05-21  5:32 ` Joost.VandeVondele at mat dot ethz.ch
  2014-05-30  8:04 ` Joost.VandeVondele at mat dot ethz.ch
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2014-05-21  5:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

--- Comment #4 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
(In reply to Harald Anlauf from comment #3)
> Obviously, this only works as long as the code is still compilable by g95 ...

which in our project started to require so many workarounds that :

http://sourceforge.net/p/cp2k/code/13888/

in particular enabled by -fsanitize=leak, which was a last major missing
gfortran functionality. In the following cleanup we have been able to move the
full code to -fstd=2003 conformance, which is nice to have. Now, we're trying
to enable as many warnings (with -Werror) as possible, to keep good style.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-05-21  5:32 ` Joost.VandeVondele at mat dot ethz.ch
@ 2014-05-30  8:04 ` Joost.VandeVondele at mat dot ethz.ch
  2014-08-22 10:15 ` vondele at gcc dot gnu.org
  2014-08-22 10:16 ` Joost.VandeVondele at mat dot ethz.ch
  6 siblings, 0 replies; 7+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2014-05-30  8:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/ml/fort
                   |                            |ran/2014-05/msg00158.html

--- Comment #5 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
patch posted


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-05-30  8:04 ` Joost.VandeVondele at mat dot ethz.ch
@ 2014-08-22 10:15 ` vondele at gcc dot gnu.org
  2014-08-22 10:16 ` Joost.VandeVondele at mat dot ethz.ch
  6 siblings, 0 replies; 7+ messages in thread
From: vondele at gcc dot gnu.org @ 2014-08-22 10:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

--- Comment #6 from vondele at gcc dot gnu.org ---
Author: vondele
Date: Fri Aug 22 10:14:50 2014
New Revision: 214311

URL: https://gcc.gnu.org/viewcvs?rev=214311&root=gcc&view=rev
Log:
 2014-08-22  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>

     * gfortran.dg/use_without_only_1.f90: New test.

 2014-08-22  Joost VandeVondele  <Joost.VandeVondele@mat.ethz.ch>

     PR fortran/61234
     * lang.opt (Wuse-without-only): New flag.
     * gfortran.h (gfc_option_t): Add it.
     * invoke.texi: Document it.
     * module.c (gfc_use_module): Warn if needed.
     * options.c (gfc_init_options,gfc_handle_option): Init accordingly.


Added:
    trunk/gcc/testsuite/gfortran.dg/use_without_only_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/invoke.texi
    trunk/gcc/fortran/lang.opt
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/options.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/61234] Warn for use-stmt without explicit only-list.
       [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-08-22 10:15 ` vondele at gcc dot gnu.org
@ 2014-08-22 10:16 ` Joost.VandeVondele at mat dot ethz.ch
  6 siblings, 0 replies; 7+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2014-08-22 10:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61234

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
fixed


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-22 10:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-61234-4@http.gcc.gnu.org/bugzilla/>
2014-05-20 18:21 ` [Bug fortran/61234] Warn for use-stmt without explicit only-list dominiq at lps dot ens.fr
2014-05-20 18:32 ` Joost.VandeVondele at mat dot ethz.ch
2014-05-20 21:04 ` anlauf at gmx dot de
2014-05-21  5:32 ` Joost.VandeVondele at mat dot ethz.ch
2014-05-30  8:04 ` Joost.VandeVondele at mat dot ethz.ch
2014-08-22 10:15 ` vondele at gcc dot gnu.org
2014-08-22 10:16 ` Joost.VandeVondele at mat dot ethz.ch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).