/* Process declarations and variables for GNU CHILL compiler.
- Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000
+ Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU CC.
This must be done before we can Layout a.
The reason this is an issue is that we do *not* have a lookup
(or hash) table per scope (or module). Instead we have a single
- global table we we keep adding and removing bindings from.
+ global table we keep adding and removing bindings from.
(This is both for speed, and because of gcc history.)
Note that a SEIZE generates a declaration in the current scope,
#include "input.h"
#include "rtl.h"
#include "toplev.h"
+#include "diagnostic.h"
#define IS_UNKNOWN_TYPE(type) (TYPE_SIZE(type)==0)
#define BUILTIN_NESTING_LEVEL (-1)
/* ??? not all decl nodes are given the most useful possible
line numbers. For example, the CONST_DECLs for enum values. */
-#if 0
-/* In grokdeclarator, distinguish syntactic contexts of declarators. */
-enum decl_context
-{ NORMAL, /* Ordinary declaration */
- FUNCDEF, /* Function definition */
- PARM, /* Declaration of parm before function body */
- FIELD, /* Declaration inside struct or union */
- BITFIELD, /* Likewise but with specified width */
- TYPENAME}; /* Typename (inside cast or sizeof) */
-#endif
-
-#ifndef CHAR_TYPE_SIZE
-#define CHAR_TYPE_SIZE BITS_PER_UNIT
-#endif
-
-#ifndef SHORT_TYPE_SIZE
-#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
-#endif
-
-#ifndef INT_TYPE_SIZE
-#define INT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_TYPE_SIZE
-#define LONG_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef LONG_LONG_TYPE_SIZE
-#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
-#endif
-
-#ifndef FLOAT_TYPE_SIZE
-#define FLOAT_TYPE_SIZE BITS_PER_WORD
-#endif
-
-#ifndef DOUBLE_TYPE_SIZE
-#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
-
-#ifndef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
-#endif
/* We let tm.h override the types used here, to handle trivial differences
such as the choice of unsigned int or long unsigned int for size_t.
const char **boolean_code_name;
-/* A node for the integer constant -1. */
-tree integer_minus_one_node;
-
/* Nodes for boolean constants TRUE and FALSE. */
tree boolean_true_node, boolean_false_node;
int flag_no_nonansi_builtin;
-/* Nonzero means do some things the same way PCC does. */
-
-int flag_traditional;
-
-/* Nonzero means to allow single precision math even if we're generally
- being traditional. */
-int flag_allow_single_precision = 0;
-
/* Nonzero means to treat bitfields as signed unless they say `unsigned'. */
int flag_signed_bitfields = 1;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
- const char chill_tree_code_type[] = {
+const char tree_code_type[] = {
+#include "tree.def"
'x',
#include "ch-tree.def"
};
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-int chill_tree_code_length[] = {
+const unsigned char tree_code_length[] = {
+#include "tree.def"
0,
#include "ch-tree.def"
};
Used for printing out the tree and error messages. */
#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
-const char *chill_tree_code_name[] = {
+const char *const tree_code_name[] = {
+#include "tree.def"
"@@dummy",
#include "ch-tree.def"
};
#undef DEFTREECODE
-/* Nonzero means `$' can be in an identifier.
- See cccp.c for reasons why this breaks some obscure ANSI C programs. */
-
+/* Nonzero means `$' can be in an identifier. */
#ifndef DOLLARS_IN_IDENTIFIERS
#define DOLLARS_IN_IDENTIFIERS 0
#endif
char **argv;
{
char *p = argv[0];
- if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
- {
- flag_traditional = 1;
- flag_writable_strings = 1;
-#if DOLLARS_IN_IDENTIFIERS > 0
- dollars_in_ident = 1;
-#endif
- }
- else if (!strcmp (p, "-fnotraditional") || !strcmp (p, "-fno-traditional"))
- {
- flag_traditional = 0;
- flag_writable_strings = 0;
- dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 1;
- }
- else if (!strcmp (p, "-fsigned-char"))
+
+ if (!strcmp (p, "-fsigned-char"))
flag_signed_char = 1;
else if (!strcmp (p, "-funsigned-char"))
flag_signed_char = 0;
warn_uninitialized = 2;
warn_implicit = 1;
warn_return_type = 1;
- warn_unused = 1;
+ set_Wunused (1);
warn_char_subscripts = 1;
warn_parentheses = 1;
warn_missing_braces = 1;
if (CH_TYPE_NONVALUE_P (type))
{
error_with_decl (decl,
- "no initialisation allowed for `%s'");
+ "no initialization allowed for `%s'");
temp = NULL_TREE;
}
else if (TREE_CODE (type) == REFERENCE_TYPE)
/* Generate rtl for function exit. */
expand_function_end (input_filename, lineno, 0);
- /* So we can tell if jump_optimize sets it to 1. */
- can_reach_end = 0;
-
/* Run the optimizers and output assembler code for this function. */
rest_of_compilation (fndecl);
}
}
if (!found)
{
- error_with_decl (alias, "Nothing named `%s' to grant.");
+ error_with_decl (alias, "nothing named `%s' to grant");
DECL_ABSTRACT_ORIGIN (alias) = error_mark_node;
}
}
define_label (input_filename, lineno,
DECL_NAME (label));
}
- else if (warn_unused && !TREE_USED (label))
+ else if (warn_unused_label && !TREE_USED (label))
warning_with_decl (label, "label `%s' defined but not used");
IDENTIFIER_LABEL_VALUE (DECL_NAME (label)) = 0;
register tree block;
{
current_scope->this_block = block;
+ current_scope->decls = chainon (current_scope->decls, BLOCK_VARS (block));
+ current_scope->blocks = chainon (current_scope->blocks,
+ BLOCK_SUBBLOCKS (block));
}
\f
/* Record a decl-node X as belonging to the current lexical scope.
tree
define_label (filename, line, name)
- char *filename;
+ const char *filename;
int line;
tree name;
{
pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE],
double_type_node));
- integer_minus_one_node = build_int_2 (-1, -1);
- TREE_TYPE (integer_minus_one_node) = integer_type_node;
-
build_common_tree_nodes_2 (flag_short_double);
pushdecl (build_decl (TYPE_DECL,
/* We are not going to have real types in C with less than byte alignment,
so we might as well not have any types that claim to have it. */
TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
+ TYPE_USER_ALIGN (void_type_node) = 0;
/* This is for wide string constants. */
wchar_type_node = short_unsigned_type_node;
DECL_SOURCE_LINE (temp) = 0;
initializer_type = TREE_TYPE (temp);
- memcpy (tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
- chill_tree_code_type,
- (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
- * sizeof (char)));
- memcpy (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE,
- chill_tree_code_length,
- (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
- * sizeof (int)));
- memcpy (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE,
- chill_tree_code_name,
- (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
- * sizeof (char *)));
boolean_code_name = (const char **) xcalloc (sizeof (char *),
(int) LAST_CHILL_TREE_CODE);
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
- /* If -traditional, permit redefining a builtin function any way you like.
- (Though really, if the program redefines these functions,
- it probably won't work right unless compiled with -fno-builtin.) */
- if (flag_traditional && name[0] != '_')
- DECL_BUILT_IN_NONANSI (decl) = 1;
if (library_name)
DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
make_decl_rtl (decl, NULL_PTR, 1);
constant_expression_warning (value);
if (tree_int_cst_lt (value, integer_zero_node))
{
- error ("enumerator value for `%s' is less then 0",
+ error ("enumerator value for `%s' is less than 0",
IDENTIFIER_POINTER (DECL_NAME (decl)));
value = error_mark_node;
}
}
/* Fix all error_mark_nodes in enum. Increment maxnode and assign value.
- This is neccessary to make a duplicate value check in the enum */
+ This is necessary to make a duplicate value check in the enum */
for (pair = values; pair; pair = TREE_CHAIN (pair))
{
tree decl = TREE_VALUE (pair);
DECL_SIZE (decl) = TYPE_SIZE (enumtype);
DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (enumtype);
DECL_ALIGN (decl) = TYPE_ALIGN (enumtype);
+ DECL_USER_ALIGN (decl) = TYPE_USER_ALIGN (enumtype);
/* Set the TREE_VALUE to the name, rather than the decl,
since that is what the rest of the compiler expects. */
TYPE_MODE (tem) = TYPE_MODE (enumtype);
TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
+ TYPE_USER_ALIGN (tem) = TYPE_USER_ALIGN (enumtype);
TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype);
}
if (!unnamed_value_warned)
{
unnamed_value_warned = 1;
- warning ("undefined value in SET mode is obsolete and deprecated.");
+ warning ("undefined value in SET mode is obsolete and deprecated");
}
sprintf (buf, "__star_%d", next_dummy_enum_value++);
name = get_identifier (buf);