]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/c-common.h
c-common.h: New file.
[thirdparty/gcc.git] / gcc / c-common.h
CommitLineData
7f4edbcb
BS
1/* Definitions for c-common.c.
2 Copyright (C) 1987, 93, 94, 95, 97, 98, 1999 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21/* Standard named or nameless data types of the C compiler. */
22
23enum c_tree_index
24{
25 CTI_INTQI_TYPE,
26 CTI_INTHI_TYPE,
27 CTI_INTSI_TYPE,
28 CTI_INTDI_TYPE,
29 CTI_INTTI_TYPE,
30
31 CTI_UINTQI_TYPE,
32 CTI_UINTHI_TYPE,
33 CTI_UINTSI_TYPE,
34 CTI_UINTDI_TYPE,
35 CTI_UINTTI_TYPE,
36
37 CTI_SIGNED_CHAR_TYPE,
38 CTI_UNSIGNED_CHAR_TYPE,
39 CTI_WCHAR_TYPE,
40 CTI_SIGNED_WCHAR_TYPE,
41 CTI_UNSIGNED_WCHAR_TYPE,
42 CTI_SHORT_INTEGER_TYPE,
43 CTI_SHORT_UNSIGNED_TYPE,
44 CTI_LONG_INTEGER_TYPE,
45 CTI_LONG_UNSIGNED_TYPE,
46 CTI_LONG_LONG_INTEGER_TYPE,
47 CTI_LONG_LONG_UNSIGNED_TYPE,
48 CTI_WIDEST_INT_LIT_TYPE,
49 CTI_WIDEST_UINT_LIT_TYPE,
50
51 CTI_COMPLEX_INTEGER_TYPE,
52 CTI_COMPLEX_FLOAT_TYPE,
53 CTI_COMPLEX_DOUBLE_TYPE,
54 CTI_COMPLEX_LONG_DOUBLE_TYPE,
55
56 CTI_FLOAT_TYPE,
57 CTI_DOUBLE_TYPE,
58 CTI_LONG_DOUBLE_TYPE,
59
60 CTI_CHAR_ARRAY_TYPE,
61 CTI_WCHAR_ARRAY_TYPE,
62 CTI_INT_ARRAY_TYPE,
63 CTI_STRING_TYPE,
64 CTI_CONST_STRING_TYPE,
65
66 CTI_PTR_TYPE,
67 CTI_CONST_PTR_TYPE,
68 CTI_PTRDIFF_TYPE,
69
70 CTI_BOOLEAN_TYPE,
71 CTI_BOOLEAN_TRUE,
72 CTI_BOOLEAN_FALSE,
73 CTI_DEFAULT_FUNCTION_TYPE,
74 CTI_VOID_LIST,
75
76 CTI_VOID_FTYPE,
77 CTI_VOID_FTYPE_PTR,
78 CTI_INT_FTYPE_INT,
79 CTI_PTR_FTYPE_SIZETYPE,
80
81 CTI_MAX
82};
83
84extern tree c_global_trees[CTI_MAX];
85
86#define intQI_type_node c_global_trees[CTI_INTQI_TYPE]
87#define intHI_type_node c_global_trees[CTI_INTHI_TYPE]
88#define intSI_type_node c_global_trees[CTI_INTSI_TYPE]
89#define intDI_type_node c_global_trees[CTI_INTDI_TYPE]
90#if HOST_BITS_PER_WIDE_INT >= 64
91#define intTI_type_node c_global_trees[CTI_INTTI_TYPE]
92#endif
93
94#define unsigned_intQI_type_node c_global_trees[CTI_UINTQI_TYPE]
95#define unsigned_intHI_type_node c_global_trees[CTI_UINTHI_TYPE]
96#define unsigned_intSI_type_node c_global_trees[CTI_UINTSI_TYPE]
97#define unsigned_intDI_type_node c_global_trees[CTI_UINTDI_TYPE]
98#if HOST_BITS_PER_WIDE_INT >= 64
99#define unsigned_intTI_type_node c_global_trees[CTI_UINTTI_TYPE]
100#endif
101
102#define signed_char_type_node c_global_trees[CTI_SIGNED_CHAR_TYPE]
103#define unsigned_char_type_node c_global_trees[CTI_UNSIGNED_CHAR_TYPE]
104#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE]
105#define signed_wchar_type_node c_global_trees[CTI_SIGNED_WCHAR_TYPE]
106#define unsigned_wchar_type_node c_global_trees[CTI_UNSIGNED_WCHAR_TYPE]
107#define short_integer_type_node c_global_trees[CTI_SHORT_INTEGER_TYPE]
108#define short_unsigned_type_node c_global_trees[CTI_SHORT_UNSIGNED_TYPE]
109#define long_integer_type_node c_global_trees[CTI_LONG_INTEGER_TYPE]
110#define long_unsigned_type_node c_global_trees[CTI_LONG_UNSIGNED_TYPE]
111#define long_long_integer_type_node c_global_trees[CTI_LONG_LONG_INTEGER_TYPE]
112#define long_long_unsigned_type_node c_global_trees[CTI_LONG_LONG_UNSIGNED_TYPE]
113#define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE]
114#define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE]
115
116#define float_type_node c_global_trees[CTI_FLOAT_TYPE]
117#define double_type_node c_global_trees[CTI_DOUBLE_TYPE]
118#define long_double_type_node c_global_trees[CTI_LONG_DOUBLE_TYPE]
119
120#define complex_integer_type_node c_global_trees[CTI_COMPLEX_INTEGER_TYPE]
121#define complex_float_type_node c_global_trees[CTI_COMPLEX_FLOAT_TYPE]
122#define complex_double_type_node c_global_trees[CTI_COMPLEX_DOUBLE_TYPE]
123#define complex_long_double_type_node c_global_trees[CTI_COMPLEX_LONG_DOUBLE_TYPE]
124
125#define boolean_type_node c_global_trees[CTI_BOOLEAN_TYPE]
126#define boolean_true_node c_global_trees[CTI_BOOLEAN_TRUE]
127#define boolean_false_node c_global_trees[CTI_BOOLEAN_FALSE]
128
129#define ptr_type_node c_global_trees[CTI_PTR_TYPE]
130#define const_ptr_type_node c_global_trees[CTI_CONST_PTR_TYPE]
131#define ptrdiff_type_node c_global_trees[CTI_PTRDIFF_TYPE]
132
133#define char_array_type_node c_global_trees[CTI_CHAR_ARRAY_TYPE]
134#define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE]
135#define int_array_type_node c_global_trees[CTI_INT_ARRAY_TYPE]
136#define string_type_node c_global_trees[CTI_STRING_TYPE]
137#define const_string_type_node c_global_trees[CTI_CONST_STRING_TYPE]
138
139#define default_function_type c_global_trees[CTI_DEFAULT_FUNCTION_TYPE]
140#define void_list_node c_global_trees[CTI_VOID_LIST]
141#define void_ftype c_global_trees[CTI_VOID_FTYPE]
142#define void_ftype_ptr c_global_trees[CTI_VOID_FTYPE_PTR]
143#define int_ftype_int c_global_trees[CTI_INT_FTYPE_INT]
144#define ptr_ftype_sizetype c_global_trees[CTI_PTR_FTYPE_SIZETYPE]
145
146extern void declare_function_name PROTO((void));
147extern void decl_attributes PROTO((tree, tree, tree));
148extern void init_function_format_info PROTO((void));
149extern void check_function_format PROTO((tree, tree, tree));
150extern void c_apply_type_quals_to_decl PROTO((int, tree));
151extern int c_get_alias_set PROTO((tree));
152/* Print an error message for invalid operands to arith operation CODE.
153 NOP_EXPR is used as a special case (see truthvalue_conversion). */
154extern void binary_op_error PROTO((enum tree_code));
155extern void c_expand_expr_stmt PROTO((tree));
156extern void c_expand_start_cond PROTO((tree, int, int));
157extern void c_expand_start_else PROTO((void));
158extern void c_expand_end_cond PROTO((void));
159/* Validate the expression after `case' and apply default promotions. */
160extern tree check_case_value PROTO((tree));
161/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
162extern tree combine_strings PROTO((tree));
163extern void constant_expression_warning PROTO((tree));
164extern tree convert_and_check PROTO((tree, tree));
165extern void overflow_warning PROTO((tree));
166extern void unsigned_conversion_warning PROTO((tree, tree));
167/* Read the rest of the current #-directive line. */
168#if USE_CPPLIB
169extern char *get_directive_line PROTO((void));
170#define GET_DIRECTIVE_LINE() get_directive_line ()
171#else
172extern char *get_directive_line PROTO((FILE *));
173#define GET_DIRECTIVE_LINE() get_directive_line (finput)
174#endif
175
176/* Subroutine of build_binary_op, used for comparison operations.
177 See if the operands have both been converted from subword integer types
178 and, if so, perhaps change them both back to their original type. */
179extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
180/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
181 or validate its data type for an `if' or `while' statement or ?..: exp. */
182extern tree truthvalue_conversion PROTO((tree));
183extern tree type_for_mode PROTO((enum machine_mode, int));
184extern tree type_for_size PROTO((unsigned, int));
185
186/* Declare a predefined function. Return the declaration. This function is
187 provided by each language frontend. */
188extern tree builtin_function PROTO((const char *, tree, enum built_in_function, const char *));
189
190/* Build tree nodes and builtin functions common to both C and C++ language
191 frontends. */
192extern void c_common_nodes_and_builtins PROTO((int, int, int));