]>
Commit | Line | Data |
---|---|---|
7f4edbcb | 1 | /* Definitions for c-common.c. |
6e090c76 | 2 | Copyright (C) 1987, 93-95, 97-99, 2000 Free Software Foundation, Inc. |
7f4edbcb BS |
3 | |
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
19 | Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | /* Standard named or nameless data types of the C compiler. */ | |
22 | ||
23 | enum c_tree_index | |
24 | { | |
7f4edbcb BS |
25 | CTI_WCHAR_TYPE, |
26 | CTI_SIGNED_WCHAR_TYPE, | |
27 | CTI_UNSIGNED_WCHAR_TYPE, | |
7f4edbcb BS |
28 | CTI_WIDEST_INT_LIT_TYPE, |
29 | CTI_WIDEST_UINT_LIT_TYPE, | |
30 | ||
7f4edbcb BS |
31 | CTI_CHAR_ARRAY_TYPE, |
32 | CTI_WCHAR_ARRAY_TYPE, | |
33 | CTI_INT_ARRAY_TYPE, | |
34 | CTI_STRING_TYPE, | |
35 | CTI_CONST_STRING_TYPE, | |
36 | ||
7f4edbcb BS |
37 | CTI_BOOLEAN_TYPE, |
38 | CTI_BOOLEAN_TRUE, | |
39 | CTI_BOOLEAN_FALSE, | |
40 | CTI_DEFAULT_FUNCTION_TYPE, | |
41 | CTI_VOID_LIST, | |
42 | ||
43 | CTI_VOID_FTYPE, | |
44 | CTI_VOID_FTYPE_PTR, | |
45 | CTI_INT_FTYPE_INT, | |
46 | CTI_PTR_FTYPE_SIZETYPE, | |
47 | ||
48 | CTI_MAX | |
49 | }; | |
50 | ||
51 | extern tree c_global_trees[CTI_MAX]; | |
52 | ||
7f4edbcb BS |
53 | #define wchar_type_node c_global_trees[CTI_WCHAR_TYPE] |
54 | #define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE] | |
55 | #define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE] | |
7f4edbcb BS |
56 | #define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE] |
57 | #define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE] | |
58 | ||
7f4edbcb BS |
59 | #define boolean_type_node c_global_trees[CTI_BOOLEAN_TYPE] |
60 | #define boolean_true_node c_global_trees[CTI_BOOLEAN_TRUE] | |
61 | #define boolean_false_node c_global_trees[CTI_BOOLEAN_FALSE] | |
62 | ||
7f4edbcb BS |
63 | #define char_array_type_node c_global_trees[CTI_CHAR_ARRAY_TYPE] |
64 | #define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE] | |
65 | #define int_array_type_node c_global_trees[CTI_INT_ARRAY_TYPE] | |
66 | #define string_type_node c_global_trees[CTI_STRING_TYPE] | |
67 | #define const_string_type_node c_global_trees[CTI_CONST_STRING_TYPE] | |
68 | ||
69 | #define default_function_type c_global_trees[CTI_DEFAULT_FUNCTION_TYPE] | |
70 | #define void_list_node c_global_trees[CTI_VOID_LIST] | |
71 | #define void_ftype c_global_trees[CTI_VOID_FTYPE] | |
72 | #define void_ftype_ptr c_global_trees[CTI_VOID_FTYPE_PTR] | |
73 | #define int_ftype_int c_global_trees[CTI_INT_FTYPE_INT] | |
74 | #define ptr_ftype_sizetype c_global_trees[CTI_PTR_FTYPE_SIZETYPE] | |
75 | ||
6e090c76 KG |
76 | extern void declare_function_name PARAMS ((void)); |
77 | extern void decl_attributes PARAMS ((tree, tree, tree)); | |
78 | extern void init_function_format_info PARAMS ((void)); | |
79 | extern void check_function_format PARAMS ((tree, tree, tree)); | |
80 | extern void c_apply_type_quals_to_decl PARAMS ((int, tree)); | |
81 | extern int c_get_alias_set PARAMS ((tree)); | |
7f4edbcb BS |
82 | /* Print an error message for invalid operands to arith operation CODE. |
83 | NOP_EXPR is used as a special case (see truthvalue_conversion). */ | |
6e090c76 KG |
84 | extern void binary_op_error PARAMS ((enum tree_code)); |
85 | extern void c_expand_expr_stmt PARAMS ((tree)); | |
86 | extern void c_expand_start_cond PARAMS ((tree, int, int)); | |
87 | extern void c_expand_start_else PARAMS ((void)); | |
88 | extern void c_expand_end_cond PARAMS ((void)); | |
7f4edbcb | 89 | /* Validate the expression after `case' and apply default promotions. */ |
6e090c76 | 90 | extern tree check_case_value PARAMS ((tree)); |
7f4edbcb | 91 | /* Concatenate a list of STRING_CST nodes into one STRING_CST. */ |
6e090c76 KG |
92 | extern tree combine_strings PARAMS ((tree)); |
93 | extern void constant_expression_warning PARAMS ((tree)); | |
94 | extern tree convert_and_check PARAMS ((tree, tree)); | |
95 | extern void overflow_warning PARAMS ((tree)); | |
96 | extern void unsigned_conversion_warning PARAMS ((tree, tree)); | |
7f4edbcb BS |
97 | /* Read the rest of the current #-directive line. */ |
98 | #if USE_CPPLIB | |
6e090c76 | 99 | extern char *get_directive_line PARAMS ((void)); |
7f4edbcb BS |
100 | #define GET_DIRECTIVE_LINE() get_directive_line () |
101 | #else | |
6e090c76 | 102 | extern char *get_directive_line PARAMS ((FILE *)); |
7f4edbcb BS |
103 | #define GET_DIRECTIVE_LINE() get_directive_line (finput) |
104 | #endif | |
105 | ||
106 | /* Subroutine of build_binary_op, used for comparison operations. | |
107 | See if the operands have both been converted from subword integer types | |
108 | and, if so, perhaps change them both back to their original type. */ | |
6e090c76 | 109 | extern tree shorten_compare PARAMS ((tree *, tree *, tree *, enum tree_code *)); |
7f4edbcb BS |
110 | /* Prepare expr to be an argument of a TRUTH_NOT_EXPR, |
111 | or validate its data type for an `if' or `while' statement or ?..: exp. */ | |
6e090c76 KG |
112 | extern tree truthvalue_conversion PARAMS ((tree)); |
113 | extern tree type_for_mode PARAMS ((enum machine_mode, int)); | |
114 | extern tree type_for_size PARAMS ((unsigned, int)); | |
7f4edbcb | 115 | |
7f4edbcb BS |
116 | /* Build tree nodes and builtin functions common to both C and C++ language |
117 | frontends. */ | |
6e090c76 | 118 | extern void c_common_nodes_and_builtins PARAMS ((int, int, int)); |
d3707adb | 119 | |
6e090c76 | 120 | extern tree build_va_arg PARAMS ((tree, tree)); |
7e8176d7 | 121 | |
c530479e RH |
122 | /* Nonzero if the type T promotes to itself. |
123 | ANSI C states explicitly the list of types that promote; | |
124 | in particular, short promotes to int even if they have the same width. */ | |
125 | #define C_PROMOTING_INTEGER_TYPE_P(t) \ | |
126 | (TREE_CODE ((t)) == INTEGER_TYPE \ | |
127 | && (TYPE_MAIN_VARIANT (t) == char_type_node \ | |
128 | || TYPE_MAIN_VARIANT (t) == signed_char_type_node \ | |
129 | || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \ | |
130 | || TYPE_MAIN_VARIANT (t) == short_integer_type_node \ | |
131 | || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node)) | |
132 | ||
6e090c76 KG |
133 | extern int self_promoting_args_p PARAMS ((tree)); |
134 | extern tree simple_type_promotes_to PARAMS ((tree)); |