aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorCraig Burley <burley@gnu.org>1998-05-23 05:45:45 -0400
committerDave Love <fx@gcc.gnu.org>1998-05-23 09:45:45 +0000
commit6829256fb438f4dccfdad5b4392e1f9ce94f1464 (patch)
treef758b8cc7de409e3697f36aba8e13ebe9cccbe6f /gcc
parente125ac266174fcbf80410bab07195f03aace1d63 (diff)
downloadgcc-6829256fb438f4dccfdad5b4392e1f9ce94f1464.zip
gcc-6829256fb438f4dccfdad5b4392e1f9ce94f1464.tar.gz
gcc-6829256fb438f4dccfdad5b4392e1f9ce94f1464.tar.bz2
com.c (ffecom_finish_symbol_transform_): Don't transform statement (nested) functions...
Sat May 23 06:32:52 1998 Craig Burley <burley@gnu.org> * com.c (ffecom_finish_symbol_transform_): Don't transform statement (nested) functions, to avoid gcc compiling them and thus producing linker errors if they refer to undefined exteral functions. But warn if they're unused and -Wunused. From-SVN: r19970
Diffstat (limited to 'gcc')
-rw-r--r--gcc/f/ChangeLog7
-rw-r--r--gcc/f/com.c45
2 files changed, 43 insertions, 9 deletions
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index b97655f..268028e 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -1,3 +1,10 @@
+Sat May 23 06:32:52 1998 Craig Burley <burley@gnu.org>
+
+ * com.c (ffecom_finish_symbol_transform_): Don't transform
+ statement (nested) functions, to avoid gcc compiling them
+ and thus producing linker errors if they refer to undefined
+ exteral functions. But warn if they're unused and -Wunused.
+
Tue May 19 14:52:41 1998 Craig Burley <burley@gnu.org>
* bad.def (FFEBAD_OPEN_UNSUPPORTED, FFEBAD_INQUIRE_UNSUPPORTED,
diff --git a/gcc/f/com.c b/gcc/f/com.c
index a8a9e97..9d4e9d6 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -6678,15 +6678,42 @@ ffecom_finish_symbol_transform_ (ffesymbol s)
VAR_DECLs for COMMON variables when we transform them for real
use, and therefore we do all the VAR_DECL creating here. */
- if ((ffesymbol_hook (s).decl_tree == NULL_TREE)
- && ((ffesymbol_kind (s) != FFEINFO_kindNONE)
- || ((ffesymbol_where (s) != FFEINFO_whereNONE)
- && (ffesymbol_where (s) != FFEINFO_whereINTRINSIC)))
- && (ffesymbol_where (s) != FFEINFO_whereDUMMY))
- /* Not transformed, and not CHARACTER*(*), and not a dummy
- argument, which can happen only if the entry point names
- it "rides in on" are all invalidated for other reasons. */
- s = ffecom_sym_transform_ (s);
+ if (ffesymbol_hook (s).decl_tree == NULL_TREE)
+ {
+ if (ffesymbol_where (s) == FFEINFO_whereCONSTANT
+ && (ffesymbol_kind (s) == FFEINFO_kindFUNCTION
+ || ffesymbol_kind (s) == FFEINFO_kindSUBROUTINE))
+ {
+ /* An unreferenced statement function. If this refers to
+ an undeclared array, it'll look like a reference to
+ an external function that might not exist. Even if it
+ does refer to an non-existent function, it seems silly
+ to force a linker error when the function won't actually
+ be called. But before the 1998-05-15 change to egcs/gcc
+ toplev.c by Mark Mitchell, to fix other problems, this
+ didn't actually happen, since gcc would defer nested
+ functions to be compiled later only if needed. With that
+ change, it makes sense to simply avoid telling the back
+ end about the statement (nested) function at all. But
+ if -Wunused is specified, might as well warn about it. */
+
+ if (warn_unused)
+ {
+ ffebad_start (FFEBAD_SFUNC_UNUSED);
+ ffebad_string (ffesymbol_text (s));
+ ffebad_here (0, ffesymbol_where_line (s), ffesymbol_where_column (s));
+ ffebad_finish ();
+ }
+ }
+ else if (ffesymbol_kind (s) != FFEINFO_kindNONE
+ || (ffesymbol_where (s) != FFEINFO_whereNONE
+ && ffesymbol_where (s) != FFEINFO_whereINTRINSIC
+ && ffesymbol_where (s) != FFEINFO_whereDUMMY))
+ /* Not transformed, and not CHARACTER*(*), and not a dummy
+ argument, which can happen only if the entry point names
+ it "rides in on" are all invalidated for other reasons. */
+ s = ffecom_sym_transform_ (s);
+ }
if ((ffesymbol_where (s) == FFEINFO_whereCOMMON)
&& (ffesymbol_hook (s).decl_tree != error_mark_node))