1 /* Definitions for c-common.c.
2 Copyright (C) 1987, 93, 94, 95, 97, 98, 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
21 /* Standard named or nameless data types of the C compiler. */
26 CTI_SIGNED_WCHAR_TYPE
,
27 CTI_UNSIGNED_WCHAR_TYPE
,
28 CTI_WIDEST_INT_LIT_TYPE
,
29 CTI_WIDEST_UINT_LIT_TYPE
,
35 CTI_CONST_STRING_TYPE
,
40 CTI_DEFAULT_FUNCTION_TYPE
,
46 CTI_PTR_FTYPE_SIZETYPE
,
51 extern tree c_global_trees
[CTI_MAX
];
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]
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]
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]
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]
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]
76 extern void declare_function_name
PROTO((void));
77 extern void decl_attributes
PROTO((tree
, tree
, tree
));
78 extern void init_function_format_info
PROTO((void));
79 extern void check_function_format
PROTO((tree
, tree
, tree
));
80 extern void c_apply_type_quals_to_decl
PROTO((int, tree
));
81 extern int c_get_alias_set
PROTO((tree
));
82 /* Print an error message for invalid operands to arith operation CODE.
83 NOP_EXPR is used as a special case (see truthvalue_conversion). */
84 extern void binary_op_error
PROTO((enum tree_code
));
85 extern void c_expand_expr_stmt
PROTO((tree
));
86 extern void c_expand_start_cond
PROTO((tree
, int, int));
87 extern void c_expand_start_else
PROTO((void));
88 extern void c_expand_end_cond
PROTO((void));
89 /* Validate the expression after `case' and apply default promotions. */
90 extern tree check_case_value
PROTO((tree
));
91 /* Concatenate a list of STRING_CST nodes into one STRING_CST. */
92 extern tree combine_strings
PROTO((tree
));
93 extern void constant_expression_warning
PROTO((tree
));
94 extern tree convert_and_check
PROTO((tree
, tree
));
95 extern void overflow_warning
PROTO((tree
));
96 extern void unsigned_conversion_warning
PROTO((tree
, tree
));
97 /* Read the rest of the current #-directive line. */
99 extern char *get_directive_line
PROTO((void));
100 #define GET_DIRECTIVE_LINE() get_directive_line ()
102 extern char *get_directive_line
PROTO((FILE *));
103 #define GET_DIRECTIVE_LINE() get_directive_line (finput)
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. */
109 extern tree shorten_compare
PROTO((tree
*, tree
*, tree
*, enum tree_code
*));
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. */
112 extern tree truthvalue_conversion
PROTO((tree
));
113 extern tree type_for_mode
PROTO((enum machine_mode
, int));
114 extern tree type_for_size
PROTO((unsigned, int));
116 /* Build tree nodes and builtin functions common to both C and C++ language
118 extern void c_common_nodes_and_builtins
PROTO((int, int, int));
120 extern tree build_va_arg
PROTO((tree
, tree
));
122 extern tree initializer_constant_valid_p
PROTO((tree
, tree
));
124 /* Nonzero if the type T promotes to itself.
125 ANSI C states explicitly the list of types that promote;
126 in particular, short promotes to int even if they have the same width. */
127 #define C_PROMOTING_INTEGER_TYPE_P(t) \
128 (TREE_CODE ((t)) == INTEGER_TYPE \
129 && (TYPE_MAIN_VARIANT (t) == char_type_node \
130 || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
131 || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
132 || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
133 || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
135 extern int self_promoting_args_p
PROTO((tree
));
136 extern tree simple_type_promotes_to
PROTO((tree
));