/* Process declarations and variables for GNU CHILL compiler.
- Copyright (C) 1992, 93, 1994, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
- This file is part of GNU CC.
-
- GNU CC 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 2, or (at your option)
- any later version.
+This file is part of GNU CC.
+
+GNU CC 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 2, or (at your option)
+any later version.
- GNU CC 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.
+GNU CC 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 GNU CC; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330,
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
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)
extern tree signal_code;
extern int special_UC;
-static tree get_next_decl PROTO((void));
-static tree lookup_name_for_seizing PROTO((tree));
+static tree get_next_decl PARAMS ((void));
+static tree lookup_name_for_seizing PARAMS ((tree));
#if 0
-static tree lookup_name_current_level PROTO((tree));
+static tree lookup_name_current_level PARAMS ((tree));
#endif
-static void save_decl PROTO((tree));
+static void save_decl PARAMS ((tree));
extern struct obstack permanent_obstack;
extern int in_pseudo_module;
int result_never_set;
/* forward declarations */
-static void pushdecllist PROTO((tree, int));
-static int init_nonvalue_struct PROTO((tree));
-static int init_nonvalue_array PROTO((tree));
+static void pushdecllist PARAMS ((tree, int));
+static int init_nonvalue_struct PARAMS ((tree));
+static int init_nonvalue_array PARAMS ((tree));
+static void set_nesting_level PARAMS ((tree, int));
+static tree make_chill_variants PARAMS ((tree, tree, tree));
+static tree fix_identifier PARAMS ((tree));
+static void proclaim_decl PARAMS ((tree, int));
+static tree maybe_acons PARAMS ((tree, tree));
+static void push_scope_decls PARAMS ((int));
+static void pop_scope_decls PARAMS ((tree, tree));
+static tree build_implied_names PARAMS ((tree));
+static void bind_sub_modules PARAMS ((int));
+static void layout_array_type PARAMS ((tree));
+static void do_based_decl PARAMS ((tree, tree, tree));
+static void handle_one_level PARAMS ((tree, tree));
int current_nesting_level = BUILTIN_NESTING_LEVEL;
int current_module_nesting_level = 0;
/* ??? 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.
#define WCHAR_TYPE "int"
#endif
\f
-/* a node which has tree code ERROR_MARK, and whose type is itself.
- All erroneous expressions are replaced with this node. All functions
- that accept nodes as arguments should avoid generating error messages
- if this node is one of the arguments, since it is undesirable to get
- multiple error messages from one error in the input. */
-
-tree error_mark_node;
-
-/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */
-
-tree short_integer_type_node;
-tree integer_type_node;
-tree long_integer_type_node;
-tree long_long_integer_type_node;
-
-tree short_unsigned_type_node;
-tree unsigned_type_node;
-tree long_unsigned_type_node;
-tree long_long_unsigned_type_node;
-
-tree ptrdiff_type_node;
-
-tree unsigned_char_type_node;
-tree signed_char_type_node;
-tree char_type_node;
tree wchar_type_node;
tree signed_wchar_type_node;
tree unsigned_wchar_type_node;
-tree float_type_node;
-tree double_type_node;
-tree long_double_type_node;
-
-tree complex_integer_type_node;
-tree complex_float_type_node;
-tree complex_double_type_node;
-tree complex_long_double_type_node;
-
-tree intQI_type_node;
-tree intHI_type_node;
-tree intSI_type_node;
-tree intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-tree intTI_type_node;
-#endif
-
-tree unsigned_intQI_type_node;
-tree unsigned_intHI_type_node;
-tree unsigned_intSI_type_node;
-tree unsigned_intDI_type_node;
-#if HOST_BITS_PER_WIDE_INT >= 64
-tree unsigned_intTI_type_node;
-#endif
-
-/* a VOID_TYPE node. */
-
-tree void_type_node;
tree void_list_node;
-/* Nodes for types `void *' and `const void *'. */
-tree ptr_type_node, const_ptr_type_node;
-
/* type of initializer structure, which points to
a module's module-level code, and to the next
such structure. */
tree default_function_type;
-#if 0
-/* function types `double (double)' and `double (double, double)', etc. */
-
-tree double_ftype_double, double_ftype_double_double;
-tree int_ftype_int, long_ftype_long;
-
-/* Function type `void (void *, void *, int)' and similar ones */
-
-tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int, void_ftype_ptr_int_int;
-
-/* Function type `char *(char *, char *)' and similar ones */
-tree string_ftype_ptr_ptr, int_ftype_string_string;
-
-/* Function type `int (const void *, const void *, size_t)' */
-tree int_ftype_cptr_cptr_sizet;
-#endif
-
-char **boolean_code_name;
-
-/* Two expressions that are constants with value zero.
- The first is of type `int', the second of type `void *'. */
-
-tree integer_zero_node;
-tree null_pointer_node;
-
-/* A node for the integer constant 1. */
-tree integer_one_node;
-
-/* A node for the integer constant -1. */
-tree integer_minus_one_node;
+const char **boolean_code_name;
/* Nodes for boolean constants TRUE and FALSE. */
tree boolean_true_node, boolean_false_node;
static int c_function_varargs;
-/* The FUNCTION_DECL for the function currently being compiled,
- or 0 if between functions. */
-tree current_function_decl;
-
/* These are irrelevant for Chill, but are referenced from from c-typeck.c. */
int warn_format;
int warn_traditional;
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;
int explicit_flag_signed_bitfields = 0;
-/* Nonzero means handle `#ident' directives. 0 means ignore them. */
-
-int flag_no_ident = 0;
-
/* Nonzero means warn about implicit declarations. */
int warn_implicit;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
- 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,
-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;
flag_no_builtin = 0;
else if (!strcmp (p, "-fno-builtin"))
flag_no_builtin = 1;
- else if (!strcmp (p, "-fno-ident"))
- flag_no_ident = 1;
- else if (!strcmp (p, "-fident"))
- flag_no_ident = 0;
else if (!strcmp (p, "-ansi"))
flag_no_asm = 1, flag_no_nonansi_builtin = 1, dollars_in_ident = 0;
else if (!strcmp (p, "-Wimplicit"))
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;
\f
/* This excessive piece of code sets DECL_NESTING_LEVEL (DECL) to LEVEL. */
-void
+static void
set_nesting_level (decl, level)
tree decl;
int level;
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)
tree decl;
};
+static int label_value_cmp PARAMS ((struct tree_pair *,
+ struct tree_pair *));
/* Function to help qsort sort variant labels by value order. */
static int
return TREE_INT_CST_LOW (x->value) - TREE_INT_CST_LOW (y->value);
}
\f
-tree
+static tree
make_chill_variants (tagfields, body, variantelse)
tree tagfields;
tree body;
{
int limit;
qsort (label_value_array,
- label_index, sizeof (struct tree_pair), label_value_cmp);
+ label_index, sizeof (struct tree_pair),
+ (int (*) PARAMS ((const void *, const void *))) label_value_cmp);
limit = label_index - 1;
for (label_index = 0; label_index < limit; label_index++)
{
{
/* We use the same name as the keyword.
This makes it easy to print and change the RESULT from gdb. */
- char *result_str = (ignore_case || ! special_UC) ? "result" : "RESULT";
+ const char *result_str =
+ (ignore_case || ! special_UC) ? "result" : "RESULT";
if (pass == 2 && TREE_CODE (result_type) == ERROR_MARK)
TREE_TYPE (current_scope->remembered_decls) = result_type;
chill_result_decl = do_decl (get_identifier (result_str),
/* 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);
}
return name; /* may have generated a name */
}
/* Make a copy of the identifier NAME, replacing each '!' by '__'. */
-tree
+static tree
fix_identifier (name)
tree name;
{
char *buf = (char*)alloca (2 * IDENTIFIER_LENGTH (name) + 1);
int fixed = 0;
register char *dptr = buf;
- register char *sptr = IDENTIFIER_POINTER (name);
+ register const char *sptr = IDENTIFIER_POINTER (name);
for (; *sptr; sptr++)
{
if (*sptr == '!')
}
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;
}
}
Check redefinitions at the same level.
Suppress error messages if QUIET is true. */
-void
+static void
proclaim_decl (decl, quiet)
tree decl;
int quiet;
struct path *prev;
tree node;
};
+
+static tree find_implied_types PARAMS ((tree, struct path *, tree));
\f
/* Look for implied types (enumeral types) implied by TYPE (a decl or type).
Add these to list.
Use old_path to guard against cycles. */
-tree
+static tree
find_implied_types (type, old_path, list)
tree type;
struct path *old_path;
}
BLOCK_SUBBLOCKS (block) = subblocks;
- remember_end_note (block);
}
/* In each subblock, record that this is its superior. */
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;
{
tree ptr_ftype_luns_ptr_int;
tree double_ftype_double;
- extern int set_alignment;
-
/* allow 0-255 enums to occupy only a byte */
flag_short_enums = 1;
var_length_id = get_identifier (VAR_LENGTH);
var_data_id = get_identifier (VAR_DATA);
- /* This is the *C* int type. */
- integer_type_node = make_signed_type (INT_TYPE_SIZE);
+ build_common_tree_nodes (1);
if (CHILL_INT_IS_SHORT)
long_integer_type_node = integer_type_node;
else
long_integer_type_node = make_signed_type (LONG_TYPE_SIZE);
- unsigned_type_node = make_unsigned_type (INT_TYPE_SIZE);
- long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE);
- long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE);
- long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE);
-
/* `unsigned long' is the standard type for sizeof.
Note that stddef.h uses `unsigned long',
and this must agree, even of long and int are the same size. */
#ifndef SIZE_TYPE
- sizetype = long_unsigned_type_node;
+ set_sizetype (long_unsigned_type_node);
#else
{
- char *size_type_c_name = SIZE_TYPE;
+ const char *size_type_c_name = SIZE_TYPE;
if (strncmp (size_type_c_name, "long long ", 10) == 0)
- sizetype = long_long_unsigned_type_node;
+ set_sizetype (long_long_unsigned_type_node);
else if (strncmp (size_type_c_name, "long ", 5) == 0)
- sizetype = long_unsigned_type_node;
+ set_sizetype (long_unsigned_type_node);
else
- sizetype = unsigned_type_node;
+ set_sizetype (unsigned_type_node);
}
#endif
- TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype;
- TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype;
-
- error_mark_node = make_node (ERROR_MARK);
- TREE_TYPE (error_mark_node) = error_mark_node;
-
- short_integer_type_node = make_signed_type (SHORT_TYPE_SIZE);
- short_unsigned_type_node = make_unsigned_type (SHORT_TYPE_SIZE);
- signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
- unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
- intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
- intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode));
- intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode));
- intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode));
-#if HOST_BITS_PER_WIDE_INT >= 64
- intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode));
-#endif
- unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode));
- unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode));
- unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
- unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
-#if HOST_BITS_PER_WIDE_INT >= 64
- unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
-#endif
-
- float_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (float_type_node) = FLOAT_TYPE_SIZE;
pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT],
float_type_node));
- layout_type (float_type_node);
-
- double_type_node = make_node (REAL_TYPE);
- if (flag_short_double)
- TYPE_PRECISION (double_type_node) = FLOAT_TYPE_SIZE;
- else
- TYPE_PRECISION (double_type_node) = DOUBLE_TYPE_SIZE;
pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE],
double_type_node));
- layout_type (double_type_node);
-
- long_double_type_node = make_node (REAL_TYPE);
- TYPE_PRECISION (long_double_type_node) = LONG_DOUBLE_TYPE_SIZE;
- layout_type (long_double_type_node);
-
- complex_integer_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_integer_type_node) = integer_type_node;
- layout_type (complex_integer_type_node);
-
- complex_float_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_float_type_node) = float_type_node;
- layout_type (complex_float_type_node);
-
- complex_double_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_double_type_node) = double_type_node;
- layout_type (complex_double_type_node);
- complex_long_double_type_node = make_node (COMPLEX_TYPE);
- TREE_TYPE (complex_long_double_type_node) = long_double_type_node;
- layout_type (complex_long_double_type_node);
+ build_common_tree_nodes_2 (flag_short_double);
- integer_zero_node = build_int_2 (0, 0);
- TREE_TYPE (integer_zero_node) = integer_type_node;
- integer_one_node = build_int_2 (1, 0);
- TREE_TYPE (integer_one_node) = integer_type_node;
- integer_minus_one_node = build_int_2 (-1, -1);
- TREE_TYPE (integer_minus_one_node) = integer_type_node;
-
- size_zero_node = build_int_2 (0, 0);
- TREE_TYPE (size_zero_node) = sizetype;
- size_one_node = build_int_2 (1, 0);
- TREE_TYPE (size_one_node) = sizetype;
-
- void_type_node = make_node (VOID_TYPE);
pushdecl (build_decl (TYPE_DECL,
ridpointers[(int) RID_VOID], void_type_node));
- layout_type (void_type_node); /* Uses integer_zero_node */
/* 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;
-
- null_pointer_node = build_int_2 (0, 0);
- TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
- layout_type (TREE_TYPE (null_pointer_node));
+ TYPE_USER_ALIGN (void_type_node) = 0;
/* This is for wide string constants. */
wchar_type_node = short_unsigned_type_node;
bit_one_node = build (CONSTRUCTOR, bitstring_one_type_node, NULL_TREE,
build_tree_list (NULL_TREE, integer_zero_node));
- char_type_node = make_node (CHAR_TYPE);
- TYPE_PRECISION (char_type_node) = CHAR_TYPE_SIZE;
- fixup_unsigned_type (char_type_node);
pushdecl (build_decl (TYPE_DECL, ridpointers[(int)RID_CHAR],
char_type_node));
pushdecl (build_decl (TYPE_DECL, ridpointers[(int)RID_LONG],
long_integer_type_node));
- sizetype = long_integer_type_node;
+ set_sizetype (long_integer_type_node);
#if 0
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_LOCAL_VALUE (get_identifier (PTRDIFF_TYPE)));
DECL_SOURCE_LINE (temp) = 0;
initializer_type = TREE_TYPE (temp);
- bcopy (chill_tree_code_type,
- tree_code_type + (int) LAST_AND_UNUSED_TREE_CODE,
- (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
- * sizeof (char)));
- bcopy ((char *) chill_tree_code_length,
- (char *) (tree_code_length + (int) LAST_AND_UNUSED_TREE_CODE),
- (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
- * sizeof (int)));
- bcopy ((char *) chill_tree_code_name,
- (char *) (tree_code_name + (int) LAST_AND_UNUSED_TREE_CODE),
- (((int) LAST_CHILL_TREE_CODE - (int) LAST_AND_UNUSED_TREE_CODE)
- * sizeof (char *)));
- boolean_code_name = (char **) xmalloc (sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
- bzero ((char *) boolean_code_name, sizeof (char *) * (int) LAST_CHILL_TREE_CODE);
+ boolean_code_name = (const char **) xcalloc (sizeof (char *),
+ (int) LAST_CHILL_TREE_CODE);
boolean_code_name[EQ_EXPR] = "=";
boolean_code_name[NE_EXPR] = "/=";
/* These are compiler-internal function calls, not intended
to be directly called by user code */
builtin_function ("__allocate", ptr_ftype_luns_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("_allocate_global_memory", void_ftype_refptr_int_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("_allocate_memory", void_ftype_refptr_int_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__andpowerset", bool_ftype_ptr_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__bitsetpowerset", void_ftype_ptr_int_int_int_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__cardpowerset", long_ftype_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__cause_ex1", void_ftype_cptr_cptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__concatstring", ptr_ftype_ptr_ptr_int_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__continue", void_ftype_ptr_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__diffpowerset", void_ftype_ptr_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__eqpowerset", bool_ftype_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__ffsetclrpowerset", find_bit_ftype,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__flsetclrpowerset", find_bit_ftype,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__flsetpowerset", int_ftype_ptr_luns_long_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__ffsetpowerset", int_ftype_ptr_luns_long_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__inbitstring", bool_ftype_luns_ptr_luns_long_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__inpowerset", bool_ftype_luns_ptr_luns_long,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__lepowerset", bool_ftype_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__ltpowerset", bool_ftype_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
/* Currently under experimentation. */
builtin_function ("memmove", memcpy_ftype,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("memcmp", memcmp_ftype,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
/* this comes from c-decl.c (init_decl_processing) */
builtin_function ("__builtin_alloca",
tree_cons (NULL_TREE,
sizetype,
endlink)),
- BUILT_IN_ALLOCA, "alloca");
+ BUILT_IN_ALLOCA, BUILT_IN_NORMAL, "alloca");
builtin_function ("memset", ptr_ftype_ptr_int_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__notpowerset", bool_ftype_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__orpowerset", bool_ftype_ptr_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__psslice", void_ftype_ptr_int_ptr_int_int_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__pscpy", void_ftype_ptr_luns_luns_cptr_luns_luns_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("_return_memory", void_ftype_ptr_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__setbitpowerset", void_ftype_ptr_luns_long_long_bool_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__terminate", void_ftype_ptr_ptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__unhandled_ex", void_ftype_cptr_cptr_int,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
builtin_function ("__xorpowerset", bool_ftype_ptr_ptr_ptr_luns,
- NOT_BUILT_IN, NULL_PTR);
+ 0, NOT_BUILT_IN, NULL_PTR);
/* declare floating point functions */
- builtin_function ("__sin", double_ftype_double, NOT_BUILT_IN, "sin");
- builtin_function ("__cos", double_ftype_double, NOT_BUILT_IN, "cos");
- builtin_function ("__tan", double_ftype_double, NOT_BUILT_IN, "tan");
- builtin_function ("__asin", double_ftype_double, NOT_BUILT_IN, "asin");
- builtin_function ("__acos", double_ftype_double, NOT_BUILT_IN, "acos");
- builtin_function ("__atan", double_ftype_double, NOT_BUILT_IN, "atan");
- builtin_function ("__exp", double_ftype_double, NOT_BUILT_IN, "exp");
- builtin_function ("__log", double_ftype_double, NOT_BUILT_IN, "log");
- builtin_function ("__log10", double_ftype_double, NOT_BUILT_IN, "log10");
- builtin_function ("__sqrt", double_ftype_double, NOT_BUILT_IN, "sqrt");
+ builtin_function ("__sin", double_ftype_double, 0, NOT_BUILT_IN, "sin");
+ builtin_function ("__cos", double_ftype_double, 0, NOT_BUILT_IN, "cos");
+ builtin_function ("__tan", double_ftype_double, 0, NOT_BUILT_IN, "tan");
+ builtin_function ("__asin", double_ftype_double, 0, NOT_BUILT_IN, "asin");
+ builtin_function ("__acos", double_ftype_double, 0, NOT_BUILT_IN, "acos");
+ builtin_function ("__atan", double_ftype_double, 0, NOT_BUILT_IN, "atan");
+ builtin_function ("__exp", double_ftype_double, 0, NOT_BUILT_IN, "exp");
+ builtin_function ("__log", double_ftype_double, 0, NOT_BUILT_IN, "log");
+ builtin_function ("__log10", double_ftype_double, 0, NOT_BUILT_IN, "log10");
+ builtin_function ("__sqrt", double_ftype_double, 0, NOT_BUILT_IN, "sqrt");
tasking_init ();
timing_init ();
the same names. Note the lack of a leading underscore. */
builtin_function ((ignore_case || ! special_UC) ? "abs" : "ABS",
chill_predefined_function_type,
- BUILT_IN_CH_ABS, NULL_PTR);
+ BUILT_IN_CH_ABS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "abstime" : "ABSTIME",
chill_predefined_function_type,
- BUILT_IN_ABSTIME, NULL_PTR);
+ BUILT_IN_ABSTIME, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "allocate" : "ALLOCATE",
chill_predefined_function_type,
- BUILT_IN_ALLOCATE, NULL_PTR);
+ BUILT_IN_ALLOCATE, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "allocate_memory" : "ALLOCATE_MEMORY",
chill_predefined_function_type,
- BUILT_IN_ALLOCATE_MEMORY, NULL_PTR);
+ BUILT_IN_ALLOCATE_MEMORY, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "addr" : "ADDR",
chill_predefined_function_type,
- BUILT_IN_ADDR, NULL_PTR);
+ BUILT_IN_ADDR, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "allocate_global_memory" : "ALLOCATE_GLOBAL_MEMORY",
chill_predefined_function_type,
- BUILT_IN_ALLOCATE_GLOBAL_MEMORY, NULL_PTR);
+ BUILT_IN_ALLOCATE_GLOBAL_MEMORY, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "arccos" : "ARCCOS",
chill_predefined_function_type,
- BUILT_IN_ARCCOS, NULL_PTR);
+ BUILT_IN_ARCCOS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "arcsin" : "ARCSIN",
chill_predefined_function_type,
- BUILT_IN_ARCSIN, NULL_PTR);
+ BUILT_IN_ARCSIN, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "arctan" : "ARCTAN",
chill_predefined_function_type,
- BUILT_IN_ARCTAN, NULL_PTR);
+ BUILT_IN_ARCTAN, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "card" : "CARD",
chill_predefined_function_type,
- BUILT_IN_CARD, NULL_PTR);
+ BUILT_IN_CARD, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "cos" : "COS",
chill_predefined_function_type,
- BUILT_IN_CH_COS, NULL_PTR);
+ BUILT_IN_CH_COS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "days" : "DAYS",
chill_predefined_function_type,
- BUILT_IN_DAYS, NULL_PTR);
+ BUILT_IN_DAYS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "descr" : "DESCR",
chill_predefined_function_type,
- BUILT_IN_DESCR, NULL_PTR);
+ BUILT_IN_DESCR, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "getstack" : "GETSTACK",
chill_predefined_function_type,
- BUILT_IN_GETSTACK, NULL_PTR);
+ BUILT_IN_GETSTACK, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "exp" : "EXP",
chill_predefined_function_type,
- BUILT_IN_EXP, NULL_PTR);
+ BUILT_IN_EXP, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "hours" : "HOURS",
chill_predefined_function_type,
- BUILT_IN_HOURS, NULL_PTR);
+ BUILT_IN_HOURS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "inttime" : "INTTIME",
chill_predefined_function_type,
- BUILT_IN_INTTIME, NULL_PTR);
+ BUILT_IN_INTTIME, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "length" : "LENGTH",
chill_predefined_function_type,
- BUILT_IN_LENGTH, NULL_PTR);
+ BUILT_IN_LENGTH, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "log" : "LOG",
chill_predefined_function_type,
- BUILT_IN_LOG, NULL_PTR);
+ BUILT_IN_LOG, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "lower" : "LOWER",
chill_predefined_function_type,
- BUILT_IN_LOWER, NULL_PTR);
+ BUILT_IN_LOWER, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "ln" : "LN",
chill_predefined_function_type,
- BUILT_IN_LN, NULL_PTR);
+ BUILT_IN_LN, BUILT_IN_NORMAL, NULL_PTR);
/* Note: these are *not* the C integer MAX and MIN. They're
for powerset arguments. */
builtin_function ((ignore_case || ! special_UC) ? "max" : "MAX",
chill_predefined_function_type,
- BUILT_IN_MAX, NULL_PTR);
+ BUILT_IN_MAX, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "millisecs" : "MILLISECS",
chill_predefined_function_type,
- BUILT_IN_MILLISECS, NULL_PTR);
+ BUILT_IN_MILLISECS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "min" : "MIN",
chill_predefined_function_type,
- BUILT_IN_MIN, NULL_PTR);
+ BUILT_IN_MIN, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "minutes" : "MINUTES",
chill_predefined_function_type,
- BUILT_IN_MINUTES, NULL_PTR);
+ BUILT_IN_MINUTES, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "num" : "NUM",
chill_predefined_function_type,
- BUILT_IN_NUM, NULL_PTR);
+ BUILT_IN_NUM, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "pred" : "PRED",
chill_predefined_function_type,
- BUILT_IN_PRED, NULL_PTR);
+ BUILT_IN_PRED, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "return_memory" : "RETURN_MEMORY",
chill_predefined_function_type,
- BUILT_IN_RETURN_MEMORY, NULL_PTR);
+ BUILT_IN_RETURN_MEMORY, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "secs" : "SECS",
chill_predefined_function_type,
- BUILT_IN_SECS, NULL_PTR);
+ BUILT_IN_SECS, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "sin" : "SIN",
chill_predefined_function_type,
- BUILT_IN_CH_SIN, NULL_PTR);
+ BUILT_IN_CH_SIN, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "size" : "SIZE",
chill_predefined_function_type,
- BUILT_IN_SIZE, NULL_PTR);
+ BUILT_IN_SIZE, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "sqrt" : "SQRT",
chill_predefined_function_type,
- BUILT_IN_SQRT, NULL_PTR);
+ BUILT_IN_SQRT, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "succ" : "SUCC",
chill_predefined_function_type,
- BUILT_IN_SUCC, NULL_PTR);
+ BUILT_IN_SUCC, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "tan" : "TAN",
chill_predefined_function_type,
- BUILT_IN_TAN, NULL_PTR);
+ BUILT_IN_TAN, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "terminate" : "TERMINATE",
chill_predefined_function_type,
- BUILT_IN_TERMINATE, NULL_PTR);
+ BUILT_IN_TERMINATE, BUILT_IN_NORMAL, NULL_PTR);
builtin_function ((ignore_case || ! special_UC) ? "upper" : "UPPER",
chill_predefined_function_type,
- BUILT_IN_UPPER, NULL_PTR);
+ BUILT_IN_UPPER, BUILT_IN_NORMAL, NULL_PTR);
build_chill_descr_type ();
build_chill_inttime_type ();
the name to be called if we can't opencode the function. */
tree
-builtin_function (name, type, function_code, library_name)
- char *name;
+builtin_function (name, type, function_code, class, library_name)
+ const char *name;
tree type;
- enum built_in_function function_code;
- char *library_name;
+ int function_code;
+ enum built_in_class class;
+ const char *library_name;
{
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);
pushdecl (decl);
- if (function_code != NOT_BUILT_IN)
- {
- DECL_BUILT_IN (decl) = 1;
- DECL_SET_FUNCTION_CODE (decl, function_code);
- }
+ DECL_BUILT_IN_CLASS (decl) = class;
+ DECL_FUNCTION_CODE (decl) = function_code;
return decl;
}
{
register tree x;
- /* Install struct as DECL_CONTEXT of each field decl.
- Also process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
- Store 0 there, except for ": 0" fields (so we can find them
- and delete them, below). */
-
+ /* Install struct as DECL_CONTEXT of each field decl. */
for (x = fieldlist; x; x = TREE_CHAIN (x))
- {
- DECL_CONTEXT (x) = t;
- DECL_FIELD_SIZE (x) = 0;
- }
+ DECL_CONTEXT (x) = t;
TYPE_FIELDS (t) = fieldlist;
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);
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);
pushdecllist (alias, 0);
}
-void
+static void
do_based_decl (name, mode, base_var)
tree name, mode, base_var;
{
tree
build_chill_exception_decl (name)
- char *name;
+ const char *name;
{
tree decl, ex_name, ex_init, ex_type;
int name_len = strlen (name);
and fill in the module's function's address. */
extern tree initializer_type;
- char *fname_str = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
+ const char *fname_str = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
char *init_entry_name = (char *)xmalloc ((unsigned)(strlen (fname_str) + 20));
tree init_entry_id;
tree init_entry_decl;