This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran] Remove -fmodule-private option.


I mentioned this idea in another post which didn't get any immediate yay or nay replies, and the patch has finished regtesting, so I might as well go ahead and post it. For the record, my justification for removing the option is (quoted from the other post):

I have found no references to this in the changelog, nor in the mailing list archives, nor in the testsuite, nor even in Google. Personally, I don't think it's a good option -- at best, it might be useful for checking a programming style that requires everything public to be explicitly declared such, but using it for anything other than checking purposes is merely enabling sloppy nonstandard coding. Moreover, using it for checking also is poor, since it doesn't check for default-public module entities that aren't used outside the module.

Thus, I propose that -fmodule-private should be removed. If there's any call for such a thing for checking purposes, it IMO would be better served by a warning option like -Wmodule-default-public which would warn about code that violates the desired coding style, rather than changing the semantics.

I'll note a slight correction -- on a second Google check, I did find references to this option in the various online copies of the g95 manual, but that's the only place other than various gfortran patches that happened to be near it in lang.opt or whatnot.


----------------------------------------------------------------------
2006-11-10  Brooks Moses  <brooks.moses@codesourcery.com>

	* lang.opt (-fmodule-private): Remove option.
	* gfortran.h (gfc_option_t): Remove module_access_private flag.
	* options.c (gfc_init_options): Remove initialization for it.
	(gfc_process_option): Remove handling for -fmodule-private.
	* module.c (gfc_check_access): Add comments, remove check for
	gfc_option.flag_module_access_private.

----------------------------------------------------------------------

Regtested on i686-pc-linux-gnu. Ok for trunk?

- Brooks
Index: lang.opt
===================================================================
--- lang.opt	(revision 118617)
+++ lang.opt	(working copy)
@@ -181,10 +181,6 @@
 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
-
 fno-backend
 Fortran RejectNegative
 Don't generate code, just do syntax and semantics checking
Index: gfortran.h
===================================================================
--- gfortran.h	(revision 118617)
+++ gfortran.h	(working copy)
@@ -1640,7 +1640,6 @@
   int flag_second_underscore;
   int flag_implicit_none;
   int flag_max_stack_var_size;
-  int flag_module_access_private;
   int flag_no_backend;
   int flag_range_check;
   int flag_pack_derived;
Index: options.c
===================================================================
--- options.c	(revision 118617)
+++ options.c	(working copy)
@@ -73,7 +73,6 @@
   gfc_option.flag_second_underscore = -1;
   gfc_option.flag_implicit_none = 0;
   gfc_option.flag_max_stack_var_size = 32768;
-  gfc_option.flag_module_access_private = 0;
   gfc_option.flag_no_backend = 0;
   gfc_option.flag_range_check = 1;
   gfc_option.flag_pack_derived = 0;
@@ -521,10 +520,6 @@
       gfc_option.flag_max_stack_var_size = value;
       break;
 
-    case OPT_fmodule_private:
-      gfc_option.flag_module_access_private = value;
-      break;
-
     case OPT_fno_backend:
       gfc_option.flag_no_backend = value;
       break;
Index: module.c
===================================================================
--- module.c	(revision 118617)
+++ module.c	(working copy)
@@ -3413,7 +3413,10 @@
 
 
 /* Given an access type that is specific to an entity and the default
-   access, return nonzero if the entity is publicly accessible.  */
+   access, return nonzero if the entity is publicly accessible.  If the
+   element is declared as PUBLIC, then it is public; if declared 
+   PRIVATE, then private, and otherwise it is public unless the default
+   access in this context has been declared PRIVATE.  */
 
 bool
 gfc_check_access (gfc_access specific_access, gfc_access default_access)
@@ -3424,12 +3427,7 @@
   if (specific_access == ACCESS_PRIVATE)
     return FALSE;
 
-  if (gfc_option.flag_module_access_private)
-    return default_access == ACCESS_PUBLIC;
-  else
-    return default_access != ACCESS_PRIVATE;
-
-  return FALSE;
+  return default_access != ACCESS_PRIVATE;
 }
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]