This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31629] option to make module entities PRIVATE by default
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Aug 2007 09:35:27 -0000
- Subject: [Bug fortran/31629] option to make module entities PRIVATE by default
- References: <bug-31629-9647@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2007-08-09 09:35 -------
What about the following:
Index: gfortran.h
===================================================================
--- gfortran.h (revision 127224)
+++ gfortran.h (working copy)
@@ -1865,6 +1865,7 @@ typedef struct
int flag_d_lines;
int flag_openmp;
int flag_sign_zero;
+ int flag_module_private;
int fpe;
Index: lang.opt
===================================================================
--- lang.opt (revision 127224)
+++ lang.opt (working copy)
@@ -212,6 +212,10 @@ fmax-stack-var-size=
Fortran RejectNegative Joined UInteger
-fmax-stack-var-size=<n> Size in bytes of the largest array that will be
put on the stack
+fmodule-private
+Fortran
+Set default accessibility of module entities to PRIVATE.
+
fopenmp
Fortran
Enable OpenMP
Index: module.c
===================================================================
--- module.c (revision 127224)
+++ module.c (working copy)
@@ -3714,7 +3714,10 @@ gfc_check_access (gfc_access specific_ac
if (specific_access == ACCESS_PRIVATE)
return FALSE;
- return default_access != ACCESS_PRIVATE;
+ if (gfc_option.flag_module_private)
+ return default_access == ACCESS_PUBLIC;
+ else
+ return default_access != ACCESS_PRIVATE;
}
Index: options.c
===================================================================
--- options.c (revision 127224)
+++ options.c (working copy)
@@ -93,6 +93,7 @@ gfc_init_options (unsigned int argc ATTR
gfc_option.flag_preprocessed = 0;
gfc_option.flag_automatic = 1;
gfc_option.flag_backslash = 1;
+ gfc_option.flag_module_private = 0;
gfc_option.flag_backtrace = 0;
gfc_option.flag_allow_leading_underscore = 0;
gfc_option.flag_dump_core = 0;
@@ -575,6 +576,10 @@ gfc_handle_option (size_t scode, const c
gfc_option.flag_max_stack_var_size = value;
break;
+ case OPT_fmodule_private:
+ gfc_option.flag_module_private = value;
+ break;
+
case OPT_frange_check:
gfc_option.flag_range_check = value;
break;
Index: invoke.texi
===================================================================
--- invoke.texi (revision 127228)
+++ invoke.texi (working copy)
@@ -121,7 +121,7 @@ by type. Explanations are in the follow
-ffixed-line-length-@var{n} -ffixed-line-length-none @gol
-ffree-line-length-@var{n} -ffree-line-length-none @gol
-fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 @gol
--fcray-pointer -fopenmp -frange-check -fno-backslash }
+-fcray-pointer -fopenmp -frange-check -fno-backslash -fmodule-private}
@item Error and Warning Options
@xref{Error and Warning Options,,Options to request or suppress errors
@@ -238,6 +238,14 @@ Allow @samp{$} as a valid character in a
Change the interpretation of backslashes in string literals from
``C-style'' escape characters to a single backslash character.
+@item -fmodule-private
+@opindex @code{fmodule-private}
+@cindex module entities
+@cindex private
+Set the default accessibility of module entities to @code{PRIVATE}.
+Use-associated entities will not be accessible unless they are explicitly
+declared as @code{PUBLIC}.
+
@item -ffixed-line-length-@var{n}
@opindex @code{ffixed-line-length-}@var{n}
@cindex file format, fixed
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31629