gfc_get_data): Move to decl.c.
(global_used): Rename into gfc_global_used.
(gfc_formalize_init_value, gfc_get_section_index,
gfc_assign_data_value, gfc_assign_data_value_range,
gfc_advance_section): Move to data.h.
(gfc_set_in_match_data): Remove.
* decl.c (gfc_get_data_variable, gfc_get_data_value,
gfc_get_data): Move here.
(gfc_set_in_match_data): Rename into set_in_match_data.
(gfc_match_data): Likewise.
(add_global_entry): Rename global_used into gfc_global_used.
* data.c: Include data.h.
* trans.h (gfc_todo_error): Remove.
* trans-array.c (gfc_trans_array_constructor,
gfc_conv_ss_startstride, gfc_conv_loop_setup): Change
gfc_todo_error into assertions.
* resolve.c (resolve_global_procedure): Rename global_used into
gfc_global_used.
* parse.c (gfc_global_used, parse_module, add_global_procedure,
add_global_program): Likewise.
* trans-intrinsic.c (gfc_walk_intrinsic_function): Rename
global_used into gfc_global_used.
* Make-lang.in: Add dependencies on fortran/data.h.
* data.h: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129034
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-10-05 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.h (gfc_get_data_variable, gfc_get_data_value,
+ gfc_get_data): Move to decl.c.
+ (global_used): Rename into gfc_global_used.
+ (gfc_formalize_init_value, gfc_get_section_index,
+ gfc_assign_data_value, gfc_assign_data_value_range,
+ gfc_advance_section): Move to data.h.
+ (gfc_set_in_match_data): Remove.
+ * decl.c (gfc_get_data_variable, gfc_get_data_value,
+ gfc_get_data): Move here.
+ (gfc_set_in_match_data): Rename into set_in_match_data.
+ (gfc_match_data): Likewise.
+ (add_global_entry): Rename global_used into gfc_global_used.
+ * data.c: Include data.h.
+ * trans.h (gfc_todo_error): Remove.
+ * trans-array.c (gfc_trans_array_constructor,
+ gfc_conv_ss_startstride, gfc_conv_loop_setup): Change
+ gfc_todo_error into assertions.
+ * resolve.c (resolve_global_procedure): Rename global_used into
+ gfc_global_used.
+ * parse.c (gfc_global_used, parse_module, add_global_procedure,
+ add_global_program): Likewise.
+ * trans-intrinsic.c (gfc_walk_intrinsic_function): Rename
+ global_used into gfc_global_used.
+ * Make-lang.in: Add dependencies on fortran/data.h.
+ * data.h: New file.
+
2007-10-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/33529
gt-fortran-trans-intrinsic.h
fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H)
-fortran/resolve.o: fortran/dependency.h
+fortran/resolve.o: fortran/dependency.h fortran/data.h
+fortran/data.o: fortran/data.h
fortran/options.o: $(PARAMS_H) $(TARGET_H)
#include "config.h"
#include "gfortran.h"
+#include "data.h"
static void formalize_init_expr (gfc_expr *);
--- /dev/null
+/* Header for functions resolving DATA statements.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+void gfc_formalize_init_value (gfc_symbol *);
+void gfc_get_section_index (gfc_array_ref *, mpz_t *, mpz_t *);
+try gfc_assign_data_value (gfc_expr *, gfc_expr *, mpz_t);
+void gfc_assign_data_value_range (gfc_expr *, gfc_expr *, mpz_t, mpz_t);
+void gfc_advance_section (mpz_t *, gfc_array_ref *, mpz_t *);
#include "match.h"
#include "parse.h"
+
+/* Macros to access allocate memory for gfc_data_variable,
+ gfc_data_value and gfc_data. */
+#define gfc_get_data_variable() gfc_getmem (sizeof (gfc_data_variable))
+#define gfc_get_data_value() gfc_getmem (sizeof (gfc_data_value))
+#define gfc_get_data() gfc_getmem( sizeof (gfc_data))
+
+
/* This flag is set if an old-style length selector is matched
during a type-declaration statement. */
return in_match_data;
}
-void
-gfc_set_in_match_data (bool set_value)
+static void
+set_in_match_data (bool set_value)
{
in_match_data = set_value;
}
gfc_data *new;
match m;
- gfc_set_in_match_data (true);
+ set_in_match_data (true);
for (;;)
{
gfc_match_char (','); /* Optional comma */
}
- gfc_set_in_match_data (false);
+ set_in_match_data (false);
if (gfc_pure (NULL))
{
return MATCH_YES;
cleanup:
- gfc_set_in_match_data (false);
+ set_in_match_data (false);
gfc_free_data (new);
return MATCH_ERROR;
}
if (s->defined
|| (s->type != GSYM_UNKNOWN
&& s->type != (sub ? GSYM_SUBROUTINE : GSYM_FUNCTION)))
- global_used(s, NULL);
+ gfc_global_used(s, NULL);
else
{
s->type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION;
}
gfc_data;
-#define gfc_get_data_variable() gfc_getmem(sizeof(gfc_data_variable))
-#define gfc_get_data_value() gfc_getmem(sizeof(gfc_data_value))
-#define gfc_get_data() gfc_getmem(sizeof(gfc_data))
-
/* Structure for holding compile options */
typedef struct
/************************ Function prototypes *************************/
-/* data.c */
-void gfc_formalize_init_value (gfc_symbol *);
-void gfc_get_section_index (gfc_array_ref *, mpz_t *, mpz_t *);
-try gfc_assign_data_value (gfc_expr *, gfc_expr *, mpz_t);
-void gfc_assign_data_value_range (gfc_expr *, gfc_expr *, mpz_t, mpz_t);
-void gfc_advance_section (mpz_t *, gfc_array_ref *, mpz_t *);
-
/* decl.c */
bool gfc_in_match_data (void);
-void gfc_set_in_match_data (bool);
/* scanner.c */
void gfc_scanner_done_1 (void);
/* parse.c */
try gfc_parse_file (void);
-void global_used (gfc_gsymbol *, locus *);
+void gfc_global_used (gfc_gsymbol *, locus *);
/* dependency.c */
int gfc_dep_compare_expr (gfc_expr *, gfc_expr *);
something else. */
void
-global_used (gfc_gsymbol *sym, locus *where)
+gfc_global_used (gfc_gsymbol *sym, locus *where)
{
const char *name;
s = gfc_get_gsymbol (gfc_new_block->name);
if (s->defined
|| (s->type != GSYM_UNKNOWN && s->type != GSYM_BLOCK_DATA))
- global_used(s, NULL);
+ gfc_global_used(s, NULL);
else
{
s->type = GSYM_BLOCK_DATA;
s = gfc_get_gsymbol (gfc_new_block->name);
if (s->defined || (s->type != GSYM_UNKNOWN && s->type != GSYM_MODULE))
- global_used(s, NULL);
+ gfc_global_used(s, NULL);
else
{
s->type = GSYM_MODULE;
if (s->defined
|| (s->type != GSYM_UNKNOWN
&& s->type != (sub ? GSYM_SUBROUTINE : GSYM_FUNCTION)))
- global_used(s, NULL);
+ gfc_global_used(s, NULL);
else
{
s->type = sub ? GSYM_SUBROUTINE : GSYM_FUNCTION;
s = gfc_get_gsymbol (gfc_new_block->name);
if (s->defined || (s->type != GSYM_UNKNOWN && s->type != GSYM_PROGRAM))
- global_used(s, NULL);
+ gfc_global_used(s, NULL);
else
{
s->type = GSYM_PROGRAM;
#include "bitmap.h"
#include "arith.h" /* For gfc_compare_expr(). */
#include "dependency.h"
+#include "data.h"
/* Types used in equivalence statements. */
gsym = gfc_get_gsymbol (sym->name);
if ((gsym->type != GSYM_UNKNOWN && gsym->type != type))
- global_used (gsym, where);
+ gfc_global_used (gsym, where);
if (gsym->type == GSYM_UNKNOWN)
{
if (ss->expr->ts.type == BT_CHARACTER)
{
bool const_string = get_array_ctor_strlen (&loop->pre, c, &ss->string_length);
- if (!ss->string_length)
- gfc_todo_error ("complex character array constructors");
+
+ /* Complex character array constructors should have been taken care of
+ and not end up here. */
+ gcc_assert (ss->string_length);
ss->expr->ts.cl->backend_decl = ss->string_length;
}
}
- if (loop->dimen == 0)
- gfc_todo_error ("Unable to determine rank of expression");
-
+ /* We should have determined the rank of the expression by now. If
+ not, that's bad news. */
+ gcc_assert (loop->dimen != 0);
/* Loop over all the SS in the chain. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
loopspec[n] = ss; */
}
- if (!loopspec[n])
- gfc_todo_error ("Unable to find scalarization loop specifier");
+ /* We should have found the scalarization loop specifier. If not,
+ that's bad news. */
+ gcc_assert (loopspec[n]);
info = &loopspec[n]->data.info;
default:
/* This probably meant someone forgot to add an intrinsic to the above
- list(s) when they implemented it, or something's gone horribly wrong.
- */
- gfc_todo_error ("Scalarization of non-elemental intrinsic: %s",
- expr->value.function.name);
+ list(s) when they implemented it, or something's gone horribly
+ wrong. */
+ gcc_unreachable ();
}
}
#define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \
(TYPE_LANG_SPECIFIC(node)->dataptr_type)
-/* I changed this from sorry(...) because it should not return. */
-/* TODO: Remove gfc_todo_error before releasing version 1.0. */
-#define gfc_todo_error(args...) fatal_error("gfc_todo: Not Implemented: " args)
-
/* Build an expression with void type. */
#define build1_v(code, arg) build1(code, void_type_node, arg)
#define build2_v(code, arg1, arg2) build2(code, void_type_node, \