diff options
author | Tobias Schlüter <tobi@gcc.gnu.org> | 2007-10-28 19:53:27 +0100 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2007-10-28 19:53:27 +0100 |
commit | 5cb41805708de9784dd9ce6dfc88c0cd4f87af93 (patch) | |
tree | 6b0dbd378d040ff0c2dc656b2f563ea140b6339b /gcc/fortran/module.c | |
parent | 6f17d116b739645d9c331ffb4b741eebbfb69a5c (diff) | |
download | gcc-5cb41805708de9784dd9ce6dfc88c0cd4f87af93.zip gcc-5cb41805708de9784dd9ce6dfc88c0cd4f87af93.tar.gz gcc-5cb41805708de9784dd9ce6dfc88c0cd4f87af93.tar.bz2 |
re PR fortran/32147 (Module file change due to order of writting out changes)
fortran/
PR fortran/32147
* module.c (write_symbol): Fix whitespace.
(write_symbol0): Walk symtree from left-to-right instead
breadth-first.
(write_symbol1): Similarly change walk of pointer info tree.
(write_module): Insert linebreak.
* symbol.c (gfc_traverse_symtree): Change to left-to-right order.
(traverse_ns): Likewise.
testsuite/
PR fortran/32147
* gfortran.dg/module_md5_1.f90: Update hash-value.
From-SVN: r129701
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 78bbac8..12c4516 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -3880,7 +3880,7 @@ write_equiv (void) static void write_symbol (int n, gfc_symbol *sym) { - const char *label; + const char *label; if (sym->attr.flavor == FL_UNKNOWN || sym->attr.flavor == FL_LABEL) gfc_internal_error ("write_symbol(): bad module symbol '%s'", sym->name); @@ -3913,12 +3913,12 @@ write_symbol0 (gfc_symtree *st) { gfc_symbol *sym; pointer_info *p; + bool dont_write = false; if (st == NULL) return; write_symbol0 (st->left); - write_symbol0 (st->right); sym = st->n.sym; if (sym->module == NULL) @@ -3926,20 +3926,25 @@ write_symbol0 (gfc_symtree *st) if (sym->attr.flavor == FL_PROCEDURE && sym->attr.generic && !sym->attr.subroutine && !sym->attr.function) - return; + dont_write = true; if (!gfc_check_access (sym->attr.access, sym->ns->default_access)) - return; + dont_write = true; - p = get_pointer (sym); - if (p->type == P_UNKNOWN) - p->type = P_SYMBOL; + if (!dont_write) + { + p = get_pointer (sym); + if (p->type == P_UNKNOWN) + p->type = P_SYMBOL; - if (p->u.wsym.state == WRITTEN) - return; + if (p->u.wsym.state != WRITTEN) + { + write_symbol (p->integer, sym); + p->u.wsym.state = WRITTEN; + } + } - write_symbol (p->integer, sym); - p->u.wsym.state = WRITTEN; + write_symbol0 (st->right); } @@ -3953,22 +3958,22 @@ write_symbol0 (gfc_symtree *st) static int write_symbol1 (pointer_info *p) { + int result; - if (p == NULL) + if (!p) return 0; - if (write_symbol1 (p->left)) - return 1; - if (write_symbol1 (p->right)) - return 1; + result = write_symbol1 (p->left); - if (p->type != P_SYMBOL || p->u.wsym.state != NEEDS_WRITE) - return 0; - - p->u.wsym.state = WRITTEN; - write_symbol (p->integer, p->u.wsym.sym); + if (!(p->type != P_SYMBOL || p->u.wsym.state != NEEDS_WRITE)) + { + p->u.wsym.state = WRITTEN; + write_symbol (p->integer, p->u.wsym.sym); + result = 1; + } - return 1; + result |= write_symbol1 (p->right); + return result; } @@ -4103,7 +4108,8 @@ write_module (void) mio_lparen (); write_symbol0 (gfc_current_ns->sym_root); - while (write_symbol1 (pi_root)); + while (write_symbol1 (pi_root)) + /* Nothing. */; mio_rparen (); |