+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.
+
2014-08-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/62214
int warn_tabs;
int warn_underflow;
int warn_intrinsic_shadow;
+ int warn_use_without_only;
int warn_intrinsics_std;
int warn_character_truncation;
int warn_array_temp;
@gccoptlist{-Waliasing -Wall -Wampersand -Warray-bounds
-Wc-binding-type -Wcharacter-truncation @gol
-Wconversion -Wfunction-elimination -Wimplicit-interface @gol
--Wimplicit-procedure -Wintrinsic-shadow -Wintrinsics-std @gol
+-Wimplicit-procedure -Wintrinsic-shadow -Wuse-without-only -Wintrinsics-std @gol
-Wline-truncation -Wno-align-commons -Wno-tabs -Wreal-q-constant @gol
-Wsurprising -Wunderflow -Wunused-parameter -Wrealloc-lhs -Wrealloc-lhs-all @gol
-Wtarget-lifetime -fmax-errors=@var{n} -fsyntax-only -pedantic -pedantic-errors
@code{INTRINSIC} declaration might be needed to get calls later resolved to
the desired intrinsic/procedure. This option is implied by @option{-Wall}.
+@item -Wuse-without-only
+@opindex @code{Wuse-without-only}
+@cindex warnings, use statements
+@cindex intrinsic
+Warn if a @code{USE} statement has no @code{ONLY} qualifier and
+thus implicitly imports all public entities of the used module.
+
@item -Wunused-dummy-argument
@opindex @code{Wunused-dummy-argument}
@cindex warnings, unused dummy argument
Fortran Warning
Warn on intrinsics not part of the selected standard
+Wuse-without-only
+Fortran Warning
+Warn about USE statements that have no ONLY qualifier
+
Wopenmp-simd
Fortran
; Documented in C
only_flag = module->only_flag;
current_intmod = INTMOD_NONE;
+ if (!only_flag && gfc_option.warn_use_without_only)
+ gfc_warning_now ("USE statement at %C has no ONLY qualifier");
+
filename = XALLOCAVEC (char, strlen (module_name) + strlen (MODULE_EXTENSION)
+ 1);
strcpy (filename, module_name);
gfc_option.warn_tabs = 1;
gfc_option.warn_underflow = 1;
gfc_option.warn_intrinsic_shadow = 0;
+ gfc_option.warn_use_without_only = 0;
gfc_option.warn_intrinsics_std = 0;
gfc_option.warn_align_commons = 1;
gfc_option.warn_real_q_constant = 0;
gfc_option.warn_intrinsic_shadow = value;
break;
+ case OPT_Wuse_without_only:
+ gfc_option.warn_use_without_only = value;
+ break;
+
case OPT_Walign_commons:
gfc_option.warn_align_commons = value;
break;
+2014-08-22 Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
+
+ * gfortran.dg/use_without_only_1.f90: New test.
+
2014-08-22 Igor Zamyatin <igor.zamyatin@intel.com>
PR other/62008
2014-08-22 Tony Wang <tony.wang@arm.com>
- * g++.dg/tls/thread_local6.C: Skip this test case when target uses
+ * g++.dg/tls/thread_local6.C: Skip this test case when target uses
dejagnu wrapper.
2014-08-21 Thomas Koenig <tkoenig@gcc.gnu.org>
--- /dev/null
+! PR fortran/61234 Warn for use-stmt without explicit only-list.
+! { dg-do compile }
+! { dg-options "-Wuse-without-only" }
+MODULE foo
+ INTEGER :: bar
+END MODULE
+
+MODULE testmod
+ USE foo ! { dg-warning "has no ONLY qualifier" }
+ IMPLICIT NONE
+CONTAINS
+ SUBROUTINE S1
+ USE foo ! { dg-warning "has no ONLY qualifier" }
+ END SUBROUTINE S1
+ SUBROUTINE S2
+ USE foo, ONLY: bar
+ END SUBROUTINE
+ SUBROUTINE S3
+ USE ISO_C_BINDING ! { dg-warning "has no ONLY qualifier" }
+ END SUBROUTINE S3
+END MODULE
+! { dg-final { cleanup-modules "foo testmod" } }