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