Commit edf1eac2 by Steven G. Kargl

openmp.c, [...]: Next installment in the massive whitespace patch.

    * openmp.c, matchexp.c, module.c, scanner.c, resolve.c, st.c,
    parse.c, primary.c, options.c, misc.c, simplify.c:  Next installment
    in the massive whitespace patch.

From-SVN: r121012
parent 70fadd09
2007-01-20 Steven G. Kargl <kargl@gcc.gnu.org>
* openmp.c, matchexp.c, module.c, scanner.c, resolve.c, st.c,
parse.c, primary.c, options.c, misc.c, simplify.c: Next installment
in the massive whitespace patch.
2007-01-20 Roger Sayle <roger@eyesopen.com> 2007-01-20 Roger Sayle <roger@eyesopen.com>
* module.c (mio_array_ref): The dimen_type fields of an array ref * module.c (mio_array_ref): The dimen_type fields of an array ref
......
/* Expression parser. /* Expression parser.
Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007
Inc. Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
This file is part of GCC. This file is part of GCC.
...@@ -20,7 +20,6 @@ along with GCC; see the file COPYING. If not, write to the Free ...@@ -20,7 +20,6 @@ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */ 02110-1301, USA. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "gfortran.h" #include "gfortran.h"
...@@ -91,7 +90,7 @@ error: ...@@ -91,7 +90,7 @@ error:
operator already. */ operator already. */
static match static match
match_defined_operator (gfc_user_op ** result) match_defined_operator (gfc_user_op **result)
{ {
char name[GFC_MAX_SYMBOL_LEN + 1]; char name[GFC_MAX_SYMBOL_LEN + 1];
match m; match m;
...@@ -126,6 +125,7 @@ next_operator (gfc_intrinsic_op t) ...@@ -126,6 +125,7 @@ next_operator (gfc_intrinsic_op t)
/* Call the INTRINSIC_PARENTHESES function. This is both /* Call the INTRINSIC_PARENTHESES function. This is both
used explicitly, as below, or by resolve.c to generate used explicitly, as below, or by resolve.c to generate
temporaries. */ temporaries. */
gfc_expr * gfc_expr *
gfc_get_parentheses (gfc_expr *e) gfc_get_parentheses (gfc_expr *e)
{ {
...@@ -146,7 +146,7 @@ gfc_get_parentheses (gfc_expr *e) ...@@ -146,7 +146,7 @@ gfc_get_parentheses (gfc_expr *e)
/* Match a primary expression. */ /* Match a primary expression. */
static match static match
match_primary (gfc_expr ** result) match_primary (gfc_expr **result)
{ {
match m; match m;
gfc_expr *e; gfc_expr *e;
...@@ -206,8 +206,8 @@ syntax: ...@@ -206,8 +206,8 @@ syntax:
/* Build an operator expression node. */ /* Build an operator expression node. */
static gfc_expr * static gfc_expr *
build_node (gfc_intrinsic_op operator, locus * where, build_node (gfc_intrinsic_op operator, locus *where,
gfc_expr * op1, gfc_expr * op2) gfc_expr *op1, gfc_expr *op2)
{ {
gfc_expr *new; gfc_expr *new;
...@@ -226,7 +226,7 @@ build_node (gfc_intrinsic_op operator, locus * where, ...@@ -226,7 +226,7 @@ build_node (gfc_intrinsic_op operator, locus * where,
/* Match a level 1 expression. */ /* Match a level 1 expression. */
static match static match
match_level_1 (gfc_expr ** result) match_level_1 (gfc_expr **result)
{ {
gfc_user_op *uop; gfc_user_op *uop;
gfc_expr *e, *f; gfc_expr *e, *f;
...@@ -272,14 +272,12 @@ match_level_1 (gfc_expr ** result) ...@@ -272,14 +272,12 @@ match_level_1 (gfc_expr ** result)
or add-operand or add-operand
*/ */
static match match_ext_mult_operand (gfc_expr ** result); static match match_ext_mult_operand (gfc_expr **result);
static match match_ext_add_operand (gfc_expr ** result); static match match_ext_add_operand (gfc_expr **result);
static int static int
match_add_op (void) match_add_op (void)
{ {
if (next_operator (INTRINSIC_MINUS)) if (next_operator (INTRINSIC_MINUS))
return -1; return -1;
if (next_operator (INTRINSIC_PLUS)) if (next_operator (INTRINSIC_PLUS))
...@@ -289,7 +287,7 @@ match_add_op (void) ...@@ -289,7 +287,7 @@ match_add_op (void)
static match static match
match_mult_operand (gfc_expr ** result) match_mult_operand (gfc_expr **result)
{ {
gfc_expr *e, *exp, *r; gfc_expr *e, *exp, *r;
locus where; locus where;
...@@ -332,7 +330,7 @@ match_mult_operand (gfc_expr ** result) ...@@ -332,7 +330,7 @@ match_mult_operand (gfc_expr ** result)
static match static match
match_ext_mult_operand (gfc_expr ** result) match_ext_mult_operand (gfc_expr **result)
{ {
gfc_expr *all, *e; gfc_expr *all, *e;
locus where; locus where;
...@@ -345,8 +343,8 @@ match_ext_mult_operand (gfc_expr ** result) ...@@ -345,8 +343,8 @@ match_ext_mult_operand (gfc_expr ** result)
if (i == 0) if (i == 0)
return match_mult_operand (result); return match_mult_operand (result);
if (gfc_notify_std (GFC_STD_GNU, "Extension: Unary operator following" if (gfc_notify_std (GFC_STD_GNU, "Extension: Unary operator following "
" arithmetic operator (use parentheses) at %C") "arithmetic operator (use parentheses) at %C")
== FAILURE) == FAILURE)
return MATCH_ERROR; return MATCH_ERROR;
...@@ -372,7 +370,7 @@ match_ext_mult_operand (gfc_expr ** result) ...@@ -372,7 +370,7 @@ match_ext_mult_operand (gfc_expr ** result)
static match static match
match_add_operand (gfc_expr ** result) match_add_operand (gfc_expr **result)
{ {
gfc_expr *all, *e, *total; gfc_expr *all, *e, *total;
locus where, old_loc; locus where, old_loc;
...@@ -436,7 +434,7 @@ match_add_operand (gfc_expr ** result) ...@@ -436,7 +434,7 @@ match_add_operand (gfc_expr ** result)
static match static match
match_ext_add_operand (gfc_expr ** result) match_ext_add_operand (gfc_expr **result)
{ {
gfc_expr *all, *e; gfc_expr *all, *e;
locus where; locus where;
...@@ -449,8 +447,8 @@ match_ext_add_operand (gfc_expr ** result) ...@@ -449,8 +447,8 @@ match_ext_add_operand (gfc_expr ** result)
if (i == 0) if (i == 0)
return match_add_operand (result); return match_add_operand (result);
if (gfc_notify_std (GFC_STD_GNU, "Extension: Unary operator following" if (gfc_notify_std (GFC_STD_GNU, "Extension: Unary operator following "
" arithmetic operator (use parentheses) at %C") "arithmetic operator (use parentheses) at %C")
== FAILURE) == FAILURE)
return MATCH_ERROR; return MATCH_ERROR;
...@@ -478,7 +476,7 @@ match_ext_add_operand (gfc_expr ** result) ...@@ -478,7 +476,7 @@ match_ext_add_operand (gfc_expr ** result)
/* Match a level 2 expression. */ /* Match a level 2 expression. */
static match static match
match_level_2 (gfc_expr ** result) match_level_2 (gfc_expr **result)
{ {
gfc_expr *all, *e, *total; gfc_expr *all, *e, *total;
locus where; locus where;
...@@ -521,7 +519,7 @@ match_level_2 (gfc_expr ** result) ...@@ -521,7 +519,7 @@ match_level_2 (gfc_expr ** result)
all->where = where; all->where = where;
/* Append add-operands to the sum */ /* Append add-operands to the sum. */
for (;;) for (;;)
{ {
...@@ -563,7 +561,7 @@ match_level_2 (gfc_expr ** result) ...@@ -563,7 +561,7 @@ match_level_2 (gfc_expr ** result)
/* Match a level three expression. */ /* Match a level three expression. */
static match static match
match_level_3 (gfc_expr ** result) match_level_3 (gfc_expr **result)
{ {
gfc_expr *all, *e, *total; gfc_expr *all, *e, *total;
locus where; locus where;
...@@ -609,7 +607,7 @@ match_level_3 (gfc_expr ** result) ...@@ -609,7 +607,7 @@ match_level_3 (gfc_expr ** result)
/* Match a level 4 expression. */ /* Match a level 4 expression. */
static match static match
match_level_4 (gfc_expr ** result) match_level_4 (gfc_expr **result)
{ {
gfc_expr *left, *right, *r; gfc_expr *left, *right, *r;
gfc_intrinsic_op i; gfc_intrinsic_op i;
...@@ -693,7 +691,7 @@ match_level_4 (gfc_expr ** result) ...@@ -693,7 +691,7 @@ match_level_4 (gfc_expr ** result)
static match static match
match_and_operand (gfc_expr ** result) match_and_operand (gfc_expr **result)
{ {
gfc_expr *e, *r; gfc_expr *e, *r;
locus where; locus where;
...@@ -726,7 +724,7 @@ match_and_operand (gfc_expr ** result) ...@@ -726,7 +724,7 @@ match_and_operand (gfc_expr ** result)
static match static match
match_or_operand (gfc_expr ** result) match_or_operand (gfc_expr **result)
{ {
gfc_expr *all, *e, *total; gfc_expr *all, *e, *total;
locus where; locus where;
...@@ -769,7 +767,7 @@ match_or_operand (gfc_expr ** result) ...@@ -769,7 +767,7 @@ match_or_operand (gfc_expr ** result)
static match static match
match_equiv_operand (gfc_expr ** result) match_equiv_operand (gfc_expr **result)
{ {
gfc_expr *all, *e, *total; gfc_expr *all, *e, *total;
locus where; locus where;
...@@ -814,7 +812,7 @@ match_equiv_operand (gfc_expr ** result) ...@@ -814,7 +812,7 @@ match_equiv_operand (gfc_expr ** result)
/* Match a level 5 expression. */ /* Match a level 5 expression. */
static match static match
match_level_5 (gfc_expr ** result) match_level_5 (gfc_expr **result)
{ {
gfc_expr *all, *e, *total; gfc_expr *all, *e, *total;
locus where; locus where;
...@@ -873,7 +871,7 @@ match_level_5 (gfc_expr ** result) ...@@ -873,7 +871,7 @@ match_level_5 (gfc_expr ** result)
level 5 expressions separated by binary operators. */ level 5 expressions separated by binary operators. */
match match
gfc_match_expr (gfc_expr ** result) gfc_match_expr (gfc_expr **result)
{ {
gfc_expr *all, *e; gfc_expr *all, *e;
gfc_user_op *uop; gfc_user_op *uop;
......
/* Miscellaneous stuff that doesn't fit anywhere else. /* Miscellaneous stuff that doesn't fit anywhere else.
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Foundation, Inc. Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
This file is part of GCC. This file is part of GCC.
...@@ -20,12 +20,10 @@ along with GCC; see the file COPYING. If not, write to the Free ...@@ -20,12 +20,10 @@ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */ 02110-1301, USA. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "gfortran.h" #include "gfortran.h"
/* Get a block of memory. Many callers assume that the memory we /* Get a block of memory. Many callers assume that the memory we
return is zeroed. */ return is zeroed. */
...@@ -54,7 +52,6 @@ gfc_getmem (size_t n) ...@@ -54,7 +52,6 @@ gfc_getmem (size_t n)
void void
gfc_free (void *p) gfc_free (void *p)
{ {
if (p != NULL) if (p != NULL)
free (p); free (p);
} }
...@@ -63,10 +60,10 @@ gfc_free (void *p) ...@@ -63,10 +60,10 @@ gfc_free (void *p)
#undef temp #undef temp
/* Get terminal width */ /* Get terminal width. */
int int
gfc_terminal_width(void) gfc_terminal_width (void)
{ {
return 80; return 80;
} }
...@@ -75,9 +72,8 @@ gfc_terminal_width(void) ...@@ -75,9 +72,8 @@ gfc_terminal_width(void)
/* Initialize a typespec to unknown. */ /* Initialize a typespec to unknown. */
void void
gfc_clear_ts (gfc_typespec * ts) gfc_clear_ts (gfc_typespec *ts)
{ {
ts->type = BT_UNKNOWN; ts->type = BT_UNKNOWN;
ts->kind = 0; ts->kind = 0;
ts->derived = NULL; ts->derived = NULL;
...@@ -154,9 +150,9 @@ gfc_basic_typename (bt type) ...@@ -154,9 +150,9 @@ gfc_basic_typename (bt type)
the argument list of a single statement. */ the argument list of a single statement. */
const char * const char *
gfc_typename (gfc_typespec * ts) gfc_typename (gfc_typespec *ts)
{ {
static char buffer1[60], buffer2[60]; static char buffer1[60], buffer2[60]; /* FIXME: Buffer overflow. */
static int flag = 0; static int flag = 0;
char *buffer; char *buffer;
...@@ -204,9 +200,8 @@ gfc_typename (gfc_typespec * ts) ...@@ -204,9 +200,8 @@ gfc_typename (gfc_typespec * ts)
returning a pointer to the string. */ returning a pointer to the string. */
const char * const char *
gfc_code2string (const mstring * m, int code) gfc_code2string (const mstring *m, int code)
{ {
while (m->string != NULL) while (m->string != NULL)
{ {
if (m->tag == code) if (m->tag == code)
...@@ -220,13 +215,11 @@ gfc_code2string (const mstring * m, int code) ...@@ -220,13 +215,11 @@ gfc_code2string (const mstring * m, int code)
/* Given an mstring array and a string, returns the value of the tag /* Given an mstring array and a string, returns the value of the tag
field. Returns the final tag if no matches to the string are field. Returns the final tag if no matches to the string are found. */
found. */
int int
gfc_string2code (const mstring * m, const char *string) gfc_string2code (const mstring *m, const char *string)
{ {
for (; m->string != NULL; m++) for (; m->string != NULL; m++)
if (strcmp (m->string, string) == 0) if (strcmp (m->string, string) == 0)
return m->tag; return m->tag;
...@@ -237,10 +230,10 @@ gfc_string2code (const mstring * m, const char *string) ...@@ -237,10 +230,10 @@ gfc_string2code (const mstring * m, const char *string)
/* Convert an intent code to a string. */ /* Convert an intent code to a string. */
/* TODO: move to gfortran.h as define. */ /* TODO: move to gfortran.h as define. */
const char * const char *
gfc_intent_string (sym_intent i) gfc_intent_string (sym_intent i)
{ {
return gfc_code2string (intents, i); return gfc_code2string (intents, i);
} }
...@@ -265,7 +258,6 @@ gfc_init_1 (void) ...@@ -265,7 +258,6 @@ gfc_init_1 (void)
void void
gfc_init_2 (void) gfc_init_2 (void)
{ {
gfc_symbol_init_2 (); gfc_symbol_init_2 ();
gfc_module_init_2 (); gfc_module_init_2 ();
} }
...@@ -289,7 +281,6 @@ gfc_done_1 (void) ...@@ -289,7 +281,6 @@ gfc_done_1 (void)
void void
gfc_done_2 (void) gfc_done_2 (void)
{ {
gfc_symbol_done_2 (); gfc_symbol_done_2 ();
gfc_module_done_2 (); gfc_module_done_2 ();
} }
......
/* Parse and display command line options. /* Parse and display command line options.
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
...@@ -20,7 +20,6 @@ along with GCC; see the file COPYING. If not, write to the Free ...@@ -20,7 +20,6 @@ along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */ 02110-1301, USA. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "coretypes.h" #include "coretypes.h"
...@@ -31,7 +30,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -31,7 +30,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "options.h" #include "options.h"
#include "params.h" #include "params.h"
#include "tree-inline.h" #include "tree-inline.h"
#include "gfortran.h" #include "gfortran.h"
#include "target.h" #include "target.h"
...@@ -94,8 +92,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, ...@@ -94,8 +92,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.fpe = 0; gfc_option.fpe = 0;
/* Argument pointers cannot point to anything /* Argument pointers cannot point to anything but their argument. */
but their argument. */
flag_argument_noalias = 3; flag_argument_noalias = 3;
flag_errno_math = 0; flag_errno_math = 0;
...@@ -112,7 +109,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, ...@@ -112,7 +109,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.fshort_enums = targetm.default_short_enums (); gfc_option.fshort_enums = targetm.default_short_enums ();
/* Increase MAX_ALIASED_VOPS to account for different characteristics /* Increase MAX_ALIASED_VOPS to account for different characteristics
of fortran regarding VOPs. */ of Fortran regarding VOPs. */
MAX_ALIASED_VOPS = 50; MAX_ALIASED_VOPS = 50;
return CL_Fortran; return CL_Fortran;
...@@ -125,7 +122,6 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, ...@@ -125,7 +122,6 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
static gfc_source_form static gfc_source_form
form_from_filename (const char *filename) form_from_filename (const char *filename)
{ {
static const struct static const struct
{ {
const char *extension; const char *extension;
...@@ -223,6 +219,7 @@ gfc_post_options (const char **pfilename) ...@@ -223,6 +219,7 @@ gfc_post_options (const char **pfilename)
i = strlen (canon_source_file); i = strlen (canon_source_file);
while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i])) while (i > 0 && !IS_DIR_SEPARATOR (canon_source_file[i]))
i--; i--;
if (i != 0) if (i != 0)
{ {
source_path = alloca (i + 1); source_path = alloca (i + 1);
...@@ -260,8 +257,7 @@ gfc_post_options (const char **pfilename) ...@@ -260,8 +257,7 @@ gfc_post_options (const char **pfilename)
gfc_warning_now ("'-fd-lines-as-comments' has no effect " gfc_warning_now ("'-fd-lines-as-comments' has no effect "
"in free form"); "in free form");
else if (gfc_option.flag_d_lines == 1) else if (gfc_option.flag_d_lines == 1)
gfc_warning_now ("'-fd-lines-as-code' has no effect " gfc_warning_now ("'-fd-lines-as-code' has no effect in free form");
"in free form");
} }
flag_inline_trees = 1; flag_inline_trees = 1;
...@@ -304,7 +300,6 @@ gfc_post_options (const char **pfilename) ...@@ -304,7 +300,6 @@ gfc_post_options (const char **pfilename)
static void static void
set_Wall (void) set_Wall (void)
{ {
gfc_option.warn_aliasing = 1; gfc_option.warn_aliasing = 1;
gfc_option.warn_ampersand = 1; gfc_option.warn_ampersand = 1;
gfc_option.warn_line_truncation = 1; gfc_option.warn_line_truncation = 1;
...@@ -350,12 +345,13 @@ gfc_handle_module_path_options (const char *arg) ...@@ -350,12 +345,13 @@ gfc_handle_module_path_options (const char *arg)
gfc_add_include_path (gfc_option.module_dir, true); gfc_add_include_path (gfc_option.module_dir, true);
} }
static void static void
gfc_handle_fpe_trap_option (const char *arg) gfc_handle_fpe_trap_option (const char *arg)
{ {
int result, pos = 0, n; int result, pos = 0, n;
static const char * const exception[] = { "invalid", "denormal", "zero", static const char * const exception[] = { "invalid", "denormal", "zero",
"overflow", "underflow", "overflow", "underflow",
"precision", NULL }; "precision", NULL };
static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL, static const int opt_exception[] = { GFC_FPE_INVALID, GFC_FPE_DENORMAL,
GFC_FPE_ZERO, GFC_FPE_OVERFLOW, GFC_FPE_ZERO, GFC_FPE_OVERFLOW,
...@@ -366,8 +362,10 @@ gfc_handle_fpe_trap_option (const char *arg) ...@@ -366,8 +362,10 @@ gfc_handle_fpe_trap_option (const char *arg)
{ {
while (*arg == ',') while (*arg == ',')
arg++; arg++;
while (arg[pos] && arg[pos] != ',') while (arg[pos] && arg[pos] != ',')
pos++; pos++;
result = 0; result = 0;
for (n = 0; exception[n] != NULL; n++) for (n = 0; exception[n] != NULL; n++)
{ {
...@@ -380,13 +378,15 @@ gfc_handle_fpe_trap_option (const char *arg) ...@@ -380,13 +378,15 @@ gfc_handle_fpe_trap_option (const char *arg)
break; break;
} }
} }
if (! result) if (!result)
gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg); gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
} }
} }
/* Handle command-line options. Returns 0 if unrecognized, 1 if /* Handle command-line options. Returns 0 if unrecognized, 1 if
recognized and handled. */ recognized and handled. */
int int
gfc_handle_option (size_t scode, const char *arg, int value) gfc_handle_option (size_t scode, const char *arg, int value)
{ {
...@@ -665,7 +665,8 @@ gfc_handle_option (size_t scode, const char *arg, int value) ...@@ -665,7 +665,8 @@ gfc_handle_option (size_t scode, const char *arg, int value)
case OPT_fmax_subrecord_length_: case OPT_fmax_subrecord_length_:
if (value > MAX_SUBRECORD_LENGTH) if (value > MAX_SUBRECORD_LENGTH)
gfc_fatal_error ("Maximum subrecord length cannot exceed %d", MAX_SUBRECORD_LENGTH); gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
MAX_SUBRECORD_LENGTH);
gfc_option.max_subrecord_length = value; gfc_option.max_subrecord_length = value;
} }
......
...@@ -113,7 +113,6 @@ gfc_scanner_done_1 (void) ...@@ -113,7 +113,6 @@ gfc_scanner_done_1 (void)
gfc_free(file_head); gfc_free(file_head);
file_head = f; file_head = f;
} }
} }
...@@ -248,12 +247,12 @@ gfc_open_intrinsic_module (const char *name) ...@@ -248,12 +247,12 @@ gfc_open_intrinsic_module (const char *name)
return open_included_file (name, intrinsic_modules_dirs, true); return open_included_file (name, intrinsic_modules_dirs, true);
} }
/* Test to see if we're at the end of the main source file. */ /* Test to see if we're at the end of the main source file. */
int int
gfc_at_end (void) gfc_at_end (void)
{ {
return end_flag; return end_flag;
} }
...@@ -263,7 +262,6 @@ gfc_at_end (void) ...@@ -263,7 +262,6 @@ gfc_at_end (void)
int int
gfc_at_eof (void) gfc_at_eof (void)
{ {
if (gfc_at_end ()) if (gfc_at_end ())
return 1; return 1;
...@@ -294,7 +292,6 @@ gfc_at_bol (void) ...@@ -294,7 +292,6 @@ gfc_at_bol (void)
int int
gfc_at_eol (void) gfc_at_eol (void)
{ {
if (gfc_at_eof ()) if (gfc_at_eof ())
return 1; return 1;
...@@ -318,7 +315,7 @@ gfc_advance_line (void) ...@@ -318,7 +315,7 @@ gfc_advance_line (void)
gfc_current_locus.lb = gfc_current_locus.lb->next; gfc_current_locus.lb = gfc_current_locus.lb->next;
if (gfc_current_locus.lb != NULL) if (gfc_current_locus.lb != NULL)
gfc_current_locus.nextc = gfc_current_locus.lb->line; gfc_current_locus.nextc = gfc_current_locus.lb->line;
else else
{ {
...@@ -355,6 +352,7 @@ next_char (void) ...@@ -355,6 +352,7 @@ next_char (void)
return c; return c;
} }
/* Skip a comment. When we come here the parse pointer is positioned /* Skip a comment. When we come here the parse pointer is positioned
immediately after the comment character. If we ever implement immediately after the comment character. If we ever implement
compiler directives withing comments, here is where we parse the compiler directives withing comments, here is where we parse the
...@@ -714,10 +712,9 @@ restart: ...@@ -714,10 +712,9 @@ restart:
{ {
if (++continue_count == gfc_option.max_continue_free) if (++continue_count == gfc_option.max_continue_free)
{ {
if (gfc_notification_std (GFC_STD_GNU) if (gfc_notification_std (GFC_STD_GNU) || pedantic)
|| pedantic) gfc_warning ("Limit of %d continuations exceeded in "
gfc_warning ("Limit of %d continuations exceeded in statement at %C", "statement at %C", gfc_option.max_continue_free);
gfc_option.max_continue_free);
} }
} }
continue_line = gfc_current_locus.lb->linenum; continue_line = gfc_current_locus.lb->linenum;
...@@ -761,7 +758,8 @@ restart: ...@@ -761,7 +758,8 @@ restart:
if (in_string) if (in_string)
{ {
if (gfc_option.warn_ampersand) if (gfc_option.warn_ampersand)
gfc_warning_now ("Missing '&' in continued character constant at %C"); gfc_warning_now ("Missing '&' in continued character "
"constant at %C");
gfc_current_locus.nextc--; gfc_current_locus.nextc--;
} }
/* Both !$omp and !$ -fopenmp continuation lines have & on the /* Both !$omp and !$ -fopenmp continuation lines have & on the
...@@ -835,10 +833,10 @@ restart: ...@@ -835,10 +833,10 @@ restart:
{ {
if (++continue_count == gfc_option.max_continue_fixed) if (++continue_count == gfc_option.max_continue_fixed)
{ {
if (gfc_notification_std (GFC_STD_GNU) if (gfc_notification_std (GFC_STD_GNU) || pedantic)
|| pedantic) gfc_warning ("Limit of %d continuations exceeded in "
gfc_warning ("Limit of %d continuations exceeded in statement at %C", "statement at %C",
gfc_option.max_continue_fixed); gfc_option.max_continue_fixed);
} }
} }
...@@ -997,7 +995,7 @@ gfc_gobble_whitespace (void) ...@@ -997,7 +995,7 @@ gfc_gobble_whitespace (void)
parts of gfortran. */ parts of gfortran. */
static int static int
load_line (FILE * input, char **pbuf, int *pbuflen) load_line (FILE *input, char **pbuf, int *pbuflen)
{ {
static int linenum = 0, current_line = 1; static int linenum = 0, current_line = 1;
int c, maxlen, i, preprocessor_flag, buflen = *pbuflen; int c, maxlen, i, preprocessor_flag, buflen = *pbuflen;
...@@ -1052,11 +1050,11 @@ load_line (FILE * input, char **pbuf, int *pbuflen) ...@@ -1052,11 +1050,11 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
&& !seen_printable && seen_ampersand) && !seen_printable && seen_ampersand)
{ {
if (pedantic) if (pedantic)
gfc_error_now gfc_error_now ("'&' not allowed by itself in line %d",
("'&' not allowed by itself in line %d", current_line); current_line);
else else
gfc_warning_now gfc_warning_now ("'&' not allowed by itself in line %d",
("'&' not allowed by itself in line %d", current_line); current_line);
} }
break; break;
} }
...@@ -1084,11 +1082,11 @@ load_line (FILE * input, char **pbuf, int *pbuflen) ...@@ -1084,11 +1082,11 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
&& c == '!' && !seen_printable && seen_ampersand) && c == '!' && !seen_printable && seen_ampersand)
{ {
if (pedantic) if (pedantic)
gfc_error_now ( gfc_error_now ("'&' not allowed by itself with comment in "
"'&' not allowed by itself with comment in line %d", current_line); "line %d", current_line);
else else
gfc_warning_now ( gfc_warning_now ("'&' not allowed by itself with comment in "
"'&' not allowed by itself with comment in line %d", current_line); "line %d", current_line);
seen_printable = 1; seen_printable = 1;
} }
...@@ -1103,8 +1101,8 @@ load_line (FILE * input, char **pbuf, int *pbuflen) ...@@ -1103,8 +1101,8 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
&& current_line != linenum) && current_line != linenum)
{ {
linenum = current_line; linenum = current_line;
gfc_warning_now ( gfc_warning_now ("Nonconforming tab character in column 1 "
"Nonconforming tab character in column 1 of line %d", linenum); "of line %d", linenum);
} }
while (i <= 6) while (i <= 6)
...@@ -1127,7 +1125,7 @@ load_line (FILE * input, char **pbuf, int *pbuflen) ...@@ -1127,7 +1125,7 @@ load_line (FILE * input, char **pbuf, int *pbuflen)
overlong line. */ overlong line. */
buflen = buflen * 2; buflen = buflen * 2;
*pbuf = xrealloc (*pbuf, buflen + 1); *pbuf = xrealloc (*pbuf, buflen + 1);
buffer = (*pbuf)+i; buffer = (*pbuf) + i;
} }
} }
else if (i >= maxlen) else if (i >= maxlen)
...@@ -1234,10 +1232,10 @@ preprocessor_line (char *c) ...@@ -1234,10 +1232,10 @@ preprocessor_line (char *c)
/* Make filename end at quote. */ /* Make filename end at quote. */
unescape = 0; unescape = 0;
escaped = false; escaped = false;
while (*c && ! (! escaped && *c == '"')) while (*c && ! (!escaped && *c == '"'))
{ {
if (escaped) if (escaped)
escaped = false; escaped = false;
else if (*c == '\\') else if (*c == '\\')
{ {
escaped = true; escaped = true;
...@@ -1407,6 +1405,7 @@ include_line (char *line) ...@@ -1407,6 +1405,7 @@ include_line (char *line)
return true; return true;
} }
/* Load a file into memory by calling load_line until the file ends. */ /* Load a file into memory by calling load_line until the file ends. */
static try static try
...@@ -1582,7 +1581,7 @@ unescape_filename (const char *ptr) ...@@ -1582,7 +1581,7 @@ unescape_filename (const char *ptr)
++p; ++p;
} }
if (! *p || p[1]) if (!*p || p[1])
return NULL; return NULL;
/* Undo effects of cpp_quote_string. */ /* Undo effects of cpp_quote_string. */
......
/* Build executable statement trees. /* Build executable statement trees.
Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Andy Vaught Contributed by Andy Vaught
...@@ -37,7 +37,6 @@ gfc_code new_st; ...@@ -37,7 +37,6 @@ gfc_code new_st;
void void
gfc_clear_new_st (void) gfc_clear_new_st (void)
{ {
memset (&new_st, '\0', sizeof (new_st)); memset (&new_st, '\0', sizeof (new_st));
new_st.op = EXEC_NOP; new_st.op = EXEC_NOP;
} }
...@@ -60,9 +59,8 @@ gfc_get_code (void) ...@@ -60,9 +59,8 @@ gfc_get_code (void)
its tail, returning a pointer to the new tail. */ its tail, returning a pointer to the new tail. */
gfc_code * gfc_code *
gfc_append_code (gfc_code * tail, gfc_code * new) gfc_append_code (gfc_code *tail, gfc_code *new)
{ {
if (tail != NULL) if (tail != NULL)
{ {
while (tail->next != NULL) while (tail->next != NULL)
...@@ -81,9 +79,8 @@ gfc_append_code (gfc_code * tail, gfc_code * new) ...@@ -81,9 +79,8 @@ gfc_append_code (gfc_code * tail, gfc_code * new)
/* Free a single code structure, but not the actual structure itself. */ /* Free a single code structure, but not the actual structure itself. */
void void
gfc_free_statement (gfc_code * p) gfc_free_statement (gfc_code *p)
{ {
if (p->expr) if (p->expr)
gfc_free_expr (p->expr); gfc_free_expr (p->expr);
if (p->expr2) if (p->expr2)
...@@ -157,7 +154,7 @@ gfc_free_statement (gfc_code * p) ...@@ -157,7 +154,7 @@ gfc_free_statement (gfc_code * p)
case EXEC_DT_END: case EXEC_DT_END:
/* The ext.dt member is a duplicate pointer and doesn't need to /* The ext.dt member is a duplicate pointer and doesn't need to
be freed. */ be freed. */
break; break;
case EXEC_FORALL: case EXEC_FORALL:
...@@ -200,7 +197,7 @@ gfc_free_statement (gfc_code * p) ...@@ -200,7 +197,7 @@ gfc_free_statement (gfc_code * p)
/* Free a code statement and all other code structures linked to it. */ /* Free a code statement and all other code structures linked to it. */
void void
gfc_free_statements (gfc_code * p) gfc_free_statements (gfc_code *p)
{ {
gfc_code *q; gfc_code *q;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment