c-common.h: New file.

* c-common.h: New file.
	* c-common.c (permanent_obstack): Delete unused declaration.
	(c_global_trees): New array.
	(c_common_nodes_and_builtins): New function; split off common code
	from init_decl_processing in both c-decl.c and cp/decl.c.
	* c-tree.h: Delete lots of declarations of tree nodes; replaced by
	c_global_trees and accessor macros defined in c-common.h.
	Include c-common.h.
	* c-decl.c: Delete definitions for tree nodes that were replaced by
	c_global_trees.
	(init_decl_processing): Build void_list_node.
	Call c_common_nodes_and_builtins; delete code to generate the common
	builtins here.

	* objc/objc-act.c (build_module_descriptor): Rename variable
	void_list_node to avoid clash with c-common.h.

	* cp/cp-tree.h: Delete lots of declarations of tree nodes; replaced by
	c_global_trees and accessor macros defined in c-common.h.
	(cp_tree_index): New enumeration.
	(cp_global_trees): Declare new array.  Add accessor macros for it, and
	delete declarations of tree nodes replaced by it.
	(builtin_function): Delete macro, add declaration for new function.
	Include c-common.h.
	* cp/decl.c: Delete definitions for tree nodes that were replaced by
	cp_global_trees and c_global_trees.
	(init_decl_processing): Call c_common_nodes_and_builtins; delete code
	to generate the common builtins here.
	(builtin_function): New function.
	* cp/decl2.c (abort_fndecl): Delete declaration.
	* cp/except.c (expand_builtin_return_address): Delete declaration.
	(builtin_return_address_fndecl): Delete variable.
	(const_ptr_type_node): Delete declaration.
	* cp/lex.c (cons_up_default_function): Delete declaration of
	void_list_node.
	* cp/parse.y (void_list_node): Delete declaration.
	* cp/rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type):
	Delete variables.
	(const_string_type_node): Delete declaration.
	* cp/search.c (abort_fndecl): Delete declaration.

	* Makefile.in: Update dependencies.
	* objc/Make-lang.in: Likewise.
	* cp/Makefile.in: Likewise.

From-SVN: r28188
This commit is contained in:
Bernd Schmidt 1999-07-20 10:41:10 +00:00 committed by Bernd Schmidt
parent 3791a1dc29
commit 7f4edbcba6
19 changed files with 1656 additions and 1862 deletions

View File

@ -1,3 +1,24 @@
Tue Jul 20 11:24:19 1999 Bernd Schmidt <bernds@cygnus.co.uk>
* c-common.h: New file.
* c-common.c (permanent_obstack): Delete unused declaration.
(c_global_trees): New array.
(c_common_nodes_and_builtins): New function; split off common code
from init_decl_processing in both c-decl.c and cp/decl.c.
* c-tree.h: Delete lots of declarations of tree nodes; replaced by
c_global_trees and accessor macros defined in c-common.h.
Include c-common.h.
* c-decl.c: Delete definitions for tree nodes that were replaced by
c_global_trees.
(init_decl_processing): Build void_list_node.
Call c_common_nodes_and_builtins; delete code to generate the common
builtins here.
* objc/objc-act.c (build_module_descriptor): Rename variable
void_list_node to avoid clash with c-common.h.
* Makefile.in: Update dependencies.
* objc/Make-lang.in: Likewise.
Mon Jul 19 14:22:18 1999 Mark P. Mitchell <mark@codesourcery.com>
* config/mips/iris6gld.h (MAKE_DECL_ONE_ONLY): Define.

View File

@ -1319,7 +1319,7 @@ s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
# C language specific files.
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
$(srcdir)/c-parse.h c-tree.h input.h flags.h system.h toplev.h
$(srcdir)/c-parse.h c-tree.h c-common.h input.h flags.h system.h toplev.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
@ -1336,22 +1336,22 @@ $(srcdir)/c-gperf.h: c-parse.gperf
-k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
$(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \
output.h toplev.h
c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
intl.h output.h $(EXPR_H) $(RTL_H) toplev.h
c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \
output.h
c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
c-lex.h flags.h output.h toplev.h
c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
flags.h intl.h output.h $(EXPR_H) $(RTL_H) toplev.h
c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-common.h \
c-lex.h toplev.h output.h
c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
$(srcdir)/c-parse.h input.h intl.h flags.h $(srcdir)/c-gperf.h c-pragma.h \
toplev.h output.h mbchar.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
toplev.h
c-common.h $(srcdir)/c-parse.h $(srcdir)/c-gperf.h c-pragma.h input.h \
intl.h flags.h toplev.h output.h mbchar.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h \
c-common.h flags.h toplev.h
c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \
function.h defaults.h c-pragma.h toplev.h
c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
flags.h toplev.h $(EXPR_H)
c-common.h flags.h toplev.h $(EXPR_H)
mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h
graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
hard-reg-set.h $(BASIC_BLOCK_H)
@ -1401,7 +1401,7 @@ s-under: $(GCC_PASSES)
# A file used by all variants of C.
c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
flags.h toplev.h output.h c-pragma.h $(RTL_H)
c-common.h flags.h toplev.h output.h c-pragma.h $(RTL_H)
# Language-independent files.

View File

@ -45,7 +45,97 @@ static enum cpp_token cpp_token;
#endif
#endif
extern struct obstack permanent_obstack;
/* The following symbols are subsumed in the c_global_trees array, and
listed here individually for documentation purposes.
INTEGER_TYPE and REAL_TYPE nodes for the standard data types.
tree short_integer_type_node;
tree long_integer_type_node;
tree long_long_integer_type_node;
tree short_unsigned_type_node;
tree long_unsigned_type_node;
tree long_long_unsigned_type_node;
tree boolean_type_node;
tree boolean_false_node;
tree boolean_true_node;
tree ptrdiff_type_node;
tree unsigned_char_type_node;
tree signed_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;
tree intTI_type_node;
tree unsigned_intQI_type_node;
tree unsigned_intHI_type_node;
tree unsigned_intSI_type_node;
tree unsigned_intDI_type_node;
tree unsigned_intTI_type_node;
tree widest_integer_literal_type_node;
tree widest_unsigned_literal_type_node;
Nodes for types `void *' and `const void *'.
tree ptr_type_node, const_ptr_type_node;
Nodes for types `char *' and `const char *'.
tree string_type_node, const_string_type_node;
Type `char[SOMENUMBER]'.
Used when an array of char is needed and the size is irrelevant.
tree char_array_type_node;
Type `int[SOMENUMBER]' or something like it.
Used when an array of int needed and the size is irrelevant.
tree int_array_type_node;
Type `wchar_t[SOMENUMBER]' or something like it.
Used when a wide string literal is created.
tree wchar_array_type_node;
Type `int ()' -- used for implicit declaration of functions.
tree default_function_type;
Function types `int (int)', etc.
tree int_ftype_int;
tree void_ftype;
tree void_ftype_ptr;
tree int_ftype_int;
tree ptr_ftype_sizetype;
A VOID_TYPE node, packaged in a TREE_LIST.
tree void_list_node;
*/
tree c_global_trees[CTI_MAX];
/* Nonzero means the expression being parsed will never be evaluated.
This is a count, since unevaluated expressions can nest. */
@ -3319,3 +3409,306 @@ c_get_alias_set (t)
return TYPE_ALIAS_SET (type);
}
/* Build tree nodes and builtin functions common to both C and C++ language
frontends.
CPLUS_MODE is nonzero if we are called from the C++ frontend, we generate
some stricter prototypes in that case.
NO_BUILTINS and NO_NONANSI_BUILTINS contain the respective values of
the language frontend flags flag_no_builtin and
flag_no_nonansi_builtin. */
void
c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
int cplus_mode, no_builtins, no_nonansi_builtins;
{
tree temp;
tree memcpy_ftype, memset_ftype, strlen_ftype;
tree endlink, int_endlink, double_endlink, unsigned_endlink;
tree sizetype_endlink;
tree ptr_ftype, ptr_ftype_unsigned;
tree void_ftype_any, void_ftype_int;
tree double_ftype_double, double_ftype_double_double;
tree float_ftype_float, ldouble_ftype_ldouble;
tree int_ftype_cptr_cptr_sizet;
tree int_ftype_string_string, string_ftype_ptr_ptr;
tree long_ftype_long;
/* Either char* or void*. */
tree traditional_ptr_type_node;
endlink = void_list_node;
int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
double_endlink = tree_cons (NULL_TREE, double_type_node, endlink);
unsigned_endlink = tree_cons (NULL_TREE, unsigned_type_node, endlink);
ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink);
sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
/* We realloc here because sizetype could be int or unsigned. S'ok. */
ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);
void_ftype_any = build_function_type (void_type_node, NULL_TREE);
void_ftype = build_function_type (void_type_node, endlink);
void_ftype_int = build_function_type (void_type_node, int_endlink);
void_ftype_ptr
= build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node, endlink));
float_ftype_float
= build_function_type (float_type_node,
tree_cons (NULL_TREE, float_type_node, endlink));
double_ftype_double
= build_function_type (double_type_node, double_endlink);
ldouble_ftype_ldouble
= build_function_type (long_double_type_node,
tree_cons (NULL_TREE, long_double_type_node,
endlink));
double_ftype_double_double
= build_function_type (double_type_node,
tree_cons (NULL_TREE, double_type_node,
double_endlink));
int_ftype_int
= build_function_type (integer_type_node, int_endlink);
long_ftype_long
= build_function_type (long_integer_type_node,
tree_cons (NULL_TREE, long_integer_type_node,
endlink));
int_ftype_cptr_cptr_sizet
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
/* Prototype for strcpy. */
string_ftype_ptr_ptr
= build_function_type (string_type_node,
tree_cons (NULL_TREE, string_type_node,
tree_cons (NULL_TREE,
const_string_type_node,
endlink)));
/* Prototype for strcmp. */
int_ftype_string_string
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_string_type_node,
tree_cons (NULL_TREE,
const_string_type_node,
endlink)));
/* Prototype for strlen. */
strlen_ftype
= build_function_type ((flag_traditional && ! cplus_mode
? integer_type_node : sizetype),
tree_cons (NULL_TREE, const_string_type_node,
endlink));
traditional_ptr_type_node = (flag_traditional && ! cplus_mode
? string_type_node : ptr_type_node);
/* Prototype for memcpy. */
memcpy_ftype
= build_function_type (traditional_ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
sizetype_endlink)));
/* Prototype for memset. */
memset_ftype
= build_function_type (traditional_ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
builtin_function ("__builtin_constant_p", default_function_type,
BUILT_IN_CONSTANT_P, NULL_PTR);
builtin_function ("__builtin_return_address", ptr_ftype_unsigned,
BUILT_IN_RETURN_ADDRESS, NULL_PTR);
builtin_function ("__builtin_frame_address", ptr_ftype_unsigned,
BUILT_IN_FRAME_ADDRESS, NULL_PTR);
builtin_function ("__builtin_alloca", ptr_ftype_sizetype,
BUILT_IN_ALLOCA, "alloca");
builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Define alloca, ffs as builtins.
Declare _exit just to mark it as volatile. */
if (! no_builtins && ! no_nonansi_builtins)
{
temp = builtin_function ("alloca", ptr_ftype_sizetype,
BUILT_IN_ALLOCA, NULL_PTR);
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("_exit", void_ftype_int,
NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
}
builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS,
NULL_PTR);
builtin_function ("__builtin_saveregs", ptr_ftype, BUILT_IN_SAVEREGS,
NULL_PTR);
builtin_function ("__builtin_classify_type", default_function_type,
BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
builtin_function ("__builtin_next_arg", ptr_ftype, BUILT_IN_NEXT_ARG,
NULL_PTR);
builtin_function ("__builtin_args_info", int_ftype_int, BUILT_IN_ARGS_INFO,
NULL_PTR);
builtin_function ("__builtin_setjmp",
build_function_type (integer_type_node,
tree_cons (NULL_TREE, ptr_type_node,
endlink)),
BUILT_IN_SETJMP, NULL_PTR);
builtin_function ("__builtin_longjmp",
build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink))),
BUILT_IN_LONGJMP, NULL_PTR);
builtin_function ("__builtin_trap", void_ftype, BUILT_IN_TRAP, NULL_PTR);
/* Untyped call and return. */
builtin_function ("__builtin_apply_args", ptr_ftype,
BUILT_IN_APPLY_ARGS, NULL_PTR);
temp = tree_cons (NULL_TREE,
build_pointer_type (build_function_type (void_type_node,
NULL_TREE)),
tree_cons (NULL_TREE,
ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink)));
builtin_function ("__builtin_apply",
build_function_type (ptr_type_node, temp),
BUILT_IN_APPLY, NULL_PTR);
builtin_function ("__builtin_return", void_ftype_ptr,
BUILT_IN_RETURN, NULL_PTR);
/* Currently under experimentation. */
builtin_function ("__builtin_memcpy", memcpy_ftype, BUILT_IN_MEMCPY,
"memcpy");
builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet,
BUILT_IN_MEMCMP, "memcmp");
builtin_function ("__builtin_memset", memset_ftype, BUILT_IN_MEMSET,
"memset");
builtin_function ("__builtin_strcmp", int_ftype_string_string,
BUILT_IN_STRCMP, "strcmp");
builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
BUILT_IN_STRCPY, "strcpy");
builtin_function ("__builtin_strlen", strlen_ftype,
BUILT_IN_STRLEN, "strlen");
builtin_function ("__builtin_sqrtf", float_ftype_float,
BUILT_IN_FSQRT, "sqrtf");
builtin_function ("__builtin_fsqrt", double_ftype_double,
BUILT_IN_FSQRT, "sqrt");
builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
BUILT_IN_FSQRT, "sqrtl");
builtin_function ("__builtin_sinf", float_ftype_float,
BUILT_IN_SIN, "sinf");
builtin_function ("__builtin_sin", double_ftype_double,
BUILT_IN_SIN, "sin");
builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
BUILT_IN_SIN, "sinl");
builtin_function ("__builtin_cosf", float_ftype_float,
BUILT_IN_COS, "cosf");
builtin_function ("__builtin_cos", double_ftype_double,
BUILT_IN_COS, "cos");
builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
BUILT_IN_COS, "cosl");
if (! no_builtins)
{
builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR);
builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
NULL_PTR);
builtin_function ("memset", memset_ftype, BUILT_IN_MEMSET, NULL_PTR);
builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP,
NULL_PTR);
builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
NULL_PTR);
builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR);
builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT,
NULL_PTR);
builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR);
builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR);
builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR);
builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR);
/* Declare these functions volatile
to avoid spurious "control drops through" warnings. */
temp = builtin_function ("abort", cplus_mode ? void_ftype : void_ftype_any,
NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
#if 0 /* ??? The C++ frontend used to do this. */
/* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
them... */
DECL_BUILT_IN_NONANSI (temp) = 1;
#endif
temp = builtin_function ("exit",
cplus_mode ? void_ftype_int : void_ftype_any,
NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
#if 0 /* ??? The C++ frontend used to do this. */
/* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
them... */
DECL_BUILT_IN_NONANSI (temp) = 1;
#endif
}
#if 0
/* Support for these has not been written in either expand_builtin
or build_function_call. */
builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR);
builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR);
builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR,
NULL_PTR);
builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL,
NULL_PTR);
builtin_function ("__builtin_fmod", double_ftype_double_double,
BUILT_IN_FMOD, NULL_PTR);
builtin_function ("__builtin_frem", double_ftype_double_double,
BUILT_IN_FREM, NULL_PTR);
builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP,
NULL_PTR);
builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN,
NULL_PTR);
#endif
}

192
gcc/c-common.h Normal file
View File

@ -0,0 +1,192 @@
/* Definitions for c-common.c.
Copyright (C) 1987, 93, 94, 95, 97, 98, 1999 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.
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,
Boston, MA 02111-1307, USA. */
/* Standard named or nameless data types of the C compiler. */
enum c_tree_index
{
CTI_INTQI_TYPE,
CTI_INTHI_TYPE,
CTI_INTSI_TYPE,
CTI_INTDI_TYPE,
CTI_INTTI_TYPE,
CTI_UINTQI_TYPE,
CTI_UINTHI_TYPE,
CTI_UINTSI_TYPE,
CTI_UINTDI_TYPE,
CTI_UINTTI_TYPE,
CTI_SIGNED_CHAR_TYPE,
CTI_UNSIGNED_CHAR_TYPE,
CTI_WCHAR_TYPE,
CTI_SIGNED_WCHAR_TYPE,
CTI_UNSIGNED_WCHAR_TYPE,
CTI_SHORT_INTEGER_TYPE,
CTI_SHORT_UNSIGNED_TYPE,
CTI_LONG_INTEGER_TYPE,
CTI_LONG_UNSIGNED_TYPE,
CTI_LONG_LONG_INTEGER_TYPE,
CTI_LONG_LONG_UNSIGNED_TYPE,
CTI_WIDEST_INT_LIT_TYPE,
CTI_WIDEST_UINT_LIT_TYPE,
CTI_COMPLEX_INTEGER_TYPE,
CTI_COMPLEX_FLOAT_TYPE,
CTI_COMPLEX_DOUBLE_TYPE,
CTI_COMPLEX_LONG_DOUBLE_TYPE,
CTI_FLOAT_TYPE,
CTI_DOUBLE_TYPE,
CTI_LONG_DOUBLE_TYPE,
CTI_CHAR_ARRAY_TYPE,
CTI_WCHAR_ARRAY_TYPE,
CTI_INT_ARRAY_TYPE,
CTI_STRING_TYPE,
CTI_CONST_STRING_TYPE,
CTI_PTR_TYPE,
CTI_CONST_PTR_TYPE,
CTI_PTRDIFF_TYPE,
CTI_BOOLEAN_TYPE,
CTI_BOOLEAN_TRUE,
CTI_BOOLEAN_FALSE,
CTI_DEFAULT_FUNCTION_TYPE,
CTI_VOID_LIST,
CTI_VOID_FTYPE,
CTI_VOID_FTYPE_PTR,
CTI_INT_FTYPE_INT,
CTI_PTR_FTYPE_SIZETYPE,
CTI_MAX
};
extern tree c_global_trees[CTI_MAX];
#define intQI_type_node c_global_trees[CTI_INTQI_TYPE]
#define intHI_type_node c_global_trees[CTI_INTHI_TYPE]
#define intSI_type_node c_global_trees[CTI_INTSI_TYPE]
#define intDI_type_node c_global_trees[CTI_INTDI_TYPE]
#if HOST_BITS_PER_WIDE_INT >= 64
#define intTI_type_node c_global_trees[CTI_INTTI_TYPE]
#endif
#define unsigned_intQI_type_node c_global_trees[CTI_UINTQI_TYPE]
#define unsigned_intHI_type_node c_global_trees[CTI_UINTHI_TYPE]
#define unsigned_intSI_type_node c_global_trees[CTI_UINTSI_TYPE]
#define unsigned_intDI_type_node c_global_trees[CTI_UINTDI_TYPE]
#if HOST_BITS_PER_WIDE_INT >= 64
#define unsigned_intTI_type_node c_global_trees[CTI_UINTTI_TYPE]
#endif
#define signed_char_type_node c_global_trees[CTI_SIGNED_CHAR_TYPE]
#define unsigned_char_type_node c_global_trees[CTI_UNSIGNED_CHAR_TYPE]
#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
#define short_integer_type_node c_global_trees[CTI_SHORT_INTEGER_TYPE]
#define short_unsigned_type_node c_global_trees[CTI_SHORT_UNSIGNED_TYPE]
#define long_integer_type_node c_global_trees[CTI_LONG_INTEGER_TYPE]
#define long_unsigned_type_node c_global_trees[CTI_LONG_UNSIGNED_TYPE]
#define long_long_integer_type_node c_global_trees[CTI_LONG_LONG_INTEGER_TYPE]
#define long_long_unsigned_type_node c_global_trees[CTI_LONG_LONG_UNSIGNED_TYPE]
#define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE]
#define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE]
#define float_type_node c_global_trees[CTI_FLOAT_TYPE]
#define double_type_node c_global_trees[CTI_DOUBLE_TYPE]
#define long_double_type_node c_global_trees[CTI_LONG_DOUBLE_TYPE]
#define complex_integer_type_node c_global_trees[CTI_COMPLEX_INTEGER_TYPE]
#define complex_float_type_node c_global_trees[CTI_COMPLEX_FLOAT_TYPE]
#define complex_double_type_node c_global_trees[CTI_COMPLEX_DOUBLE_TYPE]
#define complex_long_double_type_node c_global_trees[CTI_COMPLEX_LONG_DOUBLE_TYPE]
#define boolean_type_node c_global_trees[CTI_BOOLEAN_TYPE]
#define boolean_true_node c_global_trees[CTI_BOOLEAN_TRUE]
#define boolean_false_node c_global_trees[CTI_BOOLEAN_FALSE]
#define ptr_type_node c_global_trees[CTI_PTR_TYPE]
#define const_ptr_type_node c_global_trees[CTI_CONST_PTR_TYPE]
#define ptrdiff_type_node c_global_trees[CTI_PTRDIFF_TYPE]
#define char_array_type_node c_global_trees[CTI_CHAR_ARRAY_TYPE]
#define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE]
#define int_array_type_node c_global_trees[CTI_INT_ARRAY_TYPE]
#define string_type_node c_global_trees[CTI_STRING_TYPE]
#define const_string_type_node c_global_trees[CTI_CONST_STRING_TYPE]
#define default_function_type c_global_trees[CTI_DEFAULT_FUNCTION_TYPE]
#define void_list_node c_global_trees[CTI_VOID_LIST]
#define void_ftype c_global_trees[CTI_VOID_FTYPE]
#define void_ftype_ptr c_global_trees[CTI_VOID_FTYPE_PTR]
#define int_ftype_int c_global_trees[CTI_INT_FTYPE_INT]
#define ptr_ftype_sizetype c_global_trees[CTI_PTR_FTYPE_SIZETYPE]
extern void declare_function_name PROTO((void));
extern void decl_attributes PROTO((tree, tree, tree));
extern void init_function_format_info PROTO((void));
extern void check_function_format PROTO((tree, tree, tree));
extern void c_apply_type_quals_to_decl PROTO((int, tree));
extern int c_get_alias_set PROTO((tree));
/* Print an error message for invalid operands to arith operation CODE.
NOP_EXPR is used as a special case (see truthvalue_conversion). */
extern void binary_op_error PROTO((enum tree_code));
extern void c_expand_expr_stmt PROTO((tree));
extern void c_expand_start_cond PROTO((tree, int, int));
extern void c_expand_start_else PROTO((void));
extern void c_expand_end_cond PROTO((void));
/* Validate the expression after `case' and apply default promotions. */
extern tree check_case_value PROTO((tree));
/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
extern tree combine_strings PROTO((tree));
extern void constant_expression_warning PROTO((tree));
extern tree convert_and_check PROTO((tree, tree));
extern void overflow_warning PROTO((tree));
extern void unsigned_conversion_warning PROTO((tree, tree));
/* Read the rest of the current #-directive line. */
#if USE_CPPLIB
extern char *get_directive_line PROTO((void));
#define GET_DIRECTIVE_LINE() get_directive_line ()
#else
extern char *get_directive_line PROTO((FILE *));
#define GET_DIRECTIVE_LINE() get_directive_line (finput)
#endif
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
and, if so, perhaps change them both back to their original type. */
extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
or validate its data type for an `if' or `while' statement or ?..: exp. */
extern tree truthvalue_conversion PROTO((tree));
extern tree type_for_mode PROTO((enum machine_mode, int));
extern tree type_for_size PROTO((unsigned, int));
/* Declare a predefined function. Return the declaration. This function is
provided by each language frontend. */
extern tree builtin_function PROTO((const char *, tree, enum built_in_function, const char *));
/* Build tree nodes and builtin functions common to both C and C++ language
frontends. */
extern void c_common_nodes_and_builtins PROTO((int, int, int));

View File

@ -111,111 +111,13 @@ enum decl_context
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;
/* These are used for integer literals that are larger than
a long long. The largest integer literals we can handle
are the width of two HOST_WIDE_INTs. If two HOST_WIDE_INTs
are not larger than the target's long long, then these
will never be used. */
tree widest_integer_literal_type_node;
tree widest_unsigned_literal_type_node;
tree boolean_type_node;
tree boolean_false_node;
tree boolean_true_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. */
/* These can't be part of the above array, since they are declared
individually in tree.h, and used by the debug output routines. */
tree void_type_node;
/* Nodes for types `void *' and `const void *'. */
tree ptr_type_node, const_ptr_type_node;
/* Nodes for types `char *' and `const char *'. */
tree string_type_node, const_string_type_node;
/* Type `char[SOMENUMBER]'.
Used when an array of char is needed and the size is irrelevant. */
tree char_array_type_node;
/* Type `int[SOMENUMBER]' or something like it.
Used when an array of int needed and the size is irrelevant. */
tree int_array_type_node;
/* Type `wchar_t[SOMENUMBER]' or something like it.
Used when a wide string literal is created. */
tree wchar_array_type_node;
/* type `int ()' -- used for implicit declaration of functions. */
tree default_function_type;
/* function types `double (double)' and `double (double, double)', etc. */
tree double_ftype_double, double_ftype_double_double;
tree int_ftype_int, long_ftype_long;
tree float_ftype_float;
tree ldouble_ftype_ldouble;
/* 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;
tree char_type_node;
tree integer_type_node;
tree unsigned_type_node;
/* Two expressions that are constants with value zero.
The first is of type `int', the second of type `void *'. */
@ -3027,13 +2929,8 @@ void
init_decl_processing ()
{
register tree endlink;
/* Either char* or void*. */
tree traditional_ptr_type_node;
/* Data types of memcpy and strlen. */
tree memcpy_ftype, memset_ftype, strlen_ftype;
tree void_ftype_any, ptr_ftype_void, ptr_ftype_ptr;
tree ptr_ftype_void, ptr_ftype_ptr;
int wchar_type_size;
tree temp;
tree array_domain_type;
current_function_decl = NULL;
@ -3255,6 +3152,8 @@ init_decl_processing ()
wchar_array_type_node
= build_array_type (wchar_type_node, array_domain_type);
void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
default_function_type
= build_function_type (integer_type_node, NULL_TREE);
@ -3262,123 +3161,14 @@ init_decl_processing ()
const_ptr_type_node
= build_pointer_type (build_type_variant (void_type_node, 1, 0));
endlink = tree_cons (NULL_TREE, void_type_node, NULL_TREE);
void_ftype_any
= build_function_type (void_type_node, NULL_TREE);
float_ftype_float
= build_function_type (float_type_node,
tree_cons (NULL_TREE, float_type_node, endlink));
double_ftype_double
= build_function_type (double_type_node,
tree_cons (NULL_TREE, double_type_node, endlink));
ldouble_ftype_ldouble
= build_function_type (long_double_type_node,
tree_cons (NULL_TREE, long_double_type_node,
endlink));
double_ftype_double_double
= build_function_type (double_type_node,
tree_cons (NULL_TREE, double_type_node,
tree_cons (NULL_TREE,
double_type_node, endlink)));
int_ftype_int
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, integer_type_node, endlink));
long_ftype_long
= build_function_type (long_integer_type_node,
tree_cons (NULL_TREE,
long_integer_type_node, endlink));
void_ftype_ptr_ptr_int
= build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink))));
int_ftype_cptr_cptr_sizet
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
void_ftype_ptr_int_int
= build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink))));
string_ftype_ptr_ptr /* strcpy prototype */
= build_function_type (string_type_node,
tree_cons (NULL_TREE, string_type_node,
tree_cons (NULL_TREE,
const_string_type_node,
endlink)));
int_ftype_string_string /* strcmp prototype */
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_string_type_node,
tree_cons (NULL_TREE,
const_string_type_node,
endlink)));
strlen_ftype /* strlen prototype */
= build_function_type (flag_traditional ? integer_type_node : sizetype,
tree_cons (NULL_TREE, const_string_type_node,
endlink));
traditional_ptr_type_node
= (flag_traditional ? string_type_node : ptr_type_node);
memcpy_ftype /* memcpy prototype */
= build_function_type (traditional_ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
memset_ftype /* memset prototype */
= build_function_type (traditional_ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, integer_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
c_common_nodes_and_builtins (0, flag_no_builtin, flag_no_nonansi_builtin);
endlink = void_list_node;
ptr_ftype_void = build_function_type (ptr_type_node, endlink);
ptr_ftype_ptr
= build_function_type (ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node, endlink));
builtin_function ("__builtin_constant_p", default_function_type,
BUILT_IN_CONSTANT_P, NULL_PTR);
builtin_function ("__builtin_return_address",
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
unsigned_type_node,
endlink)),
BUILT_IN_RETURN_ADDRESS, NULL_PTR);
builtin_function ("__builtin_frame_address",
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
unsigned_type_node,
endlink)),
BUILT_IN_FRAME_ADDRESS, NULL_PTR);
builtin_function ("__builtin_aggregate_incoming_address",
build_function_type (ptr_type_node, NULL_TREE),
BUILT_IN_AGGREGATE_INCOMING_ADDRESS, NULL_PTR);
@ -3409,204 +3199,6 @@ init_decl_processing ()
endlink)))),
BUILT_IN_EH_RETURN, NULL_PTR);
builtin_function ("__builtin_alloca",
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink)),
BUILT_IN_ALLOCA, "alloca");
builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Define alloca, ffs as builtins.
Declare _exit just to mark it as volatile. */
if (! flag_no_builtin && !flag_no_nonansi_builtin)
{
temp = builtin_function ("alloca",
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink)),
BUILT_IN_ALLOCA, NULL_PTR);
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("_exit", void_ftype_any, NOT_BUILT_IN,
NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
}
builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_labs", long_ftype_long, BUILT_IN_LABS,
NULL_PTR);
builtin_function ("__builtin_saveregs",
build_function_type (ptr_type_node, NULL_TREE),
BUILT_IN_SAVEREGS, NULL_PTR);
/* EXPAND_BUILTIN_VARARGS is obsolete. */
#if 0
builtin_function ("__builtin_varargs",
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink)),
BUILT_IN_VARARGS, NULL_PTR);
#endif
builtin_function ("__builtin_classify_type", default_function_type,
BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
builtin_function ("__builtin_next_arg",
build_function_type (ptr_type_node, NULL_TREE),
BUILT_IN_NEXT_ARG, NULL_PTR);
builtin_function ("__builtin_args_info",
build_function_type (integer_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink)),
BUILT_IN_ARGS_INFO, NULL_PTR);
/* Untyped call and return. */
builtin_function ("__builtin_apply_args",
build_function_type (ptr_type_node, NULL_TREE),
BUILT_IN_APPLY_ARGS, NULL_PTR);
temp = tree_cons (NULL_TREE,
build_pointer_type (build_function_type (void_type_node,
NULL_TREE)),
tree_cons (NULL_TREE,
ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink)));
builtin_function ("__builtin_apply",
build_function_type (ptr_type_node, temp),
BUILT_IN_APPLY, NULL_PTR);
builtin_function ("__builtin_return",
build_function_type (void_type_node,
tree_cons (NULL_TREE,
ptr_type_node,
endlink)),
BUILT_IN_RETURN, NULL_PTR);
/* Currently under experimentation. */
builtin_function ("__builtin_memcpy", memcpy_ftype,
BUILT_IN_MEMCPY, "memcpy");
builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet,
BUILT_IN_MEMCMP, "memcmp");
builtin_function ("__builtin_memset", memset_ftype,
BUILT_IN_MEMSET, "memset");
builtin_function ("__builtin_strcmp", int_ftype_string_string,
BUILT_IN_STRCMP, "strcmp");
builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
BUILT_IN_STRCPY, "strcpy");
builtin_function ("__builtin_strlen", strlen_ftype,
BUILT_IN_STRLEN, "strlen");
builtin_function ("__builtin_sqrtf", float_ftype_float,
BUILT_IN_FSQRT, "sqrtf");
builtin_function ("__builtin_fsqrt", double_ftype_double,
BUILT_IN_FSQRT, "sqrt");
builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
BUILT_IN_FSQRT, "sqrtl");
builtin_function ("__builtin_sinf", float_ftype_float,
BUILT_IN_SIN, "sinf");
builtin_function ("__builtin_sin", double_ftype_double,
BUILT_IN_SIN, "sin");
builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
BUILT_IN_SIN, "sinl");
builtin_function ("__builtin_cosf", float_ftype_float,
BUILT_IN_COS, "cosf");
builtin_function ("__builtin_cos", double_ftype_double,
BUILT_IN_COS, "cos");
builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
BUILT_IN_COS, "cosl");
builtin_function ("__builtin_setjmp",
build_function_type (integer_type_node,
tree_cons (NULL_TREE,
ptr_type_node, endlink)),
BUILT_IN_SETJMP, NULL_PTR);
builtin_function ("__builtin_longjmp",
build_function_type
(void_type_node,
tree_cons (NULL, ptr_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink))),
BUILT_IN_LONGJMP, NULL_PTR);
builtin_function ("__builtin_trap",
build_function_type (void_type_node, endlink),
BUILT_IN_TRAP, NULL_PTR);
/* In an ANSI C program, it is okay to supply built-in meanings
for these functions, since applications cannot validly use them
with any other meaning.
However, honor the -fno-builtin option. */
if (!flag_no_builtin)
{
builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR);
builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
NULL_PTR);
builtin_function ("memset", memset_ftype, BUILT_IN_MEMSET, NULL_PTR);
builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP,
NULL_PTR);
builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
NULL_PTR);
builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR);
builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT,
NULL_PTR);
builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR);
builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR);
builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR);
builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR);
/* Declare these functions volatile
to avoid spurious "control drops through" warnings. */
/* Don't specify the argument types, to avoid errors
from certain code which isn't valid in ANSI but which exists. */
temp = builtin_function ("abort", void_ftype_any, NOT_BUILT_IN,
NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
temp = builtin_function ("exit", void_ftype_any, NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
}
#if 0
/* Support for these has not been written in either expand_builtin
or build_function_call. */
builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR);
builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR);
builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR,
NULL_PTR);
builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL,
NULL_PTR);
builtin_function ("__builtin_fmod", double_ftype_double_double,
BUILT_IN_FMOD, NULL_PTR);
builtin_function ("__builtin_frem", double_ftype_double_double,
BUILT_IN_FREM, NULL_PTR);
builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP,
NULL_PTR);
builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN,
NULL_PTR);
#endif
pedantic_lvalues = pedantic;
/* Create the global bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */

View File

@ -21,6 +21,8 @@ Boston, MA 02111-1307, USA. */
#ifndef _C_TREE_H
#define _C_TREE_H
#include "c-common.h"
/* Language-dependent contents of an identifier. */
/* The limbo_value is used for block level extern declarations, which need
@ -175,116 +177,11 @@ extern tree build_objc_string PROTO((int, const char *));
/* in c-aux-info.c */
extern void gen_aux_info_record PROTO((tree, int, int, int));
/* in c-common.c */
extern void declare_function_name PROTO((void));
extern void decl_attributes PROTO((tree, tree, tree));
extern void init_function_format_info PROTO((void));
extern void check_function_format PROTO((tree, tree, tree));
extern int c_get_alias_set PROTO((tree));
extern void c_apply_type_quals_to_decl PROTO((int, tree));
/* Print an error message for invalid operands to arith operation CODE.
NOP_EXPR is used as a special case (see truthvalue_conversion). */
extern void binary_op_error PROTO((enum tree_code));
extern void c_expand_expr_stmt PROTO((tree));
extern void c_expand_start_cond PROTO((tree, int, int));
extern void c_expand_start_else PROTO((void));
extern void c_expand_end_cond PROTO((void));
/* Validate the expression after `case' and apply default promotions. */
extern tree check_case_value PROTO((tree));
/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
extern tree combine_strings PROTO((tree));
extern void constant_expression_warning PROTO((tree));
extern tree convert_and_check PROTO((tree, tree));
extern void overflow_warning PROTO((tree));
extern void unsigned_conversion_warning PROTO((tree, tree));
/* Read the rest of the current #-directive line. */
#if USE_CPPLIB
extern char *get_directive_line PROTO((void));
#define GET_DIRECTIVE_LINE() get_directive_line ()
#else
extern char *get_directive_line PROTO((FILE *));
#define GET_DIRECTIVE_LINE() get_directive_line (finput)
#endif
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
and, if so, perhaps change them both back to their original type. */
extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
or validate its data type for an `if' or `while' statement or ?..: exp. */
extern tree truthvalue_conversion PROTO((tree));
extern tree type_for_mode PROTO((enum machine_mode, int));
extern tree type_for_size PROTO((unsigned, int));
/* in c-convert.c */
extern tree convert PROTO((tree, tree));
/* in c-decl.c */
/* Standard named or nameless data types of the C compiler. */
extern tree char_array_type_node;
extern tree char_type_node;
extern tree const_ptr_type_node;
extern tree const_string_type_node;
extern tree default_function_type;
extern tree double_ftype_double;
extern tree double_ftype_double_double;
extern tree double_type_node;
extern tree float_type_node;
#if HOST_BITS_PER_WIDE_INT >= 64
extern tree intTI_type_node;
#endif
extern tree intDI_type_node;
extern tree intHI_type_node;
extern tree intQI_type_node;
extern tree intSI_type_node;
extern tree int_array_type_node;
extern tree int_ftype_cptr_cptr_sizet;
extern tree int_ftype_int;
extern tree int_ftype_ptr_ptr_int;
extern tree int_ftype_string_string;
extern tree integer_type_node;
extern tree long_double_type_node;
extern tree long_ftype_long;
extern tree long_integer_type_node;
extern tree long_unsigned_type_node;
extern tree long_long_integer_type_node;
extern tree long_long_unsigned_type_node;
extern tree widest_integer_literal_type_node;
extern tree widest_unsigned_literal_type_node;
extern tree complex_integer_type_node;
extern tree complex_float_type_node;
extern tree complex_double_type_node;
extern tree complex_long_double_type_node;
extern tree ptr_type_node;
extern tree ptrdiff_type_node;
extern tree short_integer_type_node;
extern tree short_unsigned_type_node;
extern tree signed_char_type_node;
extern tree signed_wchar_type_node;
extern tree string_ftype_ptr_ptr;
extern tree string_type_node;
extern tree unsigned_char_type_node;
#if HOST_BITS_PER_WIDE_INT >= 64
extern tree unsigned_intTI_type_node;
#endif
extern tree unsigned_intDI_type_node;
extern tree unsigned_intHI_type_node;
extern tree unsigned_intQI_type_node;
extern tree unsigned_intSI_type_node;
extern tree unsigned_type_node;
extern tree unsigned_wchar_type_node;
extern tree void_ftype_ptr_int_int;
extern tree void_ftype_ptr_ptr_int;
extern tree void_type_node;
extern tree wchar_array_type_node;
extern tree wchar_type_node;
extern tree boolean_type_node;
extern tree boolean_true_node;
extern tree boolean_false_node;
extern tree build_enumerator PROTO((tree, tree));
/* Declare a predefined function. Return the declaration. */
extern tree builtin_function PROTO((const char *, tree, enum built_in_function function_, const char *));
/* Add qualifiers to a type, in the fashion for C. */
extern tree c_build_qualified_type PROTO((tree, int));
#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \

View File

@ -1,3 +1,30 @@
Tue Jul 20 11:24:19 1999 Bernd Schmidt <bernds@cygnus.co.uk>
* cp-tree.h: Delete lots of declarations of tree nodes; replaced by
c_global_trees and accessor macros defined in c-common.h.
(cp_tree_index): New enumeration.
(cp_global_trees): Declare new array. Add accessor macros for it, and
delete declarations of tree nodes replaced by it.
(builtin_function): Delete macro, add declaration for new function.
Include c-common.h.
* decl.c: Delete definitions for tree nodes that were replaced by
cp_global_trees and c_global_trees.
(init_decl_processing): Call c_common_nodes_and_builtins; delete code
to generate the common builtins here.
(builtin_function): New function.
* decl2.c (abort_fndecl): Delete declaration.
* except.c (expand_builtin_return_address): Delete declaration.
(builtin_return_address_fndecl): Delete variable.
(const_ptr_type_node): Delete declaration.
* lex.c (cons_up_default_function): Delete declaration of
void_list_node.
* parse.y (void_list_node): Delete declaration.
* rtti.c (type_info_type_node, tinfo_fn_id, tinfo_fn_type):
Delete variables.
(const_string_type_node): Delete declaration.
* search.c (abort_fndecl): Delete declaration.
* Makefile.in: Update dependencies.
1999-07-19 Mark Mitchell <mark@codesourcery.com>
* pt.c (check_default_tmpl_args): Move test for missing default

View File

@ -214,7 +214,7 @@ RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
CXX_TREE_H = $(TREE_H) cp-tree.h $(srcdir)/../c-common.h cp-tree.def
PARSE_H = $(srcdir)/parse.h
PARSE_C = $(srcdir)/parse.c
EXPR_H = $(srcdir)/../expr.h ../insn-codes.h

View File

@ -19,6 +19,8 @@ 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. */
#include "c-common.h"
#ifndef _CP_TREE_H
#define _CP_TREE_H
@ -329,40 +331,96 @@ extern int pedantic;
next exception handler. */
extern tree exception_throw_decl;
extern tree double_type_node, long_double_type_node, float_type_node;
extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
extern tree ptrdiff_type_node;
enum cp_tree_index
{
CPTI_JAVA_BYTE_TYPE,
CPTI_JAVA_SHORT_TYPE,
CPTI_JAVA_INT_TYPE,
CPTI_JAVA_LONG_TYPE,
CPTI_JAVA_FLOAT_TYPE,
CPTI_JAVA_DOUBLE_TYPE,
CPTI_JAVA_CHAR_TYPE,
CPTI_JAVA_BOOLEAN_TYPE,
extern tree short_integer_type_node, short_unsigned_type_node;
extern tree long_integer_type_node, long_unsigned_type_node;
extern tree long_long_integer_type_node, long_long_unsigned_type_node;
extern tree widest_integer_literal_type_node, widest_unsigned_literal_type_node;
extern tree unsigned_type_node;
extern tree string_type_node, char_array_type_node, int_array_type_node;
extern tree wchar_array_type_node;
extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
CPTI_VOID_ZERO,
CPTI_WCHAR_DECL,
CPTI_VTABLE_ENTRY_TYPE,
CPTI_DELTA_TYPE,
extern tree complex_integer_type_node;
extern tree complex_float_type_node;
extern tree complex_double_type_node;
extern tree complex_long_double_type_node;
CPTI_TP_DESC_TYPE,
CPTI_ACCESS_MODE_TYPE,
CPTI_BLTN_DESC_TYPE,
CPTI_USER_DESC_TYPE,
CPTI_CLASS_DESC_TYPE,
CPTI_PTR_DESC_TYPE,
CPTI_ATTR_DESC_TYPE,
CPTI_FUNC_DESC_TYPE,
CPTI_PTMF_DESC_TYPE,
CPTI_PTMD_DESC_TYPE,
CPTI_CLASS_STAR_TYPE,
CPTI_CLASS_TYPE,
CPTI_RECORD_TYPE,
CPTI_UNION_TYPE,
CPTI_ENUM_TYPE,
CPTI_UNKNOWN_TYPE,
CPTI_OPAQUE_TYPE,
CPTI_SIGNATURE_TYPE,
CPTI_SIGTABLE_ENTRY_TYPE,
CPTI_VTBL_TYPE,
CPTI_VTBL_PTR_TYPE,
CPTI_STD,
CPTI_TYPE_INFO_TYPE,
CPTI_TINFO_FN_ID,
CPTI_TINFO_FN_TYPE,
CPTI_ABORT_FNDECL,
CPTI_GLOBAL_DELETE_FNDECL,
extern tree intQI_type_node, unsigned_intQI_type_node;
extern tree intHI_type_node, unsigned_intHI_type_node;
extern tree intSI_type_node, unsigned_intSI_type_node;
extern tree intDI_type_node, unsigned_intDI_type_node;
#if HOST_BITS_PER_WIDE_INT >= 64
extern tree intTI_type_node, unsigned_intTI_type_node;
#endif
CPTI_MAX
};
extern tree java_byte_type_node;
extern tree java_short_type_node;
extern tree java_int_type_node;
extern tree java_long_type_node;
extern tree java_float_type_node;
extern tree java_double_type_node;
extern tree java_char_type_node;
extern tree java_boolean_type_node;
extern tree cp_global_trees[CPTI_MAX];
#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
#define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
#define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
#define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
#define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
#define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
#define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
#define void_zero_node cp_global_trees[CPTI_VOID_ZERO]
#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
#define __tp_desc_type_node cp_global_trees[CPTI_TP_DESC_TYPE]
#define __access_mode_type_node cp_global_trees[CPTI_ACCESS_MODE_TYPE]
#define __bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
#define __user_desc_type_node cp_global_trees[CPTI_USER_DESC_TYPE]
#define __class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
#define __ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
#define __attr_desc_type_node cp_global_trees[CPTI_ATTR_DESC_TYPE]
#define __func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
#define __ptmf_desc_type_node cp_global_trees[CPTI_PTMF_DESC_TYPE]
#define __ptmd_desc_type_node cp_global_trees[CPTI_PTMD_DESC_TYPE]
#define class_star_type_node cp_global_trees[CPTI_CLASS_STAR_TYPE]
#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
#define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
#define union_type_node cp_global_trees[CPTI_UNION_TYPE]
#define enum_type_node cp_global_trees[CPTI_ENUM_TYPE]
#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
#define opaque_type_node cp_global_trees[CPTI_OPAQUE_TYPE]
#define signature_type_node cp_global_trees[CPTI_SIGNATURE_TYPE]
#define sigtable_entry_type cp_global_trees[CPTI_SIGTABLE_ENTRY_TYPE]
#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
#define std_node cp_global_trees[CPTI_STD]
#define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
#define tinfo_fn_id cp_global_trees[CPTI_TINFO_FN_ID]
#define tinfo_fn_type cp_global_trees[CPTI_TINFO_FN_TYPE]
#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
extern int current_function_returns_value;
extern int current_function_returns_null;
@ -2048,9 +2106,6 @@ extern int flag_new_for_scope;
#define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length)
#define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
#define builtin_function(NAME, TYPE, CODE, LIBNAME) \
define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME)
/* These macros provide convenient access to the various _STMT nodes
created when parsing template declarations. */
#define IF_COND(NODE) TREE_OPERAND (NODE, 0)
@ -2153,22 +2208,6 @@ extern tree type_for_size PROTO((unsigned, int));
extern int c_get_alias_set PROTO((tree));
/* in decl{2}.c */
extern tree void_list_node;
extern tree void_zero_node;
extern tree default_function_type;
extern tree vtable_entry_type;
extern tree sigtable_entry_type;
extern tree __t_desc_type_node;
#if 0
extern tree __tp_desc_type_node;
#endif
extern tree __access_mode_type_node;
extern tree __bltn_desc_type_node, __user_desc_type_node;
extern tree __class_desc_type_node, __attr_desc_type_node;
extern tree __ptr_desc_type_node, __func_desc_type_node;
extern tree __ptmf_desc_type_node, __ptmd_desc_type_node;
extern tree type_info_type_node;
extern tree class_star_type_node;
extern tree this_identifier;
extern tree ctor_identifier, dtor_identifier;
extern tree pfn_identifier;
@ -2182,36 +2221,19 @@ extern tree vt_off_identifier;
/* A node that is a list (length 1) of error_mark_nodes. */
extern tree error_mark_list;
extern tree ptr_type_node;
extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
extern tree unknown_type_node;
extern tree opaque_type_node, signature_type_node;
/* Node for "pointer to (virtual) function".
This may be distinct from ptr_type_node so gdb can distinguish them. */
#define vfunc_ptr_type_node \
(flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
/* The type of a vtbl, i.e., an array of vtable entries. */
extern tree vtbl_type_node;
/* The type of a class vtbl pointer, i.e., a pointer to a vtable entry. */
extern tree vtbl_ptr_type_node;
extern tree delta_type_node;
extern tree std_node;
extern tree long_long_integer_type_node, long_long_unsigned_type_node;
/* For building calls to `delete'. */
extern tree integer_two_node, integer_three_node;
extern tree boolean_type_node, boolean_true_node, boolean_false_node;
extern tree null_node;
extern tree anonymous_namespace_name;
/* The FUNCTION_DECL for the default `::operator delete'. */
extern tree global_delete_fndecl;
/* in pt.c */
/* These values are used for the `STRICT' parameter to type_unfication and
@ -2862,7 +2884,7 @@ extern void init_decl_processing PROTO((void));
extern int init_type_desc PROTO((void));
extern tree define_function
PROTO((const char *, tree, enum built_in_function,
void (*) (tree), const char *));
void (*) (tree), const char *));
extern tree check_tag_decl PROTO((tree));
extern void shadow_tag PROTO((tree));
extern tree groktypename PROTO((tree));

View File

@ -46,8 +46,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
extern tree builtin_return_address_fndecl;
extern struct obstack permanent_obstack;
extern struct obstack* saveable_obstack;
@ -207,158 +205,82 @@ tree error_mark_node;
/* Erroneous argument lists can use this *IFF* they do not modify it. */
tree error_mark_list;
/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */
/* The following symbols are subsumed in the cp_global_trees array, and
listed here individually for documentation purposes.
tree short_integer_type_node;
tree integer_type_node;
tree long_integer_type_node;
tree long_long_integer_type_node;
C++ extensions
tree wchar_decl_node;
tree void_zero_node;
tree short_unsigned_type_node;
tree unsigned_type_node;
tree long_unsigned_type_node;
tree long_long_unsigned_type_node;
tree vtable_entry_type;
tree delta_type_node;
#if 0
Old rtti stuff.
tree __baselist_desc_type_node;
tree __i_desc_type_node, __m_desc_type_node;
tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type;
#endif
tree __t_desc_type_node;
#if 0
tree __tp_desc_type_node;
#endif
tree __access_mode_type_node;
tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;
tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;
tree __ptmf_desc_type_node, __ptmd_desc_type_node;
#if 0
Not needed yet? May be needed one day?
tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type;
tree __ptmf_desc_array_type, __ptmd_desc_array_type;
#endif
/* These are used for integer literals that are larger than
a long long. The largest integer literals we can handle
are the width of two HOST_WIDE_INTs. If two HOST_WIDE_INTs
are not larger than the target's long long, then these
will never be used. */
tree widest_integer_literal_type_node;
tree widest_unsigned_literal_type_node;
tree class_star_type_node;
tree class_type_node, record_type_node, union_type_node, enum_type_node;
tree unknown_type_node;
tree opaque_type_node, signature_type_node;
tree sigtable_entry_type;
tree ptrdiff_type_node;
Array type `vtable_entry_type[]'
tree unsigned_char_type_node;
tree signed_char_type_node;
tree vtbl_type_node;
tree vtbl_ptr_type_node;
Nnamespace std
tree std_node;
A FUNCTION_DECL which can call `abort'. Not necessarily the
one that the user will declare, but sufficient to be called
by routines that want to abort the program.
tree abort_fndecl;
The FUNCTION_DECL for the default `::operator delete'.
tree global_delete_fndecl;
Used by RTTI
tree type_info_type_node, tinfo_fn_id, tinfo_fn_type;
*/
tree cp_global_trees[CPTI_MAX];
/* These can't be part of the above array, since they are declared
individually in tree.h, and used by the debug output routines. */
tree void_type_node;
tree char_type_node;
tree wchar_type_node;
tree signed_wchar_type_node;
tree unsigned_wchar_type_node;
tree wchar_decl_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
tree java_byte_type_node;
tree java_short_type_node;
tree java_int_type_node;
tree java_long_type_node;
tree java_float_type_node;
tree java_double_type_node;
tree java_char_type_node;
tree java_boolean_type_node;
/* A VOID_TYPE node, and the same, packaged in a TREE_LIST. */
tree void_type_node, void_list_node;
tree void_zero_node;
/* Nodes for types `void *' and `const void *'. */
tree ptr_type_node;
tree const_ptr_type_node;
/* Nodes for types `char *' and `const char *'. */
tree string_type_node, const_string_type_node;
/* Type `char[256]' or something like it.
Used when an array of char is needed and the size is irrelevant. */
tree char_array_type_node;
/* Type `int[256]' or something like it.
Used when an array of int needed and the size is irrelevant. */
tree int_array_type_node;
/* Type `wchar_t[256]' or something like it.
Used when a wide string literal is created. */
tree wchar_array_type_node;
/* The bool data type, and constants */
tree boolean_type_node, boolean_true_node, boolean_false_node;
/* Type `int ()' -- used for implicit declaration of functions. */
tree default_function_type;
/* Function types `double (double)' and `double (double, double)', etc. */
static tree double_ftype_double, double_ftype_double_double;
static tree int_ftype_int, long_ftype_long;
static tree float_ftype_float;
static tree ldouble_ftype_ldouble;
/* Function type `int (const void *, const void *, size_t)' */
static tree int_ftype_cptr_cptr_sizet;
/* C++ extensions */
tree vtable_entry_type;
tree delta_type_node;
#if 0
/* Old rtti stuff. */
tree __baselist_desc_type_node;
tree __i_desc_type_node, __m_desc_type_node;
tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type;
#endif
tree __t_desc_type_node;
#if 0
tree __tp_desc_type_node;
#endif
tree __access_mode_type_node;
tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;
tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;
tree __ptmf_desc_type_node, __ptmd_desc_type_node;
#if 0
/* Not needed yet? May be needed one day? */
tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;
tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type;
tree __ptmf_desc_array_type, __ptmd_desc_array_type;
#endif
tree integer_type_node;
tree unsigned_type_node;
/* Indicates that there is a type value in some namespace, although
that is not necessarily in scope at the moment. */
that is not necessarily in scope at the moment. */
static tree global_type_node;
tree class_star_type_node;
tree class_type_node, record_type_node, union_type_node, enum_type_node;
tree unknown_type_node;
tree opaque_type_node, signature_type_node;
tree sigtable_entry_type;
/* Array type `vtable_entry_type[]' */
tree vtbl_type_node;
tree vtbl_ptr_type_node;
/* namespace std */
tree std_node;
/* Namespace std. */
int in_std = 0;
/* Expect only namespace names now. */
@ -386,16 +308,6 @@ static rtx last_parm_cleanup_insn;
tree ctor_label;
/* A FUNCTION_DECL which can call `abort'. Not necessarily the
one that the user will declare, but sufficient to be called
by routines that want to abort the program. */
tree abort_fndecl;
/* A FUNCTION_DECL for the default `::operator delete'. */
tree global_delete_fndecl;
extern rtx cleanup_label, return_label;
/* If original DECL_RESULT of current function was a register,
@ -6154,19 +6066,10 @@ auto_function (name, type, code)
void
init_decl_processing ()
{
register tree endlink, int_endlink, double_endlink, unsigned_endlink;
tree fields[20];
/* Data type of memcpy. */
tree memcpy_ftype, strlen_ftype;
int wchar_type_size;
tree temp;
tree array_domain_type;
tree vb_off_identifier = NULL_TREE;
/* Function type `char *(char *, char *)' and similar ones */
tree string_ftype_ptr_ptr, int_ftype_string_string;
tree sizetype_endlink;
tree ptr_ftype, ptr_ftype_unsigned, ptr_ftype_sizetype;
tree void_ftype, void_ftype_int, void_ftype_ptr;
/* Have to make these distinct before we try using them. */
lang_name_cplusplus = get_identifier ("C++");
@ -6463,269 +6366,24 @@ init_decl_processing ()
need to look inside this envelope. */
class_star_type_node = build_pointer_type (make_lang_type (RECORD_TYPE));
if (flag_huge_objects)
delta_type_node = long_integer_type_node;
else
delta_type_node = short_integer_type_node;
default_function_type
= build_function_type (integer_type_node, NULL_TREE);
ptr_type_node = build_pointer_type (void_type_node);
const_ptr_type_node
= build_pointer_type (build_qualified_type (void_type_node,
TYPE_QUAL_CONST));
#if 0
record_builtin_type (RID_MAX, NULL_PTR, ptr_type_node);
#endif
endlink = void_list_node;
int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
double_endlink = tree_cons (NULL_TREE, double_type_node, endlink);
unsigned_endlink = tree_cons (NULL_TREE, unsigned_type_node, endlink);
TYPE_QUAL_CONST));
c_common_nodes_and_builtins (1, flag_no_builtin, flag_no_nonansi_builtin);
ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
ptr_ftype_unsigned = build_function_type (ptr_type_node, unsigned_endlink);
sizetype_endlink = tree_cons (NULL_TREE, sizetype, endlink);
/* We realloc here because sizetype could be int or unsigned. S'ok. */
ptr_ftype_sizetype = build_function_type (ptr_type_node, sizetype_endlink);
void_ftype = build_function_type (void_type_node, endlink);
void_ftype_int = build_function_type (void_type_node, int_endlink);
void_ftype_ptr
= build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node, endlink));
void_ftype_ptr
= build_exception_variant (void_ftype_ptr,
tree_cons (NULL_TREE, NULL_TREE, NULL_TREE));
float_ftype_float
= build_function_type (float_type_node,
tree_cons (NULL_TREE, float_type_node, endlink));
double_ftype_double
= build_function_type (double_type_node, double_endlink);
ldouble_ftype_ldouble
= build_function_type (long_double_type_node,
tree_cons (NULL_TREE, long_double_type_node,
endlink));
double_ftype_double_double
= build_function_type (double_type_node,
tree_cons (NULL_TREE, double_type_node,
double_endlink));
int_ftype_int
= build_function_type (integer_type_node, int_endlink);
long_ftype_long
= build_function_type (long_integer_type_node,
tree_cons (NULL_TREE, long_integer_type_node,
endlink));
int_ftype_cptr_cptr_sizet
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
tree_cons (NULL_TREE,
sizetype,
endlink))));
string_ftype_ptr_ptr /* strcpy prototype */
= build_function_type (string_type_node,
tree_cons (NULL_TREE, string_type_node,
tree_cons (NULL_TREE,
const_string_type_node,
endlink)));
int_ftype_string_string /* strcmp prototype */
= build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_string_type_node,
tree_cons (NULL_TREE,
const_string_type_node,
endlink)));
strlen_ftype /* strlen prototype */
= build_function_type (sizetype,
tree_cons (NULL_TREE, const_string_type_node,
endlink));
memcpy_ftype /* memcpy prototype */
= build_function_type (ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE, const_ptr_type_node,
sizetype_endlink)));
if (flag_huge_objects)
delta_type_node = long_integer_type_node;
else
delta_type_node = short_integer_type_node;
builtin_function ("__builtin_constant_p", default_function_type,
BUILT_IN_CONSTANT_P, NULL_PTR);
builtin_return_address_fndecl
= builtin_function ("__builtin_return_address", ptr_ftype_unsigned,
BUILT_IN_RETURN_ADDRESS, NULL_PTR);
builtin_function ("__builtin_frame_address", ptr_ftype_unsigned,
BUILT_IN_FRAME_ADDRESS, NULL_PTR);
builtin_function ("__builtin_alloca", ptr_ftype_sizetype,
BUILT_IN_ALLOCA, "alloca");
builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Define alloca, ffs as builtins.
Declare _exit just to mark it as volatile. */
if (! flag_no_builtin && !flag_no_nonansi_builtin)
{
temp = builtin_function ("alloca", ptr_ftype_sizetype,
BUILT_IN_ALLOCA, NULL_PTR);
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("_exit", void_ftype_int,
NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
/* Suppress error if redefined as a non-function. */
DECL_BUILT_IN_NONANSI (temp) = 1;
}
builtin_function ("__builtin_abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("__builtin_fabsf", float_ftype_float, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_fabs", double_ftype_double, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("__builtin_labs", long_ftype_long,
BUILT_IN_LABS, NULL_PTR);
builtin_function ("__builtin_saveregs", ptr_ftype,
BUILT_IN_SAVEREGS, NULL_PTR);
builtin_function ("__builtin_classify_type", default_function_type,
BUILT_IN_CLASSIFY_TYPE, NULL_PTR);
builtin_function ("__builtin_next_arg", ptr_ftype,
BUILT_IN_NEXT_ARG, NULL_PTR);
builtin_function ("__builtin_args_info", int_ftype_int,
BUILT_IN_ARGS_INFO, NULL_PTR);
builtin_function ("__builtin_setjmp",
build_function_type (integer_type_node,
tree_cons (NULL_TREE, ptr_type_node,
endlink)),
BUILT_IN_SETJMP, NULL_PTR);
builtin_function ("__builtin_longjmp",
build_function_type (integer_type_node,
tree_cons (NULL_TREE, ptr_type_node,
tree_cons (NULL_TREE,
integer_type_node,
endlink))),
BUILT_IN_LONGJMP, NULL_PTR);
/* Untyped call and return. */
builtin_function ("__builtin_apply_args", ptr_ftype,
BUILT_IN_APPLY_ARGS, NULL_PTR);
temp = tree_cons (NULL_TREE,
build_pointer_type (build_function_type (void_type_node,
NULL_TREE)),
tree_cons (NULL_TREE, ptr_ftype_sizetype, NULL_TREE));
builtin_function ("__builtin_apply",
build_function_type (ptr_type_node, temp),
BUILT_IN_APPLY, NULL_PTR);
builtin_function ("__builtin_return", void_ftype_ptr,
BUILT_IN_RETURN, NULL_PTR);
/* Currently under experimentation. */
builtin_function ("__builtin_memcpy", memcpy_ftype,
BUILT_IN_MEMCPY, "memcpy");
builtin_function ("__builtin_memcmp", int_ftype_cptr_cptr_sizet,
BUILT_IN_MEMCMP, "memcmp");
builtin_function ("__builtin_strcmp", int_ftype_string_string,
BUILT_IN_STRCMP, "strcmp");
builtin_function ("__builtin_strcpy", string_ftype_ptr_ptr,
BUILT_IN_STRCPY, "strcpy");
builtin_function ("__builtin_strlen", strlen_ftype,
BUILT_IN_STRLEN, "strlen");
builtin_function ("__builtin_sqrtf", float_ftype_float,
BUILT_IN_FSQRT, "sqrtf");
builtin_function ("__builtin_fsqrt", double_ftype_double,
BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
BUILT_IN_FSQRT, "sqrtl");
builtin_function ("__builtin_sinf", float_ftype_float,
BUILT_IN_SIN, "sinf");
builtin_function ("__builtin_sin", double_ftype_double,
BUILT_IN_SIN, "sin");
builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
BUILT_IN_SIN, "sinl");
builtin_function ("__builtin_cosf", float_ftype_float,
BUILT_IN_COS, "cosf");
builtin_function ("__builtin_cos", double_ftype_double,
BUILT_IN_COS, "cos");
builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
BUILT_IN_COS, "cosl");
if (!flag_no_builtin)
{
builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, NULL_PTR);
builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
NULL_PTR);
builtin_function ("strcmp", int_ftype_string_string, BUILT_IN_STRCMP,
NULL_PTR);
builtin_function ("strcpy", string_ftype_ptr_ptr, BUILT_IN_STRCPY,
NULL_PTR);
builtin_function ("strlen", strlen_ftype, BUILT_IN_STRLEN, NULL_PTR);
builtin_function ("sqrtf", float_ftype_float, BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("sqrt", double_ftype_double, BUILT_IN_FSQRT, NULL_PTR);
builtin_function ("sqrtl", ldouble_ftype_ldouble, BUILT_IN_FSQRT,
NULL_PTR);
builtin_function ("sinf", float_ftype_float, BUILT_IN_SIN, NULL_PTR);
builtin_function ("sin", double_ftype_double, BUILT_IN_SIN, NULL_PTR);
builtin_function ("sinl", ldouble_ftype_ldouble, BUILT_IN_SIN, NULL_PTR);
builtin_function ("cosf", float_ftype_float, BUILT_IN_COS, NULL_PTR);
builtin_function ("cos", double_ftype_double, BUILT_IN_COS, NULL_PTR);
builtin_function ("cosl", ldouble_ftype_ldouble, BUILT_IN_COS, NULL_PTR);
/* Declare these functions volatile
to avoid spurious "control drops through" warnings. */
temp = builtin_function ("abort", void_ftype,
NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
/* Well, these are actually ANSI, but we can't set DECL_BUILT_IN on
them... */
DECL_BUILT_IN_NONANSI (temp) = 1;
temp = builtin_function ("exit", void_ftype_int,
NOT_BUILT_IN, NULL_PTR);
TREE_THIS_VOLATILE (temp) = 1;
TREE_SIDE_EFFECTS (temp) = 1;
DECL_BUILT_IN_NONANSI (temp) = 1;
}
#if 0
/* Support for these has not been written in either expand_builtin
or build_function_call. */
builtin_function ("__builtin_div", default_ftype, BUILT_IN_DIV, NULL_PTR);
builtin_function ("__builtin_ldiv", default_ftype, BUILT_IN_LDIV, NULL_PTR);
builtin_function ("__builtin_ffloor", double_ftype_double, BUILT_IN_FFLOOR,
NULL_PTR);
builtin_function ("__builtin_fceil", double_ftype_double, BUILT_IN_FCEIL,
NULL_PTR);
builtin_function ("__builtin_fmod", double_ftype_double_double,
BUILT_IN_FMOD, NULL_PTR);
builtin_function ("__builtin_frem", double_ftype_double_double,
BUILT_IN_FREM, NULL_PTR);
builtin_function ("__builtin_memset", ptr_ftype_ptr_int_int,
BUILT_IN_MEMSET, NULL_PTR);
builtin_function ("__builtin_getexp", double_ftype_double, BUILT_IN_GETEXP,
NULL_PTR);
builtin_function ("__builtin_getman", double_ftype_double, BUILT_IN_GETMAN,
NULL_PTR);
#endif
/* C++ extensions */
unknown_type_node = make_node (UNKNOWN_TYPE);
@ -6968,6 +6626,16 @@ define_function (name, type, function_code, pfn, library_name)
}
return decl;
}
tree
builtin_function (name, type, code, libname)
const char *name;
tree type;
enum built_in_function code;
const char *libname;
{
return define_function (name, type, code, (void (*) PROTO((tree)))pushdecl, libname);
}
/* When we call finish_struct for an anonymous union, we create
default copy constructors and such. But, an anonymous union

View File

@ -2394,8 +2394,6 @@ coerce_delete_type (type)
return type;
}
extern tree abort_fndecl;
static void
mark_vtable_entries (decl)
tree decl;

View File

@ -37,13 +37,6 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "eh-common.h"
rtx expand_builtin_return_addr PROTO((enum built_in_function, int, rtx));
/* Holds the fndecl for __builtin_return_address. */
tree builtin_return_address_fndecl;
/* A couple of backend routines from m88k.c */
static void push_eh_cleanup PROTO((void));
static tree build_eh_type_type PROTO((tree));
static tree build_eh_type PROTO((tree));
@ -184,7 +177,6 @@ static tree Unwind;
========================================================================= */
extern rtx catch_clauses;
extern tree const_ptr_type_node;
/* ========================================================================= */

View File

@ -2002,7 +2002,6 @@ cons_up_default_function (type, full_name, kind)
tree type, full_name;
int kind;
{
extern tree void_list_node;
tree declspecs = NULL_TREE;
tree fn, args = NULL_TREE;
tree argtype;

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,6 @@ Boston, MA 02111-1307, USA. */
definition here. (fnf) */
char *language_string = "GNU C++";
extern tree void_list_node;
extern struct obstack permanent_obstack;
extern int end_of_file;

View File

@ -48,10 +48,6 @@ static void expand_ptr_desc PROTO((tree, tree));
static void expand_generic_desc PROTO((tree, tree, const char *));
static tree throw_bad_cast PROTO((void));
static tree throw_bad_typeid PROTO((void));
tree type_info_type_node;
tree tinfo_fn_id;
tree tinfo_fn_type;
void
init_rtti_processing ()
@ -726,8 +722,6 @@ build_dynamic_cast (type, expr)
Note: these constructors always return the address of the descriptor
info, since that is simplest for their mutual interaction. */
extern tree const_string_type_node;
/* Build an initializer for a __si_type_info node. */
static void

View File

@ -37,7 +37,6 @@ Boston, MA 02111-1307, USA. */
#define obstack_chunk_free free
extern struct obstack *current_obstack;
extern tree abort_fndecl;
#include "stack.h"

View File

@ -66,8 +66,9 @@ cc1obj$(exeext): $(P) $(OBJS) $(OBJC_OBJS) $(LIBDEPS)
objc-parse.o : $(srcdir)/objc/objc-parse.c \
$(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h \
$(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/input.h \
$(srcdir)/flags.h $(srcdir)/output.h $(srcdir)/objc/objc-act.h system.h
$(srcdir)/c-lex.h $(srcdir)/c-tree.h $(srcdir)/c-common.h \
$(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \
$(srcdir)/objc/objc-act.h system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-parse.c
@ -85,9 +86,10 @@ $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
objc-act.o : $(srcdir)/objc/objc-act.c \
$(CONFIG_H) $(TREE_H) $(RTL_H) system.h \
$(srcdir)/c-tree.h $(srcdir)/c-lex.h $(srcdir)/toplev.h \
$(srcdir)/flags.h $(srcdir)/objc/objc-act.h $(srcdir)/input.h \
$(srcdir)/function.h $(srcdir)/output.h $(srcdir)/c-parse.h
$(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \
$(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \
$(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h \
$(srcdir)/c-parse.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-act.c

View File

@ -1769,17 +1769,17 @@ build_module_descriptor ()
return 0;
{
tree parms, function_decl, decelerator, void_list_node;
tree parms, function_decl, decelerator, void_list_node_1;
tree function_type;
tree init_function_name = get_file_function_name ('I');
/* Declare void __objc_execClass (void *); */
void_list_node = build_tree_list (NULL_TREE, void_type_node);
void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
function_type
= build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
void_list_node));
void_list_node_1));
function_decl = build_decl (FUNCTION_DECL,
get_identifier (TAG_EXECCLASS),
function_type);
@ -1797,12 +1797,12 @@ build_module_descriptor ()
/* void _GLOBAL_$I$<gnyf> () {objc_execClass (&L_OBJC_MODULES);} */
start_function (void_list_node,
start_function (void_list_node_1,
build_parse_node (CALL_EXPR, init_function_name,
/* This has the format of the output
of get_parm_info. */
tree_cons (NULL_TREE, NULL_TREE,
void_list_node),
void_list_node_1),
NULL_TREE),
NULL_TREE, NULL_TREE, 0);
#if 0 /* This should be turned back on later