FreeBSD uses unchanged versions of this files.

This commit is contained in:
Alexander Kabaev 2007-05-19 02:12:21 +00:00
parent 9bbba41e79
commit 9d6b9560a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169699
28 changed files with 40430 additions and 33074 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
/* Mainly the interface between cpplib and the C front ends.
Copyright (C) 1987, 1988, 1989, 1992, 1994, 1995, 1996, 1997
1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GCC.
@ -16,8 +17,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "config.h"
#include "system.h"
@ -27,7 +28,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "real.h"
#include "rtl.h"
#include "tree.h"
#include "expr.h"
#include "input.h"
#include "output.h"
#include "c-tree.h"
@ -42,28 +42,29 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "splay-tree.h"
#include "debug.h"
/* The current line map. */
static const struct line_map *map;
/* We may keep statistics about how long which files took to compile. */
static int header_time, body_time;
static splay_tree file_info_tree;
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)
/* Number of bytes in a wide character. */
#define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
int pending_lang_change; /* If we need to switch languages - C++ only */
int c_header_level; /* depth in C headers - C++ only */
/* If we need to translate characters received. This is tri-state:
0 means use only the untranslated string; 1 means use only
the translated string; -1 means chain the translated string
to the untranslated one. */
int c_lex_string_translate = 1;
/* True if strings should be passed to the caller of c_lex completely
unmolested (no concatenation, no translation). */
bool c_lex_return_raw_strings = false;
static tree interpret_integer (const cpp_token *, unsigned int);
static tree interpret_float (const cpp_token *, unsigned int);
static enum integer_type_kind
narrowest_unsigned_type (tree, unsigned int);
static enum integer_type_kind
narrowest_signed_type (tree, unsigned int);
static enum integer_type_kind narrowest_unsigned_type
(unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, unsigned int);
static enum integer_type_kind narrowest_signed_type
(unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, unsigned int);
static enum cpp_ttype lex_string (const cpp_token *, tree *, bool);
static tree lex_charconst (const cpp_token *);
static void update_header_times (const char *);
@ -80,10 +81,8 @@ init_c_lex (void)
struct cpp_callbacks *cb;
struct c_fileinfo *toplevel;
/* Set up filename timing. Must happen before cpp_read_main_file. */
file_info_tree = splay_tree_new ((splay_tree_compare_fn)strcmp,
0,
(splay_tree_delete_value_fn)free);
/* The get_fileinfo data structure must be initialized before
cpp_read_main_file is called. */
toplevel = get_fileinfo ("<top level>");
if (flag_detailed_statistics)
{
@ -102,8 +101,8 @@ init_c_lex (void)
/* Set the debug callbacks if we can use them. */
if (debug_info_level == DINFO_LEVEL_VERBOSE
&& (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG))
&& (write_symbols == DWARF2_DEBUG
|| write_symbols == VMS_AND_DWARF2_DEBUG))
{
cb->define = cb_define;
cb->undef = cb_undef;
@ -116,11 +115,16 @@ get_fileinfo (const char *name)
splay_tree_node n;
struct c_fileinfo *fi;
if (!file_info_tree)
file_info_tree = splay_tree_new ((splay_tree_compare_fn) strcmp,
0,
(splay_tree_delete_value_fn) free);
n = splay_tree_lookup (file_info_tree, (splay_tree_key) name);
if (n)
return (struct c_fileinfo *) n->value;
fi = xmalloc (sizeof (struct c_fileinfo));
fi = XNEW (struct c_fileinfo);
fi->time = 0;
fi->interface_only = 0;
fi->interface_unknown = 1;
@ -145,7 +149,7 @@ update_header_times (const char *name)
}
static int
dump_one_header (splay_tree_node n, void *dummy ATTRIBUTE_UNUSED)
dump_one_header (splay_tree_node n, void * ARG_UNUSED (dummy))
{
print_time ((const char *) n->key,
((struct c_fileinfo *) n->value)->time);
@ -163,26 +167,26 @@ dump_time_statistics (void)
print_time ("header files (total)", header_time);
print_time ("main file (total)", this_time - body_time);
fprintf (stderr, "ratio = %g : 1\n",
(double)header_time / (double)(this_time - body_time));
(double) header_time / (double) (this_time - body_time));
fprintf (stderr, "\n******\n");
splay_tree_foreach (file_info_tree, dump_one_header, 0);
}
static void
cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED,
unsigned int line ATTRIBUTE_UNUSED,
const cpp_string *str ATTRIBUTE_UNUSED)
cb_ident (cpp_reader * ARG_UNUSED (pfile),
unsigned int ARG_UNUSED (line),
const cpp_string * ARG_UNUSED (str))
{
#ifdef ASM_OUTPUT_IDENT
if (! flag_no_ident)
if (!flag_no_ident)
{
/* Convert escapes in the string. */
cpp_string cstr = { 0, 0 };
if (cpp_interpret_string (pfile, str, 1, &cstr, false))
{
ASM_OUTPUT_IDENT (asm_out_file, (const char *) cstr.text);
free ((void *)cstr.text);
free ((void *) cstr.text);
}
}
#endif
@ -191,34 +195,44 @@ cb_ident (cpp_reader *pfile ATTRIBUTE_UNUSED,
/* Called at the start of every non-empty line. TOKEN is the first
lexed token on the line. Used for diagnostic line numbers. */
static void
cb_line_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const cpp_token *token,
cb_line_change (cpp_reader * ARG_UNUSED (pfile), const cpp_token *token,
int parsing_args)
{
if (token->type == CPP_EOF || parsing_args)
return;
input_line = SOURCE_LINE (map, token->line);
if (token->type != CPP_EOF && !parsing_args)
#ifdef USE_MAPPED_LOCATION
input_location = token->src_loc;
#else
{
source_location loc = token->src_loc;
const struct line_map *map = linemap_lookup (&line_table, loc);
input_line = SOURCE_LINE (map, loc);
}
#endif
}
void
fe_file_change (const struct line_map *new_map)
{
if (new_map == NULL)
{
map = NULL;
return;
}
return;
if (new_map->reason == LC_ENTER)
{
/* Don't stack the main buffer on the input stack;
we already did in compile_file. */
if (map != NULL)
if (!MAIN_FILE_P (new_map))
{
int included_at = SOURCE_LINE (new_map - 1, new_map->from_line - 1);
#ifdef USE_MAPPED_LOCATION
int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1);
input_location = included_at;
push_srcloc (new_map->start_location);
#else
int included_at = LAST_SOURCE_LINE (new_map - 1);
input_line = included_at;
push_srcloc (new_map->to_file, 1);
#endif
(*debug_hooks->start_source_file) (included_at, new_map->to_file);
#ifndef NO_IMPLICIT_EXTERN_C
if (c_header_level)
@ -237,7 +251,7 @@ fe_file_change (const struct line_map *new_map)
if (c_header_level && --c_header_level == 0)
{
if (new_map->sysp == 2)
warning ("badly nested C headers from preprocessor");
warning (0, "badly nested C headers from preprocessor");
--pending_lang_change;
}
#endif
@ -248,16 +262,16 @@ fe_file_change (const struct line_map *new_map)
update_header_times (new_map->to_file);
in_system_header = new_map->sysp != 0;
#ifdef USE_MAPPED_LOCATION
input_location = new_map->start_location;
#else
input_filename = new_map->to_file;
input_line = new_map->to_line;
map = new_map;
/* Hook for C++. */
extract_interface_info ();
#endif
}
static void
cb_def_pragma (cpp_reader *pfile, unsigned int line)
cb_def_pragma (cpp_reader *pfile, source_location loc)
{
/* Issue a warning message if we have been asked to do so. Ignore
unknown pragmas in system headers unless an explicit
@ -266,6 +280,14 @@ cb_def_pragma (cpp_reader *pfile, unsigned int line)
{
const unsigned char *space, *name;
const cpp_token *s;
#ifndef USE_MAPPED_LOCATION
location_t fe_loc;
const struct line_map *map = linemap_lookup (&line_table, loc);
fe_loc.file = map->to_file;
fe_loc.line = SOURCE_LINE (map, loc);
#else
location_t fe_loc = loc;
#endif
space = name = (const unsigned char *) "";
s = cpp_get_token (pfile);
@ -277,54 +299,58 @@ cb_def_pragma (cpp_reader *pfile, unsigned int line)
name = cpp_token_as_text (pfile, s);
}
input_line = SOURCE_LINE (map, line);
warning ("ignoring #pragma %s %s", space, name);
warning (OPT_Wunknown_pragmas, "%Hignoring #pragma %s %s",
&fe_loc, space, name);
}
}
/* #define callback for DWARF and DWARF2 debug info. */
static void
cb_define (cpp_reader *pfile, unsigned int line, cpp_hashnode *node)
cb_define (cpp_reader *pfile, source_location loc, cpp_hashnode *node)
{
(*debug_hooks->define) (SOURCE_LINE (map, line),
const struct line_map *map = linemap_lookup (&line_table, loc);
(*debug_hooks->define) (SOURCE_LINE (map, loc),
(const char *) cpp_macro_definition (pfile, node));
}
/* #undef callback for DWARF and DWARF2 debug info. */
static void
cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, unsigned int line,
cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
cpp_hashnode *node)
{
(*debug_hooks->undef) (SOURCE_LINE (map, line),
const struct line_map *map = linemap_lookup (&line_table, loc);
(*debug_hooks->undef) (SOURCE_LINE (map, loc),
(const char *) NODE_NAME (node));
}
static inline const cpp_token *
get_nonpadding_token (void)
{
const cpp_token *tok;
timevar_push (TV_CPP);
do
tok = cpp_get_token (parse_in);
while (tok->type == CPP_PADDING);
timevar_pop (TV_CPP);
/* Read a token and return its type. Fill *VALUE with its value, if
applicable. Fill *CPP_FLAGS with the token's flags, if it is
non-NULL. */
return tok;
}
int
c_lex_with_flags (tree *value, unsigned char *cpp_flags)
enum cpp_ttype
c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags)
{
const cpp_token *tok;
location_t atloc;
static bool no_more_pch;
const cpp_token *tok;
enum cpp_ttype type;
unsigned char add_flags = 0;
timevar_push (TV_CPP);
retry:
tok = get_nonpadding_token ();
tok = cpp_get_token (parse_in);
type = tok->type;
retry_after_at:
switch (tok->type)
#ifdef USE_MAPPED_LOCATION
*loc = tok->src_loc;
#else
*loc = input_location;
#endif
switch (type)
{
case CPP_PADDING:
goto retry;
case CPP_NAME:
*value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node));
break;
@ -338,9 +364,14 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
case CPP_N_INVALID:
/* cpplib has issued an error. */
*value = error_mark_node;
errorcount++;
break;
case CPP_N_INTEGER:
/* C++ uses '0' to mark virtual functions as pure.
Set PURE_ZERO to pass this information to the C++ parser. */
if (tok->val.str.len == 1 && *tok->val.str.text == '0')
add_flags = PURE_ZERO;
*value = interpret_integer (tok, flags);
break;
@ -349,41 +380,59 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
break;
default:
abort ();
gcc_unreachable ();
}
}
break;
case CPP_ATSIGN:
/* An @ may give the next token special significance in Objective-C. */
atloc = input_location;
tok = get_nonpadding_token ();
if (c_dialect_objc ())
{
tree val;
switch (tok->type)
location_t atloc = input_location;
retry_at:
tok = cpp_get_token (parse_in);
type = tok->type;
switch (type)
{
case CPP_NAME:
val = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node));
if (C_IS_RESERVED_WORD (val)
&& OBJC_IS_AT_KEYWORD (C_RID_CODE (val)))
{
*value = val;
return CPP_AT_NAME;
}
break;
case CPP_PADDING:
goto retry_at;
case CPP_STRING:
case CPP_WSTRING:
return lex_string (tok, value, true);
type = lex_string (tok, value, true);
break;
default: break;
case CPP_NAME:
*value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node));
if (objc_is_reserved_word (*value))
{
type = CPP_AT_NAME;
break;
}
/* FALLTHROUGH */
default:
/* ... or not. */
error ("%Hstray %<@%> in program", &atloc);
goto retry_after_at;
}
break;
}
/* ... or not. */
error ("%Hstray '@' in program", &atloc);
goto retry_after_at;
/* FALLTHROUGH */
case CPP_HASH:
case CPP_PASTE:
{
unsigned char name[4];
*cpp_spell_token (parse_in, tok, name, true) = 0;
error ("stray %qs in program", name);
}
goto retry;
case CPP_OTHER:
{
@ -392,9 +441,9 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
if (c == '"' || c == '\'')
error ("missing terminating %c character", (int) c);
else if (ISGRAPH (c))
error ("stray '%c' in program", (int) c);
error ("stray %qc in program", (int) c);
else
error ("stray '\\%o' in program", (int) c);
error ("stray %<\\%o%> in program", (int) c);
}
goto retry;
@ -405,42 +454,51 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
case CPP_STRING:
case CPP_WSTRING:
return lex_string (tok, value, false);
if (!c_lex_return_raw_strings)
{
type = lex_string (tok, value, false);
break;
}
*value = build_string (tok->val.str.len, (char *) tok->val.str.text);
break;
case CPP_PRAGMA:
*value = build_int_cst (NULL, tok->val.pragma);
break;
/* These tokens should not be visible outside cpplib. */
case CPP_HEADER_NAME:
case CPP_COMMENT:
case CPP_MACRO_ARG:
abort ();
gcc_unreachable ();
default:
*value = NULL_TREE;
break;
}
if (! no_more_pch)
if (cpp_flags)
*cpp_flags = tok->flags | add_flags;
if (!no_more_pch)
{
no_more_pch = true;
c_common_no_more_pch ();
}
if (cpp_flags)
*cpp_flags = tok->flags;
return tok->type;
}
timevar_pop (TV_CPP);
int
c_lex (tree *value)
{
return c_lex_with_flags (value, NULL);
return type;
}
/* Returns the narrowest C-visible unsigned type, starting with the
minimum specified by FLAGS, that can fit VALUE, or itk_none if
minimum specified by FLAGS, that can fit HIGH:LOW, or itk_none if
there isn't one. */
static enum integer_type_kind
narrowest_unsigned_type (tree value, unsigned int flags)
narrowest_unsigned_type (unsigned HOST_WIDE_INT low,
unsigned HOST_WIDE_INT high,
unsigned int flags)
{
enum integer_type_kind itk;
@ -451,20 +509,23 @@ narrowest_unsigned_type (tree value, unsigned int flags)
else
itk = itk_unsigned_long_long;
/* int_fits_type_p must think the type of its first argument is
wider than its second argument, or it won't do the proper check. */
TREE_TYPE (value) = widest_unsigned_literal_type_node;
for (; itk < itk_none; itk += 2 /* skip unsigned types */)
if (int_fits_type_p (value, integer_types[itk]))
return itk;
{
tree upper = TYPE_MAX_VALUE (integer_types[itk]);
if ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (upper) > high
|| ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (upper) == high
&& TREE_INT_CST_LOW (upper) >= low))
return itk;
}
return itk_none;
}
/* Ditto, but narrowest signed type. */
static enum integer_type_kind
narrowest_signed_type (tree value, unsigned int flags)
narrowest_signed_type (unsigned HOST_WIDE_INT low,
unsigned HOST_WIDE_INT high, unsigned int flags)
{
enum integer_type_kind itk;
@ -475,13 +536,16 @@ narrowest_signed_type (tree value, unsigned int flags)
else
itk = itk_long_long;
/* int_fits_type_p must think the type of its first argument is
wider than its second argument, or it won't do the proper check. */
TREE_TYPE (value) = widest_unsigned_literal_type_node;
for (; itk < itk_none; itk += 2 /* skip signed types */)
if (int_fits_type_p (value, integer_types[itk]))
return itk;
{
tree upper = TYPE_MAX_VALUE (integer_types[itk]);
if ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (upper) > high
|| ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (upper) == high
&& TREE_INT_CST_LOW (upper) >= low))
return itk;
}
return itk_none;
}
@ -497,18 +561,19 @@ interpret_integer (const cpp_token *token, unsigned int flags)
integer = cpp_interpret_integer (parse_in, token, flags);
integer = cpp_num_sign_extend (integer, options->precision);
value = build_int_2_wide (integer.low, integer.high);
/* The type of a constant with a U suffix is straightforward. */
if (flags & CPP_N_UNSIGNED)
itk = narrowest_unsigned_type (value, flags);
itk = narrowest_unsigned_type (integer.low, integer.high, flags);
else
{
/* The type of a potentially-signed integer constant varies
depending on the base it's in, the standard in use, and the
length suffixes. */
enum integer_type_kind itk_u = narrowest_unsigned_type (value, flags);
enum integer_type_kind itk_s = narrowest_signed_type (value, flags);
enum integer_type_kind itk_u
= narrowest_unsigned_type (integer.low, integer.high, flags);
enum integer_type_kind itk_s
= narrowest_signed_type (integer.low, integer.high, flags);
/* In both C89 and C99, octal and hex constants may be signed or
unsigned, whichever fits tighter. We do not warn about this
@ -532,10 +597,11 @@ interpret_integer (const cpp_token *token, unsigned int flags)
if (itk_u < itk_unsigned_long)
itk_u = itk_unsigned_long;
itk = itk_u;
warning ("this decimal constant is unsigned only in ISO C90");
warning (0, "this decimal constant is unsigned only in ISO C90");
}
else if (warn_traditional)
warning ("this decimal constant would be unsigned in ISO C90");
else
warning (OPT_Wtraditional,
"this decimal constant would be unsigned in ISO C90");
}
}
}
@ -550,15 +616,15 @@ interpret_integer (const cpp_token *token, unsigned int flags)
if (itk > itk_unsigned_long
&& (flags & CPP_N_WIDTH) != CPP_N_LARGE
&& ! in_system_header && ! flag_isoc99)
pedwarn ("integer constant is too large for \"%s\" type",
&& !in_system_header && !flag_isoc99)
pedwarn ("integer constant is too large for %qs type",
(flags & CPP_N_UNSIGNED) ? "unsigned long" : "long");
TREE_TYPE (value) = type;
value = build_int_cst_wide (type, integer.low, integer.high);
/* Convert imaginary to a complex type. */
if (flags & CPP_N_IMAGINARY)
value = build_complex (NULL_TREE, convert (type, integer_zero_node), value);
value = build_complex (NULL_TREE, build_int_cst (type, 0), value);
return value;
}
@ -573,51 +639,53 @@ interpret_float (const cpp_token *token, unsigned int flags)
REAL_VALUE_TYPE real;
char *copy;
size_t copylen;
const char *typename;
/* FIXME: make %T work in error/warning, then we don't need typename. */
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = long_double_type_node;
typename = "long double";
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL
|| flag_single_precision_constant)
{
type = float_type_node;
typename = "float";
}
/* Decode type based on width and properties. */
if (flags & CPP_N_DFLOAT)
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
type = dfloat128_type_node;
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
type = dfloat32_type_node;
else
type = dfloat64_type_node;
else
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
type = long_double_type_node;
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL
|| flag_single_precision_constant)
type = float_type_node;
else
type = double_type_node;
typename = "double";
}
/* Copy the constant to a nul-terminated buffer. If the constant
has any suffixes, cut them off; REAL_VALUE_ATOF/ REAL_VALUE_HTOF
can't handle them. */
copylen = token->val.str.len;
if ((flags & CPP_N_WIDTH) != CPP_N_MEDIUM)
/* Must be an F or L suffix. */
copylen--;
if (flags & CPP_N_IMAGINARY)
/* I or J suffix. */
copylen--;
if (flags & CPP_N_DFLOAT)
copylen -= 2;
else
{
if ((flags & CPP_N_WIDTH) != CPP_N_MEDIUM)
/* Must be an F or L suffix. */
copylen--;
if (flags & CPP_N_IMAGINARY)
/* I or J suffix. */
copylen--;
}
copy = alloca (copylen + 1);
copy = (char *) alloca (copylen + 1);
memcpy (copy, token->val.str.text, copylen);
copy[copylen] = '\0';
real_from_string (&real, copy);
real_convert (&real, TYPE_MODE (type), &real);
real_from_string3 (&real, copy, TYPE_MODE (type));
/* A diagnostic is required for "soft" overflow by some ISO C
testsuites. This is not pedwarn, because some people don't want
an error for this.
??? That's a dubious reason... is this a mandatory diagnostic or
isn't it? -- zw, 2001-08-21. */
/* Both C and C++ require a diagnostic for a floating constant
outside the range of representable values of its type. Since we
have __builtin_inf* to produce an infinity, it might now be
appropriate for this to be a mandatory pedwarn rather than
conditioned on -pedantic. */
if (REAL_VALUE_ISINF (real) && pedantic)
warning ("floating constant exceeds range of \"%s\"", typename);
pedwarn ("floating constant exceeds range of %qT", type);
/* Create a node with determined type and value. */
value = build_real (type, real);
@ -648,7 +716,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
{
tree value;
bool wide = false;
size_t count = 1;
size_t concats = 0;
struct obstack str_ob;
cpp_string istr;
@ -660,45 +728,76 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
if (tok->type == CPP_WSTRING)
wide = true;
tok = get_nonpadding_token ();
if (c_dialect_objc () && tok->type == CPP_ATSIGN)
retry:
tok = cpp_get_token (parse_in);
switch (tok->type)
{
objc_string = true;
tok = get_nonpadding_token ();
}
if (tok->type == CPP_STRING || tok->type == CPP_WSTRING)
{
gcc_obstack_init (&str_ob);
obstack_grow (&str_ob, &str, sizeof (cpp_string));
do
case CPP_PADDING:
goto retry;
case CPP_ATSIGN:
if (c_dialect_objc ())
{
count++;
if (tok->type == CPP_WSTRING)
wide = true;
obstack_grow (&str_ob, &tok->val.str, sizeof (cpp_string));
tok = get_nonpadding_token ();
if (c_dialect_objc () && tok->type == CPP_ATSIGN)
{
objc_string = true;
tok = get_nonpadding_token ();
}
objc_string = true;
goto retry;
}
while (tok->type == CPP_STRING || tok->type == CPP_WSTRING);
strs = obstack_finish (&str_ob);
/* FALLTHROUGH */
default:
break;
case CPP_WSTRING:
wide = true;
/* FALLTHROUGH */
case CPP_STRING:
if (!concats)
{
gcc_obstack_init (&str_ob);
obstack_grow (&str_ob, &str, sizeof (cpp_string));
}
concats++;
obstack_grow (&str_ob, &tok->val.str, sizeof (cpp_string));
goto retry;
}
/* We have read one more token than we want. */
_cpp_backup_tokens (parse_in, 1);
if (concats)
strs = XOBFINISH (&str_ob, cpp_string *);
if (count > 1 && !objc_string && warn_traditional && !in_system_header)
warning ("traditional C rejects string constant concatenation");
if (concats && !objc_string && !in_system_header)
warning (OPT_Wtraditional,
"traditional C rejects string constant concatenation");
if (cpp_interpret_string (parse_in, strs, count, &istr, wide))
if ((c_lex_string_translate
? cpp_interpret_string : cpp_interpret_string_notranslate)
(parse_in, strs, concats + 1, &istr, wide))
{
value = build_string (istr.len, (char *)istr.text);
free ((void *)istr.text);
value = build_string (istr.len, (char *) istr.text);
free ((void *) istr.text);
if (c_lex_string_translate == -1)
{
int xlated = cpp_interpret_string_notranslate (parse_in, strs,
concats + 1,
&istr, wide);
/* Assume that, if we managed to translate the string above,
then the untranslated parsing will always succeed. */
gcc_assert (xlated);
if (TREE_STRING_LENGTH (value) != (int) istr.len
|| 0 != strncmp (TREE_STRING_POINTER (value), (char *) istr.text,
istr.len))
{
/* Arrange for us to return the untranslated string in
*valp, but to set up the C type of the translated
one. */
*valp = build_string (istr.len, (char *) istr.text);
valp = &TREE_CHAIN (*valp);
}
free ((void *) istr.text);
}
}
else
{
@ -717,7 +816,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
TREE_TYPE (value) = wide ? wchar_array_type_node : char_array_type_node;
*valp = fix_string_type (value);
if (strs != &str)
if (concats)
obstack_free (&str_ob, 0);
return objc_string ? CPP_OBJC_STRING : wide ? CPP_WSTRING : CPP_STRING;
@ -735,13 +834,6 @@ lex_charconst (const cpp_token *token)
result = cpp_interpret_charconst (parse_in, token,
&chars_seen, &unsignedp);
/* Cast to cppchar_signed_t to get correct sign-extension of RESULT
before possibly widening to HOST_WIDE_INT for build_int_2. */
if (unsignedp || (cppchar_signed_t) result >= 0)
value = build_int_2 (result, 0);
else
value = build_int_2 ((cppchar_signed_t) result, -1);
if (token->type == CPP_WCHAR)
type = wchar_type_node;
/* In C, a character constant has type 'int'.
@ -751,6 +843,12 @@ lex_charconst (const cpp_token *token)
else
type = char_type_node;
TREE_TYPE (value) = type;
/* Cast to cppchar_signed_t to get correct sign-extension of RESULT
before possibly widening to HOST_WIDE_INT for build_int_cst. */
if (unsignedp || (cppchar_signed_t) result >= 0)
value = build_int_cst_wide (type, result, 0);
else
value = build_int_cst_wide (type, (cppchar_signed_t) result, -1);
return value;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Definitions for C parsing and type checking.
Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
@ -16,74 +16,28 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifndef GCC_C_TREE_H
#define GCC_C_TREE_H
#include "c-common.h"
#include "toplev.h"
#include "diagnostic.h"
/* Language-dependent contents of an identifier. */
/* The limbo_value is used for block level extern declarations, which need
to be type checked against subsequent extern declarations. They can't
be referenced after they fall out of scope, so they can't be global.
The rid_code field is used for keywords. It is in all
lang_identifier nodes, because some keywords are only special in a
particular context. */
struct lang_identifier GTY(())
{
struct c_common_identifier common_id;
tree symbol_value;
tree tag_value;
tree label_value;
};
/* The resulting tree type. */
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *)TYPE_NEXT_VARIANT (&%h.generic) : (union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
generic;
struct lang_identifier GTY ((tag ("1"))) identifier;
};
/* struct lang_identifier is private to c-decl.c, but langhooks.c needs to
know how big it is. This is sanity-checked in c-decl.c. */
#define C_SIZEOF_STRUCT_LANG_IDENTIFIER \
(sizeof (struct c_common_identifier) + 3 * sizeof (void *))
/* Language-specific declaration information. */
struct lang_decl GTY(())
{
/* The return types and parameter types may have variable size.
This is a list of any SAVE_EXPRs that need to be evaluated to
compute those sizes. */
tree pending_sizes;
char dummy;
};
/* Macros for access to language-specific slots in an identifier. */
/* Each of these slots contains a DECL node or null. */
/* The value of the identifier in the namespace of "ordinary identifiers"
(data objects, enum constants, functions, typedefs). */
#define IDENTIFIER_SYMBOL_VALUE(NODE) \
(((struct lang_identifier *) (NODE))->symbol_value)
/* The value of the identifier in the namespace of struct, union,
and enum tags. */
#define IDENTIFIER_TAG_VALUE(NODE) \
(((struct lang_identifier *) (NODE))->tag_value)
/* The value of the identifier in the namespace of labels. */
#define IDENTIFIER_LABEL_VALUE(NODE) \
(((struct lang_identifier *) (NODE))->label_value)
/* In identifiers, C uses the following fields in a special way:
TREE_PUBLIC to record that there was a previous local extern decl.
TREE_USED to record that such a decl was used.
TREE_ADDRESSABLE to record that the address of such a decl was used. */
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
@ -103,10 +57,17 @@ struct lang_decl GTY(())
and C_RID_YYCODE is the token number wanted by Yacc. */
#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID)
/* In a RECORD_TYPE, a sorted array of the fields of the type. */
struct lang_type GTY(())
{
/* In a RECORD_TYPE, a sorted array of the fields of the type. */
struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields"))) s;
/* In an ENUMERAL_TYPE, the min and max values. */
tree enum_min;
tree enum_max;
/* In a RECORD_TYPE, information specific to Objective-C, such
as a list of adopted protocols or a pointer to a corresponding
@interface. See objc/objc-act.h for details. */
tree objc_info;
};
/* Record whether a type or decl was written with nonconstant size.
@ -114,10 +75,6 @@ struct lang_type GTY(())
#define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE)
#define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE)
/* Store a value in that field. */
#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
(TREE_COMPLEXITY (EXP) = (int) (CODE))
/* Record whether a typedef for type `int' was actually `signed int'. */
#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
@ -128,11 +85,53 @@ struct lang_type GTY(())
/* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */
#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
/* Nonzero for a declaration of an external object which is not
currently in scope. This is either a built-in declaration of
a library function, before a real declaration has been seen,
or a declaration that appeared in an inner scope that has ended. */
#define C_DECL_INVISIBLE(EXP) DECL_LANG_FLAG_3 (EXP)
/* For FUNCTION_DECLs, evaluates true if the decl is built-in but has
been declared. */
#define C_DECL_DECLARED_BUILTIN(EXP) \
DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (EXP))
/* For FUNCTION_DECLs, evaluates true if the decl is built-in, has a
built-in prototype and does not have a non-built-in prototype. */
#define C_DECL_BUILTIN_PROTOTYPE(EXP) \
DECL_LANG_FLAG_6 (FUNCTION_DECL_CHECK (EXP))
/* Record whether a decl was declared register. This is strictly a
front-end flag, whereas DECL_REGISTER is used for code generation;
they may differ for structures with volatile fields. */
#define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP)
/* Record whether a decl was used in an expression anywhere except an
unevaluated operand of sizeof / typeof / alignof. This is only
used for functions declared static but not defined, though outside
sizeof and typeof it is set for other function decls as well. */
#define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (EXP))
/* Record whether a label was defined in a statement expression which
has finished and so can no longer be jumped to. */
#define C_DECL_UNJUMPABLE_STMT_EXPR(EXP) \
DECL_LANG_FLAG_6 (LABEL_DECL_CHECK (EXP))
/* Record whether a label was the subject of a goto from outside the
current level of statement expression nesting and so cannot be
defined right now. */
#define C_DECL_UNDEFINABLE_STMT_EXPR(EXP) \
DECL_LANG_FLAG_7 (LABEL_DECL_CHECK (EXP))
/* Record whether a label was defined in the scope of an identifier
with variably modified type which has finished and so can no longer
be jumped to. */
#define C_DECL_UNJUMPABLE_VM(EXP) \
DECL_LANG_FLAG_3 (LABEL_DECL_CHECK (EXP))
/* Record whether a label was the subject of a goto from outside the
current level of scopes of identifiers with variably modified type
and so cannot be defined right now. */
#define C_DECL_UNDEFINABLE_VM(EXP) \
DECL_LANG_FLAG_5 (LABEL_DECL_CHECK (EXP))
/* Record whether a variable has been declared threadprivate by
#pragma omp threadprivate. */
#define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL))
/* Nonzero for a decl which either doesn't exist or isn't a prototype.
N.B. Could be simplified if all built-in decls had complete prototypes
@ -145,12 +144,230 @@ struct lang_type GTY(())
/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as
TYPE_ARG_TYPES for functions with prototypes, but created for functions
without prototypes. */
#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE)
#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_LANG_SLOT_1 (NODE)
/* Values for the first parameter to poplevel. */
#define KEEP_NO 0
#define KEEP_YES 1
#define KEEP_MAYBE 2
/* Record parser information about an expression that is irrelevant
for code generation alongside a tree representing its value. */
struct c_expr
{
/* The value of the expression. */
tree value;
/* Record the original binary operator of an expression, which may
have been changed by fold, STRING_CST for unparenthesized string
constants, or ERROR_MARK for other expressions (including
parenthesized expressions). */
enum tree_code original_code;
};
/* A kind of type specifier. Note that this information is currently
only used to distinguish tag definitions, tag references and typeof
uses. */
enum c_typespec_kind {
/* A reserved keyword type specifier. */
ctsk_resword,
/* A reference to a tag, previously declared, such as "struct foo".
This includes where the previous declaration was as a different
kind of tag, in which case this is only valid if shadowing that
tag in an inner scope. */
ctsk_tagref,
/* A reference to a tag, not previously declared in a visible
scope. */
ctsk_tagfirstref,
/* A definition of a tag such as "struct foo { int a; }". */
ctsk_tagdef,
/* A typedef name. */
ctsk_typedef,
/* An ObjC-specific kind of type specifier. */
ctsk_objc,
/* A typeof specifier. */
ctsk_typeof
};
/* A type specifier: this structure is created in the parser and
passed to declspecs_add_type only. */
struct c_typespec {
/* What kind of type specifier this is. */
enum c_typespec_kind kind;
/* The specifier itself. */
tree spec;
};
/* A storage class specifier. */
enum c_storage_class {
csc_none,
csc_auto,
csc_extern,
csc_register,
csc_static,
csc_typedef
};
/* A type specifier keyword "void", "_Bool", "char", "int", "float",
"double", or none of these. */
enum c_typespec_keyword {
cts_none,
cts_void,
cts_bool,
cts_char,
cts_int,
cts_float,
cts_double,
cts_dfloat32,
cts_dfloat64,
cts_dfloat128
};
/* A sequence of declaration specifiers in C. */
struct c_declspecs {
/* The type specified, if a single type specifier such as a struct,
union or enum specifier, typedef name or typeof specifies the
whole type, or NULL_TREE if none or a keyword such as "void" or
"char" is used. Does not include qualifiers. */
tree type;
/* The attributes from a typedef decl. */
tree decl_attr;
/* When parsing, the attributes. Outside the parser, this will be
NULL; attributes (possibly from multiple lists) will be passed
separately. */
tree attrs;
/* Any type specifier keyword used such as "int", not reflecting
modifiers such as "short", or cts_none if none. */
enum c_typespec_keyword typespec_word;
/* The storage class specifier, or csc_none if none. */
enum c_storage_class storage_class;
/* Whether any declaration specifiers have been seen at all. */
BOOL_BITFIELD declspecs_seen_p : 1;
/* Whether a type specifier has been seen. */
BOOL_BITFIELD type_seen_p : 1;
/* Whether something other than a storage class specifier or
attribute has been seen. This is used to warn for the
obsolescent usage of storage class specifiers other than at the
start of the list. (Doing this properly would require function
specifiers to be handled separately from storage class
specifiers.) */
BOOL_BITFIELD non_sc_seen_p : 1;
/* Whether the type is specified by a typedef or typeof name. */
BOOL_BITFIELD typedef_p : 1;
/* Whether a struct, union or enum type either had its content
defined by a type specifier in the list or was the first visible
declaration of its tag. */
BOOL_BITFIELD tag_defined_p : 1;
/* Whether the type is explicitly "signed" or specified by a typedef
whose type is explicitly "signed". */
BOOL_BITFIELD explicit_signed_p : 1;
/* Whether the specifiers include a deprecated typedef. */
BOOL_BITFIELD deprecated_p : 1;
/* Whether the type defaulted to "int" because there were no type
specifiers. */
BOOL_BITFIELD default_int_p;
/* Whether "long" was specified. */
BOOL_BITFIELD long_p : 1;
/* Whether "long" was specified more than once. */
BOOL_BITFIELD long_long_p : 1;
/* Whether "short" was specified. */
BOOL_BITFIELD short_p : 1;
/* Whether "signed" was specified. */
BOOL_BITFIELD signed_p : 1;
/* Whether "unsigned" was specified. */
BOOL_BITFIELD unsigned_p : 1;
/* Whether "complex" was specified. */
BOOL_BITFIELD complex_p : 1;
/* Whether "inline" was specified. */
BOOL_BITFIELD inline_p : 1;
/* Whether "__thread" was specified. */
BOOL_BITFIELD thread_p : 1;
/* Whether "const" was specified. */
BOOL_BITFIELD const_p : 1;
/* Whether "volatile" was specified. */
BOOL_BITFIELD volatile_p : 1;
/* Whether "restrict" was specified. */
BOOL_BITFIELD restrict_p : 1;
};
/* The various kinds of declarators in C. */
enum c_declarator_kind {
/* An identifier. */
cdk_id,
/* A function. */
cdk_function,
/* An array. */
cdk_array,
/* A pointer. */
cdk_pointer,
/* Parenthesized declarator with nested attributes. */
cdk_attrs
};
/* Information about the parameters in a function declarator. */
struct c_arg_info {
/* A list of parameter decls. */
tree parms;
/* A list of structure, union and enum tags defined. */
tree tags;
/* A list of argument types to go in the FUNCTION_TYPE. */
tree types;
/* A list of non-parameter decls (notably enumeration constants)
defined with the parameters. */
tree others;
/* A list of VLA sizes from the parameters. In a function
definition, these are used to ensure that side-effects in sizes
of arrays converted to pointers (such as a parameter int i[n++])
take place; otherwise, they are ignored. */
tree pending_sizes;
/* True when these arguments had [*]. */
BOOL_BITFIELD had_vla_unspec : 1;
};
/* A declarator. */
struct c_declarator {
/* The kind of declarator. */
enum c_declarator_kind kind;
/* Except for cdk_id, the contained declarator. For cdk_id, NULL. */
struct c_declarator *declarator;
location_t id_loc; /* Currently only set for cdk_id. */
union {
/* For identifiers, an IDENTIFIER_NODE or NULL_TREE if an abstract
declarator. */
tree id;
/* For functions. */
struct c_arg_info *arg_info;
/* For arrays. */
struct {
/* The array dimension, or NULL for [] and [*]. */
tree dimen;
/* The qualifiers inside []. */
int quals;
/* The attributes (currently ignored) inside []. */
tree attrs;
/* Whether [static] was used. */
BOOL_BITFIELD static_p : 1;
/* Whether [*] was used. */
BOOL_BITFIELD vla_unspec_p : 1;
} array;
/* For pointers, the qualifiers on the pointer type. */
int pointer_quals;
/* For attributes. */
tree attrs;
} u;
};
/* A type name. */
struct c_type_name {
/* The declaration specifiers. */
struct c_declspecs *specs;
/* The declarator. */
struct c_declarator *declarator;
};
/* A parameter. */
struct c_parm {
/* The declaration specifiers, minus any prefix attributes. */
struct c_declspecs *specs;
/* The attributes. */
tree attrs;
/* The declarator. */
struct c_declarator *declarator;
};
/* Save and restore the variables in this file and elsewhere
that keep track of the progress of compilation of the current function.
@ -159,140 +376,219 @@ struct lang_type GTY(())
struct language_function GTY(())
{
struct c_language_function base;
tree x_break_label;
tree x_cont_label;
struct c_switch * GTY((skip)) x_switch_stack;
struct c_arg_info * GTY((skip)) arg_info;
int returns_value;
int returns_null;
int returns_abnormally;
int warn_about_return_type;
int extern_inline;
int x_in_iteration_stmt;
int x_in_case_stmt;
};
/* Save lists of labels used or defined in particular contexts.
Allocated on the parser obstack. */
struct c_label_list
{
/* The label at the head of the list. */
tree label;
/* The rest of the list. */
struct c_label_list *next;
};
/* Statement expression context. */
struct c_label_context_se
{
/* The labels defined at this level of nesting. */
struct c_label_list *labels_def;
/* The labels used at this level of nesting. */
struct c_label_list *labels_used;
/* The next outermost context. */
struct c_label_context_se *next;
};
/* Context of variably modified declarations. */
struct c_label_context_vm
{
/* The labels defined at this level of nesting. */
struct c_label_list *labels_def;
/* The labels used at this level of nesting. */
struct c_label_list *labels_used;
/* The scope of this context. Multiple contexts may be at the same
numbered scope, since each variably modified declaration starts a
new context. */
unsigned scope;
/* The next outermost context. */
struct c_label_context_vm *next;
};
/* in c-parse.in */
/* in c-parser.c */
extern void c_parse_init (void);
/* in c-aux-info.c */
extern void gen_aux_info_record (tree, int, int, int);
/* in c-decl.c */
extern int c_in_iteration_stmt;
extern int c_in_case_stmt;
extern struct obstack parser_obstack;
extern tree c_break_label;
extern tree c_cont_label;
extern int global_bindings_p (void);
extern tree getdecls (void);
extern void pushlevel (int);
extern void push_scope (void);
extern tree pop_scope (void);
extern void insert_block (tree);
extern void set_block (tree);
extern tree pushdecl (tree);
extern void c_expand_body (tree);
extern void c_init_decl_processing (void);
extern void c_dup_lang_specific_decl (tree);
extern void c_print_identifier (FILE *, tree, int);
extern tree build_array_declarator (tree, tree, int, int);
extern int quals_from_declspecs (const struct c_declspecs *);
extern struct c_declarator *build_array_declarator (tree, struct c_declspecs *,
bool, bool);
extern tree build_enumerator (tree, tree);
extern void check_for_loop_decls (void);
extern tree check_for_loop_decls (void);
extern void mark_forward_parm_decls (void);
extern int complete_array_type (tree, tree, int);
extern void declare_parm_level (void);
extern void undeclared_variable (tree);
extern void undeclared_variable (tree, location_t);
extern tree declare_label (tree);
extern tree define_label (location_t, tree);
extern void c_maybe_initialize_eh (void);
extern void finish_decl (tree, tree, tree);
extern tree finish_enum (tree, tree, tree);
extern void finish_function (void);
extern tree finish_struct (tree, tree, tree);
extern tree get_parm_info (int);
extern tree grokfield (tree, tree, tree);
extern tree groktypename (tree);
extern tree groktypename_in_parm_context (tree);
extern struct c_arg_info *get_parm_info (bool);
extern tree grokfield (struct c_declarator *, struct c_declspecs *, tree);
extern tree groktypename (struct c_type_name *);
extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree);
extern int in_parm_level_p (void);
extern void keep_next_level (void);
extern tree lookup_name (tree);
extern void pending_xref_error (void);
extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *);
extern void push_parm_decl (tree);
extern tree pushdecl_top_level (tree);
extern void pushtag (tree, tree);
extern tree set_array_declarator_type (tree, tree, int);
extern void shadow_tag (tree);
extern void shadow_tag_warned (tree, int);
extern void push_parm_decl (const struct c_parm *);
extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
struct c_declarator *,
bool);
extern tree builtin_function (const char *, tree, int, enum built_in_class,
const char *, tree);
extern void shadow_tag (const struct c_declspecs *);
extern void shadow_tag_warned (const struct c_declspecs *, int);
extern tree start_enum (tree);
extern int start_function (tree, tree, tree);
extern tree start_decl (tree, tree, int, tree);
extern int start_function (struct c_declspecs *, struct c_declarator *, tree);
extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool,
tree);
extern tree start_struct (enum tree_code, tree);
extern void store_parm_decls (void);
extern void store_parm_decls_from (struct c_arg_info *);
extern tree xref_tag (enum tree_code, tree);
extern tree c_begin_compound_stmt (void);
extern void c_expand_deferred_function (tree);
extern void c_expand_decl_stmt (tree);
extern void c_static_assembler_name (tree);
extern tree make_pointer_declarator (tree, tree);
extern void merge_translation_unit_decls (void);
extern struct c_typespec parser_xref_tag (enum tree_code, tree);
extern int c_expand_decl (tree);
extern struct c_parm *build_c_parm (struct c_declspecs *, tree,
struct c_declarator *);
extern struct c_declarator *build_attrs_declarator (tree,
struct c_declarator *);
extern struct c_declarator *build_function_declarator (struct c_arg_info *,
struct c_declarator *);
extern struct c_declarator *build_id_declarator (tree);
extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
struct c_declarator *);
extern struct c_declspecs *build_null_declspecs (void);
extern struct c_declspecs *declspecs_add_qual (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_type (struct c_declspecs *,
struct c_typespec);
extern struct c_declspecs *declspecs_add_scspec (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree);
extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
/* in c-objc-common.c */
extern int c_disregard_inline_limits (tree);
extern int c_cannot_inline_tree_fn (tree *);
extern bool c_objc_common_init (void);
extern int c_missing_noreturn_ok_p (tree);
extern void c_objc_common_finish_file (void);
extern int defer_fn (tree);
extern bool c_missing_noreturn_ok_p (tree);
extern tree c_objc_common_truthvalue_conversion (tree expr);
extern bool c_warn_unused_global_decl (tree);
extern void c_initialize_diagnostics (diagnostic_context *);
extern bool c_vla_unspec_p (tree x, tree fn);
#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \
c_build_qualified_type ((TYPE), \
((CONST_P) ? TYPE_QUAL_CONST : 0) | \
((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
#define c_sizeof_nowarn(T) c_sizeof_or_alignof_type (T, SIZEOF_EXPR, 0)
/* in c-typeck.c */
extern int in_alignof;
extern int in_sizeof;
extern int in_typeof;
/* For use with comptypes. */
enum {
COMPARE_STRICT = 0
};
extern struct c_switch *c_switch_stack;
extern struct c_label_context_se *label_context_stack_se;
extern struct c_label_context_vm *label_context_stack_vm;
extern tree require_complete_type (tree);
extern int comptypes (tree, tree, int);
extern tree c_size_in_bytes (tree);
extern int same_translation_unit_p (tree, tree);
extern int comptypes (tree, tree);
extern bool c_vla_type_p (tree);
extern bool c_mark_addressable (tree);
extern void c_incomplete_type_error (tree, tree);
extern tree c_type_promotes_to (tree);
extern struct c_expr default_function_array_conversion (struct c_expr);
extern tree composite_type (tree, tree);
extern tree build_component_ref (tree, tree);
extern tree build_indirect_ref (tree, const char *);
extern tree build_array_ref (tree, tree);
extern tree build_external_ref (tree, int);
extern tree parser_build_binary_op (enum tree_code, tree, tree);
extern int c_tree_expr_nonnegative_p (tree);
extern void readonly_error (tree, const char *);
extern tree build_external_ref (tree, int, location_t);
extern void pop_maybe_used (bool);
extern struct c_expr c_expr_sizeof_expr (struct c_expr);
extern struct c_expr c_expr_sizeof_type (struct c_type_name *);
extern struct c_expr parser_build_unary_op (enum tree_code, struct c_expr);
extern struct c_expr parser_build_binary_op (enum tree_code, struct c_expr,
struct c_expr);
extern tree build_conditional_expr (tree, tree, tree);
extern tree build_compound_expr (tree);
extern tree c_cast_expr (tree, tree);
extern tree build_compound_expr (tree, tree);
extern tree c_cast_expr (struct c_type_name *, tree);
extern tree build_c_cast (tree, tree);
extern tree build_modify_expr (tree, enum tree_code, tree);
extern void store_init_value (tree, tree);
extern void error_init (const char *);
extern void pedwarn_init (const char *);
extern void maybe_warn_string_init (tree, struct c_expr);
extern void start_init (tree, tree, int);
extern void finish_init (void);
extern void really_start_incremental_init (tree);
extern void push_init_level (int);
extern tree pop_init_level (int);
extern struct c_expr pop_init_level (int);
extern void set_init_index (tree, tree);
extern void set_init_label (tree);
extern void process_init_element (tree);
extern void process_init_element (struct c_expr);
extern tree build_compound_literal (tree, tree);
extern void pedwarn_c90 (const char *, ...) ATTRIBUTE_PRINTF_1;
extern void pedwarn_c99 (const char *, ...) ATTRIBUTE_PRINTF_1;
extern tree c_start_case (tree);
extern void c_finish_case (void);
extern tree simple_asm_stmt (tree);
extern tree build_asm_stmt (tree, tree, tree, tree, tree);
extern void c_finish_case (tree);
extern tree build_asm_expr (tree, tree, tree, tree, bool);
extern tree build_asm_stmt (tree, tree);
extern tree c_convert_parm_for_inlining (tree, tree, tree, int);
extern int c_types_compatible_p (tree, tree);
extern tree c_begin_compound_stmt (bool);
extern tree c_end_compound_stmt (tree, bool);
extern void c_finish_if_stmt (location_t, tree, tree, tree, bool);
extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool);
extern tree c_begin_stmt_expr (void);
extern tree c_finish_stmt_expr (tree);
extern tree c_process_expr_stmt (tree);
extern tree c_finish_expr_stmt (tree);
extern tree c_finish_return (tree);
extern tree c_finish_bc_stmt (tree *, bool);
extern tree c_finish_goto_label (tree);
extern tree c_finish_goto_ptr (tree);
extern void c_begin_vm_scope (unsigned int);
extern void c_end_vm_scope (unsigned int);
extern tree c_expr_to_decl (tree, bool *, bool *, bool *);
extern tree c_begin_omp_parallel (void);
extern tree c_finish_omp_parallel (tree, tree);
extern tree c_finish_omp_clauses (tree);
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen. */
@ -313,18 +609,28 @@ extern int current_function_returns_abnormally;
extern int system_header_p;
/* True means global_bindings_p should return false even if the scope stack
says we are in file scope. */
extern bool c_override_global_bindings_to_false;
/* True means we've initialized exception handling. */
extern bool c_eh_initialized_p;
/* In c-decl.c */
extern void c_finish_incomplete_decl (tree);
extern void *get_current_scope (void);
extern void objc_mark_locals_volatile (void *);
extern void c_write_global_declarations (void);
extern GTY(()) tree static_ctors;
extern GTY(()) tree static_dtors;
/* In order for the format checking to accept the C frontend
diagnostic framework extensions, you must include this file before
toplev.h, not after. */
#define GCC_DIAG_STYLE __gcc_cdiag__
#if GCC_VERSION >= 4001
#define ATTRIBUTE_GCC_CDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
#else
#define ATTRIBUTE_GCC_CDIAG(m, n) ATTRIBUTE_NONNULL(m)
#endif
extern void pedwarn_c90 (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
extern void pedwarn_c99 (const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2);
#endif /* ! GCC_C_TREE_H */

View File

@ -1,5 +1,5 @@
; Options for the C, ObjC, C++ and ObjC++ front ends.
; Copyright (C) 2003 Free Software Foundation, Inc.
; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
@ -7,59 +7,21 @@
; 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.
;
;
; GCC 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 GCC; see the file COPYING. If not, write to the Free
; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
; 02110-1301, USA.
; This file is processed by the script opts.sh. It is a database of
; command line options, with each record separated by a blank line,
; and each field appearing on its own line. The first field is the
; command-line switch with the leading "-" removed. All options
; beginning with "f" or "W" are implicitly assumed to take a "no-"
; form; this form should not be listed. If you do not want this
; negative form and you want it to be automatically rejected, add
; RejectNegative to the second field.
; The second field is a space-separated list of which parts of the
; compiler recognize the switch, as declared by "Language" entries.
; If the switch takes an argument, then you should also specify
; "Joined" and/or "Separate" to indicate where the argument can
; appear. If a Joined argument can legitimately be omitted, specify
; "JoinedOrMissing" instead of "Joined". If the argument to a switch
; is a non-negative integer, you can specify "UInteger" and the switch
; decoder will convert the argument for you, or complain to the user
; if the argument is invalid.
; The third field is the help text to output with --help. This is
; automatically line-wrapped on output. Normally the switch is output
; automatically, with the help text on the right hand side of the
; output. However, if the help text contains a tab character, the
; text to the left of the tab is output instead of the switch, and the
; text to its right forms the help. This is useful for elaborating on
; what type of argument a switch takes, for example. If the second
; field contains "Undocumented" then nothing is output with --help.
; Only do this with good reason like the switch being internal between
; the driver and the front end - it is not an excuse to leave a switch
; undocumented.
; Comments can appear on their own line anwhere in the file, preceded
; by a semicolon. Whitespace is permitted before the semicolon.
; For each switch XXX below, an enumeration constant is created by the
; script opts.sh spelt OPT_XXX, but with all non-alphanumeric
; characters replaced with an underscore.
; Please try to keep this file in ASCII collating order.
; See the GCC internals manual for a description of this file's format.
; $FreeBSD$
; Please try to keep this file in ASCII collating order.
Language
C
@ -95,13 +57,17 @@ C ObjC C++ ObjC++ Joined Separate
E
C ObjC C++ ObjC++ Undocumented
F
C ObjC C++ ObjC++ Joined Separate
-F <dir> Add <dir> to the end of the main framework include path
H
C ObjC C++ ObjC++
Print the name of header files as they are used
I
C ObjC C++ ObjC++ Joined Separate
-I <dir> Add <dir> to the end of the main include path. -I- gives more include path control; see info documentation
-I <dir> Add <dir> to the end of the main include path
M
C ObjC C++ ObjC++
@ -148,22 +114,36 @@ C ObjC C++ ObjC++ Joined Separate
-U<macro> Undefine <macro>
Wabi
C++ ObjC++
C++ ObjC++ Var(warn_abi)
Warn about things that will change when compiling with an ABI-compliant compiler
Waddress
C ObjC C++ ObjC++ Var(warn_address)
Warn about suspicious uses of memory addresses
Wall
C ObjC C++ ObjC++
Enable most warning messages
Wassign-intercept
ObjC ObjC++ Var(warn_assign_intercept)
Warn whenever an Objective-C assignment is being intercepted by the garbage collector
Wbad-function-cast
C ObjC
C ObjC Var(warn_bad_function_cast)
Warn about casting functions to incompatible types
Wc++-compat
C ObjC Var(warn_cxx_compat)
Warn about C constructs that are not in the common subset of C and C++
Wcast-qual
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_cast_qual)
Warn about casts which discard qualifiers
Wchar-subscripts
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_char_subscripts)
Warn about subscripts whose type is \"char\"
Wcomment
@ -175,27 +155,27 @@ C ObjC C++ ObjC++
Synonym for -Wcomment
Wconversion
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_conversion)
Warn about possibly confusing type conversions
Wctor-dtor-privacy
C++ ObjC++
C++ ObjC++ Var(warn_ctor_dtor_privacy)
Warn when all constructors and destructors are private
Wdeclaration-after-statement
C ObjC
C ObjC Var(warn_declaration_after_statement)
Warn when a declaration is found after a statement
Wdeprecated
C++ ObjC++
C++ ObjC++ Var(warn_deprecated) Init(1)
Warn about deprecated compiler features
Wdiv-by-zero
C ObjC
C ObjC C++ ObjC++ Var(warn_div_by_zero) Init(1)
Warn about compile-time integer division by zero
Weffc++
C++ ObjC++
C++ ObjC++ Var(warn_ecpp)
Warn about violations of Effective C++ style rules
Wendif-labels
@ -211,7 +191,7 @@ C ObjC RejectNegative
Make implicit function declarations an error
Wfloat-equal
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_float_equal)
Warn if testing floating point numbers for equality
Wformat
@ -219,48 +199,53 @@ C ObjC C++ ObjC++
Warn about printf/scanf/strftime/strfmon format string anomalies
Wformat-extra-args
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_format_extra_args)
Warn if passing too many arguments to a function for its format string
Wformat-nonliteral
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_format_nonliteral)
Warn about format strings that are not literals
Wformat-security
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_format_security)
Warn about possible security problems with format functions
Wformat-y2k
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_format_y2k)
Warn about strftime formats yielding 2-digit years
Wformat-zero-length
C ObjC
C ObjC Var(warn_format_zero_length)
Warn about zero-length formats
Wformat=
C ObjC C++ ObjC++ Joined
Winit-self
C ObjC C++ ObjC++
Warn about variables which are initialized to themselves.
C ObjC C++ ObjC++ Var(warn_init_self)
Warn about variables which are initialized to themselves
Wimplicit
C ObjC C++ ObjC++
Wimplicit-function-declaration
C ObjC
C ObjC Var(mesg_implicit_function_declaration) Init(-1)
Warn about implicit function declarations
Wimplicit-int
C ObjC
C ObjC Var(warn_implicit_int)
Warn when a declaration does not specify a type
Wimport
C ObjC C++ ObjC++
Deprecated. This switch has no effect.
Deprecated. This switch has no effect
Wint-to-pointer-cast
C ObjC Var(warn_int_to_pointer_cast) Init(1)
Warn when there is a cast to a pointer from an integer of a different size
Winvalid-offsetof
C++ ObjC++
C++ ObjC++ Var(warn_invalid_offsetof) Init(1)
Warn about invalid uses of the \"offsetof\" macro
Winvalid-pch
@ -268,7 +253,7 @@ C ObjC C++ ObjC++
Warn about PCH files that are found but not used
Wlong-long
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_long_long) Init(1)
Do not warn about using \"long long\" when -pedantic
Wmain
@ -276,19 +261,27 @@ C ObjC
Warn about suspicious declarations of \"main\"
Wmissing-braces
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_missing_braces)
Warn about possibly missing braces around initializers
Wmissing-declarations
C ObjC
C ObjC Var(warn_missing_declarations)
Warn about global functions without previous declarations
Wmissing-field-initializers
C ObjC C++ ObjC++ Var(warn_missing_field_initializers) Init(-1)
Warn about missing fields in struct initializers
Wmissing-format-attribute
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_missing_format_attribute)
Warn about functions which might be candidates for format attributes
Wmissing-include-dirs
C ObjC C++ ObjC++
Warn about user-specified include directories that do not exist
Wmissing-prototypes
C ObjC
C ObjC Var(warn_missing_prototypes)
Warn about global functions without prototypes
Wmultichar
@ -296,82 +289,111 @@ C ObjC C++ ObjC++
Warn about use of multi-character character constants
Wnested-externs
C ObjC
C ObjC Var(warn_nested_externs)
Warn about \"extern\" declarations not at file scope
Wnon-template-friend
C++ ObjC++
C++ ObjC++ Var(warn_nontemplate_friend) Init(1)
Warn when non-templatized friend functions are declared within a template
Wnon-virtual-dtor
C++ ObjC++
C++ ObjC++ Var(warn_nonvdtor)
Warn about non-virtual destructors
Wnonnull
C ObjC
C ObjC Var(warn_nonnull)
Warn about NULL being passed to argument slots marked as requiring non-NULL
Wnormalized=
C ObjC C++ ObjC++ Joined
-Wnormalized=<id|nfc|nfkc> Warn about non-normalised Unicode strings
Wold-style-cast
C++ ObjC++
C++ ObjC++ Var(warn_old_style_cast)
Warn if a C-style cast is used in a program
Wold-style-definition
C ObjC
C ObjC Var(warn_old_style_definition)
Warn if an old-style parameter definition is used
Woverlength-strings
C ObjC C++ ObjC++ Var(warn_overlength_strings) Init(-1)
Warn if a string is longer than the maximum portable length specified by the standard
Woverloaded-virtual
C++ ObjC++
C++ ObjC++ Var(warn_overloaded_virtual)
Warn about overloaded virtual function names
Woverride-init
C ObjC Var(warn_override_init) Init(-1)
Warn about overriding initializers without side effects
Wparentheses
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_parentheses)
Warn about possibly missing parentheses
Wpmf-conversions
C++ ObjC++
C++ ObjC++ Var(warn_pmf2ptr) Init(1)
Warn when converting the type of pointers to member functions
Wpointer-arith
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_pointer_arith)
Warn about function pointer arithmetic
Wpointer-to-int-cast
C ObjC Var(warn_pointer_to_int_cast) Init(1)
Warn when a pointer is cast to an integer of a different size
Wpragmas
C ObjC C++ ObjC++ Var(warn_pragmas) Init(1)
Warn about misuses of pragmas
Wprotocol
ObjC ObjC++
ObjC ObjC++ Var(warn_protocol) Init(1)
Warn if inherited methods are unimplemented
Wredundant-decls
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_redundant_decls)
Warn about multiple declarations of the same object
Wreorder
C++ ObjC++
C++ ObjC++ Var(warn_reorder)
Warn when the compiler reorders code
Wreturn-type
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_return_type)
Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++)
Wselector
ObjC ObjC++
ObjC ObjC++ Var(warn_selector)
Warn if a selector has multiple methods
Wsequence-point
C ObjC
C ObjC C++ ObjC++ Var(warn_sequence_point)
Warn about possible violations of sequence point rules
Wsign-compare
C ObjC C++ ObjC++
C ObjC C++ ObjC++ Var(warn_sign_compare) Init(-1)
Warn about signed-unsigned comparisons
Wsign-promo
C++ ObjC++
C++ ObjC++ Var(warn_sign_promo)
Warn when overload promotes from unsigned to signed
Wstrict-null-sentinel
C++ ObjC++
Warn about uncasted NULL used as sentinel
Wstrict-prototypes
C ObjC
C ObjC Var(warn_strict_prototypes)
Warn about unprototyped function declarations
Wstrict-selector-match
ObjC ObjC++ Var(warn_strict_selector_match)
Warn if type signatures of candidate methods do not match exactly
Wsynth
C++ ObjC++
C++ ObjC++ Var(warn_synth)
Warn when synthesis behavior differs from Cfront
Wsystem-headers
@ -379,7 +401,7 @@ C ObjC C++ ObjC++
Do not suppress warnings from system headers
Wtraditional
C ObjC
C ObjC Var(warn_traditional)
Warn about features not present in traditional C
Wtrigraphs
@ -387,7 +409,8 @@ C ObjC C++ ObjC++
Warn if trigraphs are encountered that might affect the meaning of the program
Wundeclared-selector
ObjC ObjC++
ObjC ObjC++ Var(warn_undeclared_selector)
Warn about @selector()s without previously declared methods
Wundef
C ObjC C++ ObjC++
@ -401,13 +424,21 @@ Wunused-macros
C ObjC C++ ObjC++
Warn about macros defined in the main file that are not used
Wwrite-strings
Wvariadic-macros
C ObjC C++ ObjC++
Give strings the type \"array of char\"
Do not warn about using variadic macros when -pedantic
Wwrite-strings
C ObjC C++ ObjC++ Var(warn_write_strings)
In C++, nonzero means warn about deprecated conversion from string literals to `char *'. In C, similar warning, except that the conversion is of course not deprecated by the ISO C standard.
Wpointer-sign
C ObjC Var(warn_pointer_sign) Init(-1)
Warn when a pointer differs in signedness in an assignment
ansi
C ObjC C++ ObjC++
A synonym for -std=c89 (for C) or -std=c++98 (for C++).
A synonym for -std=c89 (for C) or -std=c++98 (for C++)
d
C ObjC C++ ObjC++ Joined
@ -447,10 +478,6 @@ fconserve-space
C++ ObjC++
Reduce the size of object files
fconst-strings
C++ ObjC++
Make string literals \"const char[]\" not \"char[]\"
fconstant-string-class=
ObjC ObjC++ Joined
-fconst-string-class=<name> Use class <name> for constant strings
@ -463,10 +490,6 @@ fdollars-in-identifiers
C ObjC C++ ObjC++
Permit '$' as an identifier character
fdump-
C ObjC C++ ObjC++ Joined RejectNegative
-fdump-<type> Dump various compiler internals to a file
felide-constructors
C++ ObjC++
@ -481,20 +504,18 @@ fexec-charset=
C ObjC C++ ObjC++ Joined RejectNegative
-fexec-charset=<cset> Convert all strings and character constants to character set <cset>
fextended-identifiers
C ObjC C++ ObjC++
Permit universal character names (\\u and \\U) in identifiers
finput-charset=
C ObjC C++ ObjC++ Joined RejectNegative
-finput-charset=<cset> Specify the default character set for source files.
-finput-charset=<cset> Specify the default character set for source files
fexternal-templates
C++ ObjC++
ffixed-form
C ObjC
ffixed-line-length-
C ObjC Joined
ffor-scope
C++ ObjC++
Scope of for-init-statement variables is local to the loop
@ -511,6 +532,10 @@ fgnu-runtime
ObjC ObjC++
Generate code for GNU runtime environment
fgnu89-inline
C ObjC Var(flag_gnu89_inline) Init(-1)
Use traditional GNU semantics for inline functions
fguiding-decls
C++ ObjC++
@ -540,6 +565,10 @@ fimplicit-templates
C++ ObjC++
Emit implicit instantiations of templates
ffriend-injection
C++ ObjC++ Var(flag_friend_injection)
Inject friend functions into enclosing namespace
flabels-ok
C++ ObjC++
@ -567,10 +596,35 @@ C++ ObjC++
fnonnull-objects
C++ ObjC++
; Generate special '- .cxx_construct' and '- .cxx_destruct' methods
; to initialize any non-POD ivars in Objective-C++ classes.
fobjc-call-cxx-cdtors
ObjC++ Var(flag_objc_call_cxx_cdtors)
Generate special Objective-C methods to initialize/destroy non-POD C++ ivars, if needed
fobjc-direct-dispatch
ObjC ObjC++ Var(flag_objc_direct_dispatch)
Allow fast jumps to the message dispatcher
; Nonzero means that we will allow new ObjC exception syntax (@throw,
; @try, etc.) in source code.
fobjc-exceptions
ObjC ObjC++
ObjC ObjC++ Var(flag_objc_exceptions)
Enable Objective-C exception and synchronization syntax
fobjc-gc
ObjC ObjC++ Var(flag_objc_gc)
Enable garbage collection (GC) in Objective-C/Objective-C++ programs
; Nonzero means that we generate NeXT setjmp based exceptions.
fobjc-sjlj-exceptions
ObjC ObjC++ Var(flag_objc_sjlj_exceptions) Init(-1)
Enable Objective-C setjmp exception handling runtime
fopenmp
C ObjC C++ ObjC++ Var(flag_openmp)
Enable OpenMP
foperator-names
C++ ObjC++
Recognize C++ kewords like \"compl\" and \"xor\"
@ -582,6 +636,10 @@ Enable optional diagnostics
fpch-deps
C ObjC C++ ObjC++
fpch-preprocess
C ObjC C++ ObjC++
Look for and use PCH files even when preprocessing
fpermissive
C++ ObjC++
Downgrade conformance errors to warnings
@ -614,9 +672,6 @@ fshort-wchar
C ObjC C++ ObjC++
Force the underlying type for \"wchar_t\" to be \"unsigned short\"
fshow-column
C ObjC C++ ObjC++
fsigned-bitfields
C ObjC C++ ObjC++
When \"signed\" or \"unsigned\" is not given make the bitfield signed
@ -640,12 +695,16 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger
-ftabstop=<number> Distance between tab stops for column reporting
ftemplate-depth-
C++ ObjC++ Joined RejectNegative UInteger
C++ ObjC++ Joined RejectNegative UInteger
-ftemplate-depth-<number> Specify maximum template instantiation depth
fthis-is-variable
C++ ObjC++
fthreadsafe-statics
C++ ObjC++
-fno-threadsafe-statics Do not generate thread-safe code for initializing local statics
funsigned-bitfields
C ObjC C++ ObjC++
When \"signed\" or \"unsigned\" is not given make the bitfield unsigned
@ -658,6 +717,14 @@ fuse-cxa-atexit
C++ ObjC++
Use __cxa_atexit to register destructors
fuse-cxa-get-exception-ptr
C++ ObjC++
Use __cxa_get_exception_ptr in exception handling
fvisibility-inlines-hidden
C++ ObjC++
Marks all inlined methods as having hidden visibility
fvtable-gc
C++ ObjC++
Discard unused virtual functions
@ -698,6 +765,10 @@ imacros
C ObjC C++ ObjC++ Joined Separate
-imacros <file> Accept definition of macros in <file>
imultilib
C ObjC C++ ObjC++ Joined Separate
-imultilib <dir> Set <dir> to be the multilib include subdirectory
include
C ObjC C++ ObjC++ Joined Separate
-include <file> Include the contents of <file> before other files
@ -714,6 +785,10 @@ isystem
C ObjC C++ ObjC++ Joined Separate
-isystem <dir> Add <dir> to the start of the system include path
iquote
C ObjC C++ ObjC++ Joined Separate
-iquote <dir> Add <dir> to the end of the quote include path
iwithprefix
C ObjC C++ ObjC++ Joined Separate
-iwithprefix <dir> Add <dir> to the end of the system include path
@ -725,6 +800,9 @@ C ObjC C++ ObjC++ Joined Separate
lang-asm
C Undocumented
lang-fortran
C Undocumented
lang-objc
C ObjC C++ ObjC++ Undocumented
@ -752,6 +830,10 @@ print-objc-runtime-info
ObjC ObjC++
Generate C header of platform-specific features
print-pch-checksum
C ObjC C++ ObjC++
Print a checksum of the executable for PCH validity checking, and stop
remap
C ObjC C++ ObjC++
Remap file names when including files
@ -824,8 +906,4 @@ w
C ObjC C++ ObjC++
; Documented in common.opt
fformat-extensions
C ObjC C++ ObjC++
Enable FreeBSD format extensions
; This comment is to ensure we retain the blank line above.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
host-cygwin.o : $(srcdir)/config/i386/host-cygwin.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h hosthooks.h $(HOSTHOOKS_DEF_H) toplev.h diagnostic.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/i386/host-cygwin.c

View File

@ -1,5 +1,5 @@
/* OS independent definitions for AMD x86-64.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2005 Free Software Foundation, Inc.
Contributed by Bo Thorsen <bo@suse.de>.
This file is part of GCC.
@ -16,8 +16,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* $FreeBSD$ */
@ -51,22 +51,40 @@ Boston, MA 02111-1307, USA. */
#undef ASM_SPEC
#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
%{Wa,*:%*} %{m32:--32}"
%{Wa,*:%*} %{m32:--32} %{m64:--64}"
#undef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
x86_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
#undef ASM_OUTPUT_ALIGNED_COMMON
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN);
/* This is used to align code labels according to Intel recommendations. */
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
do { \
if ((LOG) != 0) { \
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
} \
} while (0)
#endif
/* i386 System V Release 4 uses DWARF debugging info.
x86-64 ABI specifies DWARF2. */
#define DWARF2_DEBUGGING_INFO 1
#define DWARF2_UNWIND_INFO 1
/* Incorrectly autodetected in cross compilation. */
#undef HAVE_AS_DWARF2_DEBUG_LINE
#define HAVE_AS_DWARF2_DEBUG_LINE 1
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
#undef TARGET_ASM_SELECT_SECTION
#define TARGET_ASM_SELECT_SECTION x86_64_elf_select_section
#undef TARGET_ASM_UNIQUE_SECTION
#define TARGET_ASM_UNIQUE_SECTION x86_64_elf_unique_section

View File

@ -1,4 +1,4 @@
host-linux.o : $(srcdir)/config/host-linux.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h hosthooks.h hosthooks-def.h
coretypes.h hosthooks.h hosthooks-def.h $(HOOKS_H)
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(srcdir)/config/host-linux.c

8147
contrib/gcc/configure vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Handle exceptional things in C++.
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Michael Tiemann <tiemann@cygnus.com>
Rewritten by Mike Stump <mrs@cygnus.com>, based upon an
initial re-implementation courtesy Tad Hunt.
@ -19,8 +19,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "config.h"
@ -37,6 +37,8 @@ Boston, MA 02111-1307, USA. */
#include "except.h"
#include "toplev.h"
#include "tree-inline.h"
#include "tree-iterator.h"
#include "target.h"
static void push_eh_cleanup (tree);
static tree prepare_eh_type (tree);
@ -51,7 +53,6 @@ static tree wrap_cleanups_r (tree *, int *, void *);
static int complete_ptr_ref_or_void_ptr_p (tree, tree);
static bool is_admissible_throw_operand (tree);
static int can_convert_eh (tree, tree);
static void check_handlers_1 (tree, tree);
static tree cp_protect_cleanup_actions (void);
/* Sets up all the global eh stuff that needs to be initialized at the
@ -79,6 +80,10 @@ init_exception_processing (void)
eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
? "__gxx_personality_sj0"
: "__gxx_personality_v0");
if (targetm.arm_eabi_unwinder)
unwind_resume_libfunc = init_one_libfunc ("__cxa_end_cleanup");
else
default_init_unwind_resume_libfunc ();
lang_eh_runtime_type = build_eh_type_type;
lang_protect_cleanup_actions = &cp_protect_cleanup_actions;
@ -95,7 +100,7 @@ cp_protect_cleanup_actions (void)
When the destruction of an object during stack unwinding exits
using an exception ... void terminate(); is called. */
return build_call (terminate_node, NULL_TREE);
}
}
static tree
prepare_eh_type (tree type)
@ -144,13 +149,33 @@ build_eh_type_type (tree type)
mark_used (exp);
return build1 (ADDR_EXPR, ptr_type_node, exp);
return convert (ptr_type_node, build_address (exp));
}
tree
build_exc_ptr (void)
{
return build (EXC_PTR_EXPR, ptr_type_node);
return build0 (EXC_PTR_EXPR, ptr_type_node);
}
/* Build up a call to __cxa_get_exception_ptr so that we can build a
copy constructor for the thrown object. */
static tree
do_get_exception_ptr (void)
{
tree fn;
fn = get_identifier ("__cxa_get_exception_ptr");
if (!get_global_value_if_present (fn, &fn))
{
/* Declare void* __cxa_get_exception_ptr (void *). */
tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
}
return build_function_call (fn, tree_cons (NULL_TREE, build_exc_ptr (),
NULL_TREE));
}
/* Build up a call to __cxa_begin_catch, to tell the runtime that the
@ -182,9 +207,12 @@ dtor_nothrow (tree type)
if (type == NULL_TREE)
return 0;
if (! TYPE_HAS_DESTRUCTOR (type))
if (!CLASS_TYPE_P (type))
return 1;
if (CLASSTYPE_LAZY_DESTRUCTOR (type))
lazily_declare_fn (sfk_destructor, type);
return TREE_NOTHROW (CLASSTYPE_DESTRUCTORS (type));
}
@ -236,8 +264,8 @@ decl_is_java_type (tree decl, int err)
&& TYPE_FOR_JAVA (TREE_TYPE (decl)))
{
/* Can't throw a reference. */
error ("type `%T' is disallowed in Java `throw' or `catch'",
decl);
error ("type %qT is disallowed in Java %<throw%> or %<catch%>",
decl);
}
if (r)
@ -247,15 +275,15 @@ decl_is_java_type (tree decl, int err)
if (jthrow_node == NULL_TREE)
fatal_error
("call to Java `catch' or `throw' with `jthrowable' undefined");
("call to Java %<catch%> or %<throw%> with %<jthrowable%> undefined");
jthrow_node = TREE_TYPE (TREE_TYPE (jthrow_node));
if (! DERIVED_FROM_P (jthrow_node, TREE_TYPE (decl)))
{
/* Thrown object must be a Throwable. */
error ("type `%T' is not derived from `java::lang::Throwable'",
TREE_TYPE (decl));
error ("type %qT is not derived from %<java::lang::Throwable%>",
TREE_TYPE (decl));
}
}
}
@ -312,7 +340,7 @@ choose_personality_routine (enum languages lang)
break;
default:
abort ();
gcc_unreachable ();
}
return;
@ -323,7 +351,7 @@ choose_personality_routine (enum languages lang)
/* Initialize the catch parameter DECL. */
static void
static void
initialize_handler_parm (tree decl, tree exp)
{
tree init;
@ -334,11 +362,10 @@ initialize_handler_parm (tree decl, tree exp)
TREE_USED (decl) = 1;
/* Figure out the type that the initializer is. Pointers are returned
adjusted by value from __cxa_begin_catch. Others are returned by
adjusted by value from __cxa_begin_catch. Others are returned by
reference. */
init_type = TREE_TYPE (decl);
if (! TYPE_PTR_P (init_type)
&& TREE_CODE (init_type) != REFERENCE_TYPE)
if (!POINTER_TYPE_P (init_type))
init_type = build_reference_type (init_type);
choose_personality_routine (decl_is_java_type (init_type, 0)
@ -365,12 +392,10 @@ initialize_handler_parm (tree decl, tree exp)
init = build1 (MUST_NOT_THROW_EXPR, TREE_TYPE (init), init);
}
/* Let `cp_finish_decl' know that this initializer is ok. */
DECL_INITIAL (decl) = error_mark_node;
decl = pushdecl (decl);
start_decl_1 (decl);
cp_finish_decl (decl, init, NULL_TREE,
start_decl_1 (decl, true);
cp_finish_decl (decl, init, /*init_const_expr_p=*/false, NULL_TREE,
LOOKUP_ONLYCONVERTING|DIRECT_BIND);
}
@ -379,61 +404,73 @@ initialize_handler_parm (tree decl, tree exp)
tree
expand_start_catch_block (tree decl)
{
tree exp = NULL_TREE;
tree exp;
tree type;
bool is_java;
if (! doing_eh (1))
return NULL_TREE;
/* Make sure this declaration is reasonable. */
if (decl && !complete_ptr_ref_or_void_ptr_p (TREE_TYPE (decl), NULL_TREE))
decl = NULL_TREE;
decl = error_mark_node;
if (decl)
type = prepare_eh_type (TREE_TYPE (decl));
else
type = NULL_TREE;
is_java = false;
if (decl)
if (decl && decl_is_java_type (type, 1))
{
tree init;
if (decl_is_java_type (type, 1))
{
/* Java only passes object via pointer and doesn't require
adjusting. The java object is immediately before the
generic exception header. */
init = build_exc_ptr ();
init = build1 (NOP_EXPR, build_pointer_type (type), init);
init = build (MINUS_EXPR, TREE_TYPE (init), init,
TYPE_SIZE_UNIT (TREE_TYPE (init)));
init = build_indirect_ref (init, NULL);
is_java = true;
}
else
{
/* C++ requires that we call __cxa_begin_catch to get the
pointer to the actual object. */
init = do_begin_catch ();
}
exp = create_temporary_var (ptr_type_node);
DECL_REGISTER (exp) = 1;
cp_finish_decl (exp, init, NULL_TREE, LOOKUP_ONLYCONVERTING);
finish_expr_stmt (build_modify_expr (exp, INIT_EXPR, init));
/* Java only passes object via pointer and doesn't require
adjusting. The java object is immediately before the
generic exception header. */
exp = build_exc_ptr ();
exp = build1 (NOP_EXPR, build_pointer_type (type), exp);
exp = build2 (MINUS_EXPR, TREE_TYPE (exp), exp,
TYPE_SIZE_UNIT (TREE_TYPE (exp)));
exp = build_indirect_ref (exp, NULL);
initialize_handler_parm (decl, exp);
return type;
}
else
/* Call __cxa_end_catch at the end of processing the exception. */
push_eh_cleanup (type);
/* If there's no decl at all, then all we need to do is make sure
to tell the runtime that we've begun handling the exception. */
if (decl == NULL || decl == error_mark_node)
finish_expr_stmt (do_begin_catch ());
/* C++ requires that we call __cxa_end_catch at the end of
processing the exception. */
if (! is_java)
push_eh_cleanup (type);
/* If the C++ object needs constructing, we need to do that before
calling __cxa_begin_catch, so that std::uncaught_exception gets
the right value during the copy constructor. */
else if (flag_use_cxa_get_exception_ptr
&& TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
{
exp = do_get_exception_ptr ();
initialize_handler_parm (decl, exp);
finish_expr_stmt (do_begin_catch ());
}
if (decl)
initialize_handler_parm (decl, exp);
/* Otherwise the type uses a bitwise copy, and we don't have to worry
about the value of std::uncaught_exception and therefore can do the
copy with the return value of __cxa_end_catch instead. */
else
{
tree init = do_begin_catch ();
tree init_type = type;
/* Pointers are passed by values, everything else by reference. */
if (!TYPE_PTR_P (type))
init_type = build_pointer_type (type);
if (init_type != TREE_TYPE (init))
init = build1 (NOP_EXPR, init_type, init);
exp = create_temporary_var (init_type);
DECL_REGISTER (exp) = 1;
cp_finish_decl (exp, init, /*init_const_expr=*/false,
NULL_TREE, LOOKUP_ONLYCONVERTING);
initialize_handler_parm (decl, exp);
}
return type;
}
@ -462,6 +499,7 @@ begin_eh_spec_block (void)
{
tree r = build_stmt (EH_SPEC_BLOCK, NULL_TREE, NULL_TREE);
add_stmt (r);
EH_SPEC_STMTS (r) = push_stmt_list ();
return r;
}
@ -470,7 +508,7 @@ finish_eh_spec_block (tree raw_raises, tree eh_spec_block)
{
tree raises;
RECHAIN_STMTS (eh_spec_block, EH_SPEC_STMTS (eh_spec_block));
EH_SPEC_STMTS (eh_spec_block) = pop_stmt_list (EH_SPEC_STMTS (eh_spec_block));
/* Strip cv quals, etc, from the specification types. */
for (raises = NULL_TREE;
@ -501,7 +539,7 @@ do_allocate_exception (tree type)
tree tmp = tree_cons (NULL_TREE, size_type_node, void_list_node);
fn = push_library_fn (fn, build_function_type (ptr_type_node, tmp));
}
return build_function_call (fn, tree_cons (NULL_TREE, size_in_bytes (type),
NULL_TREE));
}
@ -530,7 +568,7 @@ do_free_exception (tree ptr)
static tree
wrap_cleanups_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED)
void *data ATTRIBUTE_UNUSED)
{
tree exp = *tp;
tree cleanup;
@ -567,17 +605,18 @@ build_throw (tree exp)
if (processing_template_decl)
{
current_function_returns_abnormally = 1;
if (cfun)
current_function_returns_abnormally = 1;
return build_min (THROW_EXPR, void_type_node, exp);
}
if (exp == null_node)
warning ("throwing NULL, which has integral, not pointer type");
warning (0, "throwing NULL, which has integral, not pointer type");
if (exp != NULL_TREE)
{
if (!is_admissible_throw_operand (exp))
return error_mark_node;
return error_mark_node;
}
if (! doing_eh (1))
@ -595,7 +634,7 @@ build_throw (tree exp)
}
else if (really_overloaded_fn (fn))
{
error ("`%D' should never be overloaded", fn);
error ("%qD should never be overloaded", fn);
return error_mark_node;
}
fn = OVL_CURRENT (fn);
@ -604,6 +643,7 @@ build_throw (tree exp)
else if (exp)
{
tree throw_type;
tree temp_type;
tree cleanup;
tree object, ptr;
tree tmp;
@ -618,7 +658,7 @@ build_throw (tree exp)
tmp = build_function_type (void_type_node, tmp);
cleanup_type = build_pointer_type (tmp);
}
fn = get_identifier ("__cxa_throw");
if (!get_global_value_if_present (fn, &fn))
{
@ -631,10 +671,18 @@ build_throw (tree exp)
tmp = build_function_type (void_type_node, tmp);
fn = push_throw_library_fn (fn, tmp);
}
/* throw expression */
/* First, decay it. */
exp = decay_conversion (exp);
/* [except.throw]
A throw-expression initializes a temporary object, the type
of which is determined by removing any top-level
cv-qualifiers from the static type of the operand of throw
and adjusting the type from "array of T" or "function return
T" to "pointer to T" or "pointer to function returning T"
respectively. */
temp_type = is_bitfield_expr_with_lowered_type (exp);
if (!temp_type)
temp_type = type_decays_to (TYPE_MAIN_VARIANT (TREE_TYPE (exp)));
/* OK, this is kind of wacky. The standard says that we call
terminate when the exception handling mechanism, after
@ -650,51 +698,70 @@ build_throw (tree exp)
matter, since it can't throw). */
/* Allocate the space for the exception. */
allocate_expr = do_allocate_exception (TREE_TYPE (exp));
allocate_expr = do_allocate_exception (temp_type);
allocate_expr = get_target_expr (allocate_expr);
ptr = TARGET_EXPR_SLOT (allocate_expr);
object = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (exp)), ptr);
object = build_nop (build_pointer_type (temp_type), ptr);
object = build_indirect_ref (object, NULL);
elided = (TREE_CODE (exp) == TARGET_EXPR);
/* And initialize the exception object. */
exp = build_init (object, exp, LOOKUP_ONLYCONVERTING);
if (exp == error_mark_node)
if (CLASS_TYPE_P (temp_type))
{
error (" in thrown expression");
return error_mark_node;
/* Call the copy constructor. */
exp = (build_special_member_call
(object, complete_ctor_identifier,
build_tree_list (NULL_TREE, exp),
TREE_TYPE (object),
LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING));
if (exp == error_mark_node)
{
error (" in thrown expression");
return error_mark_node;
}
}
else
exp = build2 (INIT_EXPR, temp_type, object,
decay_conversion (exp));
/* Pre-evaluate the thrown expression first, since if we allocated
the space first we would have to deal with cleaning it up if
evaluating this expression throws.
The case where EXP the initializer is a call to a constructor or a
function returning a class is a bit of a grey area in the
standard; it's unclear whether or not it should be allowed to
throw. We used to say no, as that allowed us to optimize this
case without worrying about deallocating the exception object if
it does. But that conflicted with expectations (PR 13944) and the
EDG compiler; now we wrap the initialization in a TRY_CATCH_EXPR
to call do_free_exception rather than in a MUST_NOT_THROW_EXPR,
for this case only.
The case where EXP the initializer is a cast or a function
returning a class is a bit of a grey area in the standard; it's
unclear whether or not it should be allowed to throw. We used to
say no, as that allowed us to optimize this case without worrying
about deallocating the exception object if it does. But that
conflicted with expectations (PR 13944) and the EDG compiler; now
we wrap the initialization in a TRY_CATCH_EXPR to call
do_free_exception rather than in a MUST_NOT_THROW_EXPR, for this
case only.
Note that we don't check the return value from stabilize_init
because it will only return false in cases where elided is true,
and therefore we don't need to work around the failure to
preevaluate. */
BUT: Issue 475 may do away with this inconsistency by removing the
terminate() in this situation.
Note that we don't check the return value from stabilize_init
because it will only return false in cases where elided is true,
and therefore we don't need to work around the failure to
preevaluate. */
temp_expr = NULL_TREE;
stabilize_init (exp, &temp_expr);
/* Wrap the initialization in a CLEANUP_POINT_EXPR so that cleanups
for temporaries within the initialization are run before the one
for the exception object, preserving LIFO order. */
exp = build1 (CLEANUP_POINT_EXPR, void_type_node, exp);
if (elided)
exp = build (TRY_CATCH_EXPR, void_type_node, exp,
do_free_exception (ptr));
exp = build2 (TRY_CATCH_EXPR, void_type_node, exp,
do_free_exception (ptr));
else
exp = build1 (MUST_NOT_THROW_EXPR, void_type_node, exp);
/* Prepend the allocation. */
exp = build (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp);
exp = build2 (COMPOUND_EXPR, TREE_TYPE (exp), allocate_expr, exp);
if (temp_expr)
{
/* Prepend the calculation of the throw expression. Also, force
@ -703,13 +770,13 @@ build_throw (tree exp)
them in MUST_NOT_THROW_EXPR, since they are run after the
exception object is initialized. */
walk_tree_without_duplicates (&temp_expr, wrap_cleanups_r, 0);
exp = build (COMPOUND_EXPR, TREE_TYPE (exp), temp_expr, exp);
exp = build2 (COMPOUND_EXPR, TREE_TYPE (exp), temp_expr, exp);
exp = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (exp), exp);
}
throw_type = build_eh_type_type (prepare_eh_type (TREE_TYPE (object)));
if (TYPE_HAS_DESTRUCTOR (TREE_TYPE (object)))
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (object)))
{
cleanup = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)),
complete_dtor_identifier, 0);
@ -720,10 +787,7 @@ build_throw (tree exp)
cleanup = build1 (ADDR_EXPR, cleanup_type, cleanup);
}
else
{
cleanup = build_int_2 (0, 0);
TREE_TYPE (cleanup) = cleanup_type;
}
cleanup = build_int_cst (cleanup_type, 0);
tmp = tree_cons (NULL_TREE, cleanup, NULL_TREE);
tmp = tree_cons (NULL_TREE, throw_type, tmp);
@ -732,7 +796,7 @@ build_throw (tree exp)
tmp = build_function_call (fn, tmp);
/* Tack on the initialization stuff. */
exp = build (COMPOUND_EXPR, TREE_TYPE (tmp), exp, tmp);
exp = build2 (COMPOUND_EXPR, TREE_TYPE (tmp), exp, tmp);
}
else
{
@ -747,7 +811,7 @@ build_throw (tree exp)
}
/* ??? Indicate that this function call allows exceptions of the type
of the enclosing catch block (if known). */
of the enclosing catch block (if known). */
exp = build_function_call (fn, NULL_TREE);
}
@ -765,22 +829,22 @@ static int
complete_ptr_ref_or_void_ptr_p (tree type, tree from)
{
int is_ptr;
/* Check complete. */
type = complete_type_or_else (type, from);
if (!type)
return 0;
/* Or a pointer or ref to one, or cv void *. */
is_ptr = TREE_CODE (type) == POINTER_TYPE;
if (is_ptr || TREE_CODE (type) == REFERENCE_TYPE)
{
tree core = TREE_TYPE (type);
if (is_ptr && VOID_TYPE_P (core))
/* OK */;
/* OK */;
else if (!complete_type_or_else (core, from))
return 0;
return 0;
}
return 1;
}
@ -795,21 +859,22 @@ is_admissible_throw_operand (tree expr)
tree type = TREE_TYPE (expr);
/* 15.1/4 [...] The type of the throw-expression shall not be an
incomplete type, or a pointer or a reference to an incomplete
type, other than void*, const void*, volatile void*, or
const volatile void*. Except for these restriction and the
restrictions on type matching mentioned in 15.3, the operand
of throw is treated exactly as a function argument in a call
(5.2.2) or the operand of a return statement. */
incomplete type, or a pointer or a reference to an incomplete
type, other than void*, const void*, volatile void*, or
const volatile void*. Except for these restriction and the
restrictions on type matching mentioned in 15.3, the operand
of throw is treated exactly as a function argument in a call
(5.2.2) or the operand of a return statement. */
if (!complete_ptr_ref_or_void_ptr_p (type, expr))
return false;
/* 10.4/3 An abstract class shall not be used as a parameter type,
as a function return type or as type of an explicit
conversion. */
as a function return type or as type of an explicit
conversion. */
else if (CLASS_TYPE_P (type) && CLASSTYPE_PURE_VIRTUALS (type))
{
error ("expression '%E' of abstract class type '%T' cannot be used in throw-expression", expr, type);
error ("expression %qE of abstract class type %qT cannot "
"be used in throw-expression", expr, type);
return false;
}
@ -840,7 +905,10 @@ nothrow_libfn_p (tree fn)
/* Can't be a C library function. */
return 0;
id = DECL_ASSEMBLER_NAME (fn);
/* Being a C library function, DECL_ASSEMBLER_NAME == DECL_NAME
unless the system headers are playing rename tricks, and if
they are, we don't want to be confused by them. */
id = DECL_NAME (fn);
return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
}
@ -874,51 +942,57 @@ can_convert_eh (tree to, tree from)
return 0;
}
/* Check whether any of HANDLERS are shadowed by another handler accepting
TYPE. Note that the shadowing may not be complete; even if an exception
of type B would be caught by a handler for A, there could be a derived
class C for which A is an ambiguous base but B is not, so the handler
for B would catch an exception of type C. */
/* Check whether any of the handlers in I are shadowed by another handler
accepting TYPE. Note that the shadowing may not be complete; even if
an exception of type B would be caught by a handler for A, there could
be a derived class C for which A is an ambiguous base but B is not, so
the handler for B would catch an exception of type C. */
static void
check_handlers_1 (tree master, tree handlers)
check_handlers_1 (tree master, tree_stmt_iterator i)
{
tree type = TREE_TYPE (master);
tree handler;
for (handler = handlers; handler; handler = TREE_CHAIN (handler))
if (TREE_TYPE (handler)
&& can_convert_eh (type, TREE_TYPE (handler)))
{
input_line = STMT_LINENO (handler);
warning ("exception of type `%T' will be caught",
TREE_TYPE (handler));
input_line = STMT_LINENO (master);
warning (" by earlier handler for `%T'", type);
break;
}
for (; !tsi_end_p (i); tsi_next (&i))
{
tree handler = tsi_stmt (i);
if (TREE_TYPE (handler) && can_convert_eh (type, TREE_TYPE (handler)))
{
warning (0, "%Hexception of type %qT will be caught",
EXPR_LOCUS (handler), TREE_TYPE (handler));
warning (0, "%H by earlier handler for %qT",
EXPR_LOCUS (master), type);
break;
}
}
}
/* Given a chain of HANDLERs, make sure that they're OK. */
/* Given a STATEMENT_LIST of HANDLERs, make sure that they're OK. */
void
check_handlers (tree handlers)
{
tree handler;
int save_line = input_line;
for (handler = handlers; handler; handler = TREE_CHAIN (handler))
{
if (TREE_CHAIN (handler) == NULL_TREE)
/* No more handlers; nothing to shadow. */;
else if (TREE_TYPE (handler) == NULL_TREE)
{
input_line = STMT_LINENO (handler);
pedwarn
("`...' handler must be the last handler for its try block");
}
else
check_handlers_1 (handler, TREE_CHAIN (handler));
}
input_line = save_line;
tree_stmt_iterator i;
/* If we don't have a STATEMENT_LIST, then we've just got one
handler, and thus nothing to warn about. */
if (TREE_CODE (handlers) != STATEMENT_LIST)
return;
i = tsi_start (handlers);
if (!tsi_end_p (i))
while (1)
{
tree handler = tsi_stmt (i);
tsi_next (&i);
/* No more handlers; nothing to shadow. */
if (tsi_end_p (i))
break;
if (TREE_TYPE (handler) == NULL_TREE)
pedwarn ("%H%<...%> handler must be the last handler for"
" its try block", EXPR_LOCUS (handler));
else
check_handlers_1 (handler, i);
}
}

View File

@ -1,6 +1,6 @@
/* Prints out trees in human readable form.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
@ -17,8 +17,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* $FreeBSD$ */
@ -29,13 +29,6 @@ Boston, MA 02111-1307, USA. */
#include "tree.h"
#include "cp-tree.h"
#ifndef HOST_PTR_PRINTF_FORMAT
#define HOST_PTR_PRINTF_FORMAT HOST_PTR_PRINTF
#endif
#ifndef HOST_PTR_PRINTF_TYPE
#define HOST_PTR_PRINTF_TYPE (void *)
#endif
void
cxx_print_decl (FILE *file, tree node, int indent)
{
@ -49,21 +42,22 @@ cxx_print_decl (FILE *file, tree node, int indent)
return;
}
if (!DECL_LANG_SPECIFIC (node))
if (!CODE_CONTAINS_STRUCT (TREE_CODE (node), TS_DECL_COMMON)
|| !DECL_LANG_SPECIFIC (node))
return;
indent_to (file, indent + 3);
if (TREE_CODE (node) == FUNCTION_DECL
&& DECL_PENDING_INLINE_INFO (node))
fprintf (file, " pending-inline-info " HOST_PTR_PRINTF_FORMAT,
HOST_PTR_PRINTF_TYPE DECL_PENDING_INLINE_INFO (node));
fprintf (file, " pending-inline-info %p",
(void *) DECL_PENDING_INLINE_INFO (node));
if (TREE_CODE (node) == TYPE_DECL
&& DECL_SORTED_FIELDS (node))
fprintf (file, " sorted-fields " HOST_PTR_PRINTF_FORMAT,
HOST_PTR_PRINTF_TYPE DECL_SORTED_FIELDS (node));
fprintf (file, " sorted-fields %p",
(void *) DECL_SORTED_FIELDS (node));
if ((TREE_CODE (node) == FUNCTION_DECL || TREE_CODE (node) == VAR_DECL)
&& DECL_TEMPLATE_INFO (node))
fprintf (file, " template-info " HOST_PTR_PRINTF_FORMAT,
HOST_PTR_PRINTF_TYPE DECL_TEMPLATE_INFO (node));
fprintf (file, " template-info %p",
(void *) DECL_TEMPLATE_INFO (node));
}
void
@ -108,8 +102,6 @@ cxx_print_type (FILE *file, tree node, int indent)
fputs ( "needs-constructor", file);
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node))
fputs (" needs-destructor", file);
if (TYPE_HAS_DESTRUCTOR (node))
fputs (" ~X()", file);
if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node))
fputs (" X()", file);
if (TYPE_HAS_CONVERSION (node))
@ -131,19 +123,20 @@ cxx_print_type (FILE *file, tree node, int indent)
fputs (" delete[]", file);
if (TYPE_HAS_ASSIGN_REF (node))
fputs (" this=(X&)", file);
if (TYPE_USES_MULTIPLE_INHERITANCE (node))
fputs (" uses-multiple-inheritance", file);
if (TREE_CODE (node) == RECORD_TYPE)
{
fprintf (file, " n_parents %d", CLASSTYPE_N_BASECLASSES (node));
if (TYPE_BINFO (node))
fprintf (file, " n_parents=%d",
BINFO_N_BASE_BINFOS (TYPE_BINFO (node)));
else
fprintf (file, " no-binfo");
fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
if (CLASSTYPE_INTERFACE_ONLY (node))
fprintf (file, " interface-only");
if (CLASSTYPE_INTERFACE_UNKNOWN (node))
fprintf (file, " interface-unknown");
print_node (file, "member-functions", CLASSTYPE_METHOD_VEC (node),
indent + 4);
}
}
@ -151,22 +144,25 @@ cxx_print_type (FILE *file, tree node, int indent)
static void
cxx_print_binding (FILE *stream, cxx_binding *binding, const char *prefix)
{
fprintf (stream, "%s <" HOST_PTR_PRINTF_FORMAT ">",
prefix, HOST_PTR_PRINTF_TYPE binding);
fprintf (stream, "%s <%p>",
prefix, (void *) binding);
}
void
cxx_print_identifier (FILE *file, tree node, int indent)
{
indent_to (file, indent);
if (indent == 0)
fprintf (file, " ");
else
indent_to (file, indent);
cxx_print_binding (file, IDENTIFIER_NAMESPACE_BINDINGS (node), "bindings");
print_node (file, "class", IDENTIFIER_CLASS_VALUE (node), indent + 4);
indent_to (file, indent);
if (indent == 0)
fprintf (file, " ");
else
indent_to (file, indent);
cxx_print_binding (file, IDENTIFIER_BINDING (node), "local bindings");
print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);
print_node (file, "template", IDENTIFIER_TEMPLATE (node), indent + 4);
print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);
print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);
}
void
@ -174,6 +170,12 @@ cxx_print_xnode (FILE *file, tree node, int indent)
{
switch (TREE_CODE (node))
{
case BASELINK:
print_node (file, "functions", BASELINK_FUNCTIONS (node), indent + 4);
print_node (file, "binfo", BASELINK_BINFO (node), indent + 4);
print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node),
indent + 4);
break;
case OVERLOAD:
print_node (file, "function", OVL_FUNCTION (node), indent+4);
print_node (file, "chain", TREE_CHAIN (node), indent+4);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Compilation switch flag definitions for GCC.
Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
2003
2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of GCC.
@ -17,18 +17,19 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifndef GCC_FLAGS_H
#define GCC_FLAGS_H
#include "options.h"
enum debug_info_type
{
NO_DEBUG, /* Write no debug info. */
DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */
SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */
DWARF_DEBUG, /* Write Dwarf debug info (using dwarfout.c). */
DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */
XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */
VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */
@ -57,8 +58,30 @@ extern enum debug_info_level debug_info_level;
debugging information. */
extern bool use_gnu_debug_info_extensions;
/* Nonzero means emit debugging information only for symbols which are used. */
extern int flag_debug_only_used_symbols;
/* Enumerate visibility settings. This is deliberately ordered from most
to least visibility. */
#ifndef SYMBOL_VISIBILITY_DEFINED
#define SYMBOL_VISIBILITY_DEFINED
enum symbol_visibility
{
VISIBILITY_DEFAULT,
VISIBILITY_PROTECTED,
VISIBILITY_HIDDEN,
VISIBILITY_INTERNAL
};
#endif
/* The default visibility for all symbols (unless overridden). */
extern enum symbol_visibility default_visibility;
struct visibility_flags
{
unsigned inpragma : 1; /* True when in #pragma GCC visibility. */
unsigned inlines_hidden : 1; /* True when -finlineshidden in effect. */
};
/* Global visibility options. */
extern struct visibility_flags visibility_options;
/* Nonzero means do optimizations. -opt. */
@ -68,90 +91,17 @@ extern int optimize;
extern int optimize_size;
/* Don't print functions as they are compiled and don't print
times taken by the various passes. -quiet. */
extern int quiet_flag;
/* Print memory still in use at end of compilation (which may have little
to do with peak memory consumption). -fmem-report. */
extern int mem_report;
/* Don't print warning messages. -w. */
extern bool inhibit_warnings;
/* Don't suppress warnings from system headers. -Wsystem-headers. */
extern bool warn_system_headers;
/* Do print extra warnings (such as for uninitialized variables).
-W/-Wextra. */
extern bool extra_warnings;
/* If -Werror. */
extern bool warnings_are_errors;
/* Nonzero to warn about unused variables, functions et.al. Use
set_Wunused() to update the -Wunused-* flags that correspond to the
-Wunused option. */
extern void set_Wunused (int setting);
extern bool warn_unused_function;
extern bool warn_unused_label;
extern bool warn_unused_parameter;
extern bool warn_unused_variable;
extern bool warn_unused_value;
/* Nonzero to warn about code which is never reached. */
extern bool warn_notreached;
/* Nonzero means warn if inline function is too large. */
extern bool warn_inline;
/* Nonzero to warn about variables used before they are initialized. */
extern int warn_uninitialized;
/* Nonzero means warn about all declarations which shadow others. */
extern bool warn_shadow;
/* Warn if a switch on an enum, that does not have a default case,
fails to have a case for every enum value. */
extern bool warn_switch;
/* Warn if a switch does not have a default case. */
extern bool warn_switch_default;
/* Warn if a switch on an enum fails to have a case for every enum
value (regardless of the presence or otherwise of a default case). */
extern bool warn_switch_enum;
/* Nonzero means warn about function definitions that default the return type
or that use a null return and have a return-type other than void. */
extern int warn_return_type;
/* Warn about functions which might be candidates for attribute noreturn. */
extern bool warn_missing_noreturn;
/* Nonzero means warn about pointer casts that increase the required
alignment of the target type (and might therefore lead to a crash
due to a misaligned access). */
extern bool warn_cast_align;
/* Nonzero means warn about any objects definitions whose size is larger
than N bytes. Also want about function definitions whose returned
values are larger than N bytes. The value N is in `larger_than_size'. */
@ -159,69 +109,15 @@ extern bool warn_cast_align;
extern bool warn_larger_than;
extern HOST_WIDE_INT larger_than_size;
/* Warn if a function returns an aggregate,
since there are often incompatible calling conventions for doing this. */
extern bool warn_aggregate_return;
/* Warn if packed attribute on struct is unnecessary and inefficient. */
extern bool warn_packed;
/* Warn when gcc pads a structure to an alignment boundary. */
extern bool warn_padded;
/* Warn when an optimization pass is disabled. */
extern bool warn_disabled_optimization;
/* Nonzero means warn about uses of __attribute__((deprecated))
declarations. */
extern bool warn_deprecated_decl;
/* Nonzero means warn about constructs which might not be strict
aliasing safe. */
extern bool warn_strict_aliasing;
extern int warn_strict_aliasing;
/* Nonzero if generating code to do profiling. */
/* Nonzero means warn about optimizations which rely on undefined
signed overflow. */
extern int profile_flag;
/* Nonzero if generating code to profile program flow graph arcs. */
extern int profile_arc_flag;
/* Nonzero if value profile should be measured. */
extern int flag_profile_values;
/* Nonzero if generating info for gcov to calculate line test coverage. */
extern int flag_test_coverage;
/* Nonzero indicates that branch taken probabilities should be calculated. */
extern int flag_branch_probabilities;
/* Nonzero if basic blocks should be reordered. */
extern int flag_reorder_blocks;
/* Nonzero if functions should be reordered. */
extern int flag_reorder_functions;
/* Nonzero if registers should be renamed. */
extern int flag_rename_registers;
/* Nonzero for -pedantic switch: warn about anything
that standard C forbids. */
extern int pedantic;
extern int warn_strict_overflow;
/* Temporarily suppress certain warnings.
This is set while reading code from a system header file. */
@ -239,163 +135,20 @@ extern int flag_print_asm_name;
extern int flag_signed_char;
/* Nonzero means give an enum type only as many bytes as it needs. */
/* Nonzero means give an enum type only as many bytes as it needs. A value
of 2 means it has not yet been initialized. */
extern int flag_short_enums;
/* Nonzero for -fcaller-saves: allocate values in regs that need to
be saved across function calls, if that produces overall better code.
Optional now, so people can test it. */
extern int flag_caller_saves;
/* Nonzero for -fpcc-struct-return: return values the same way PCC does. */
extern int flag_pcc_struct_return;
/* Nonzero for -fforce-mem: load memory value into a register
before arithmetic on it. This makes better cse but slower compilation. */
extern int flag_force_mem;
/* Nonzero for -fforce-addr: load memory address into a register before
reference to memory. This makes better cse but slower compilation. */
extern int flag_force_addr;
/* Nonzero for -fdefer-pop: don't pop args after each function call;
instead save them up to pop many calls' args with one insns. */
extern int flag_defer_pop;
/* Nonzero for -ffloat-store: don't allocate floats and doubles
in extended-precision registers. */
extern int flag_float_store;
/* Nonzero enables strength-reduction in loop.c. */
extern int flag_strength_reduce;
/* Nonzero enables loop unrolling in unroll.c. Only loops for which the
number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
unrolled. */
extern int flag_old_unroll_loops;
/* Nonzero enables loop unrolling in unroll.c. All loops are unrolled.
This is generally not a win. */
extern int flag_old_unroll_all_loops;
/* Nonzero forces all invariant computations in loops to be moved
outside the loop. */
extern int flag_move_all_movables;
/* Nonzero enables prefetch optimizations for arrays in loops. */
extern int flag_prefetch_loop_arrays;
/* Nonzero forces all general induction variables in loops to be
strength reduced. */
extern int flag_reduce_all_givs;
/* Nonzero for -fcse-follow-jumps:
have cse follow jumps to do a more extensive job. */
extern int flag_cse_follow_jumps;
/* Nonzero for -fcse-skip-blocks:
have cse follow a branch around a block. */
extern int flag_cse_skip_blocks;
/* Nonzero for -fexpensive-optimizations:
perform miscellaneous relatively-expensive optimizations. */
extern int flag_expensive_optimizations;
/* Nonzero for -fwritable-strings:
store string constants in data segment and don't uniquize them. */
extern int flag_writable_strings;
/* Nonzero means don't put addresses of constant functions in registers.
Used for compiling the Unix kernel, where strange substitutions are
done on the assembly output. */
extern int flag_no_function_cse;
/* Nonzero for -fomit-frame-pointer:
don't make a frame pointer in simple functions that don't require one. */
extern int flag_omit_frame_pointer;
/* Nonzero to inhibit use of define_optimization peephole opts. */
extern int flag_no_peephole;
/* Nonzero allows GCC to optimize sibling and tail recursive calls. */
extern int flag_optimize_sibling_calls;
/* Nonzero means the front end generally wants `errno' maintained by math
operations, like built-in SQRT. */
extern int flag_errno_math;
/* Nonzero means that unsafe floating-point math optimizations are allowed
for the sake of speed. IEEE compliance is not guaranteed, and operations
are allowed to assume that their arguments and results are "normal"
(e.g., nonnegative for SQRT). */
extern int flag_unsafe_math_optimizations;
/* Nonzero means that no NaNs or +-Infs are expected. */
extern int flag_finite_math_only;
/* Zero means that floating-point math operations cannot generate a
(user-visible) trap. This is the case, for example, in nonstop
IEEE 754 arithmetic. */
extern int flag_trapping_math;
/* Nonzero means disable transformations that assume default floating
point rounding behavior. */
extern int flag_rounding_math;
/* 0 means straightforward implementation of complex divide acceptable.
1 means wide ranges of inputs must work for complex divide.
2 means C99-like requirements for complex divide (not yet implemented). */
2 means C99-like requirements for complex multiply and divide. */
extern int flag_complex_divide_method;
/* Nonzero means to run loop optimizations twice. */
extern int flag_rerun_loop_opt;
/* Nonzero means make functions that look like good inline candidates
go inline. */
extern int flag_inline_functions;
/* Nonzero for -fkeep-inline-functions: even if we make a function
go inline everywhere, keep its definition around for debugging
purposes. */
extern int flag_keep_inline_functions;
/* Nonzero means that functions declared `inline' will be treated
as `static'. Prevents generation of zillions of copies of unused
static inline functions; instead, `inlines' are written out
only when actually used. Used in conjunction with -g. Also
does the right thing with #pragma interface. */
extern int flag_no_inline;
extern int flag_complex_method;
/* Nonzero means that we don't want inlining by virtue of -fno-inline,
not just because the tree inliner turned us off. */
@ -404,69 +157,12 @@ extern int flag_really_no_inline;
/* Nonzero if we are only using compiler to check syntax errors. */
extern int flag_syntax_only;
extern int rtl_dump_and_exit;
/* Nonzero means we should save auxiliary info into a .X file. */
extern int flag_gen_aux_info;
/* Nonzero means make the text shared if supported. */
extern int flag_shared_data;
/* flag_schedule_insns means schedule insns within basic blocks (before
local_alloc).
flag_schedule_insns_after_reload means schedule insns after
global_alloc. */
extern int flag_schedule_insns;
extern int flag_schedule_insns_after_reload;
extern int flag_sched2_use_superblocks;
extern int flag_sched2_use_traces;
/* The following flags have effect only for scheduling before register
allocation:
flag_schedule_interblock means schedule insns across basic blocks.
flag_schedule_speculative means allow speculative motion of non-load insns.
flag_schedule_speculative_load means allow speculative motion of some
load insns.
flag_schedule_speculative_load_dangerous allows speculative motion of more
load insns. */
extern int flag_schedule_interblock;
extern int flag_schedule_speculative;
extern int flag_schedule_speculative_load;
extern int flag_schedule_speculative_load_dangerous;
/* The following flags have an effect during scheduling after register
allocation:
sched_stalled_insns means that insns can be moved prematurely from the queue
of stalled insns into the ready list.
sched_stalled_insns_dep controls how many recently scheduled cycles will
be examined for a dependency on a stalled insn that is candidate for
premature removal from the queue of stalled insns into the ready list (has
an effect only if the flag 'sched_stalled_insns' is set). */
extern int flag_sched_stalled_insns;
extern int flag_sched_stalled_insns_dep;
/* flag_branch_on_count_reg means try to replace add-1,compare,branch tupple
by a cheaper branch, on a count register. */
extern int flag_branch_on_count_reg;
/* This option is set to 1 on -fsingle-precision-constant option which is
used to convert the floating point constants to single precision
constants. */
extern int flag_single_precision_constant;
/* Nonzero means put things in delayed-branch slots if supported. */
extern int flag_delayed_branch;
/* Nonzero means suppress output of instruction numbers and line number
notes in debugging dumps. */
@ -477,63 +173,11 @@ extern int flag_dump_unnumbered;
extern int flag_pedantic_errors;
/* Nonzero means generate position-independent code. 1 vs 2 for a
target-dependent "small" or "large" mode. */
extern int flag_pic;
/* Nonzero if we are compiling position independent code for executable.
1 vs 2 for a target-dependent "small" or "large" mode. */
extern int flag_pie;
/* Nonzero if we are compiling code for a shared library, zero for
executable. */
extern int flag_shlib;
/* Nonzero means generate extra code for exception handling and enable
exception handling. */
extern int flag_exceptions;
/* Nonzero means generate frame unwind info table when supported. */
extern int flag_unwind_tables;
/* Nonzero means generate frame unwind info table exact at each insn boundary. */
extern int flag_asynchronous_unwind_tables;
/* Nonzero means don't place uninitialized global data in common storage
by default. */
extern int flag_no_common;
/* -finhibit-size-directive inhibits output of .size for ELF.
This is used only for compiling crtstuff.c,
and it may be extended to other effects
needed for crtstuff.c on other systems. */
extern int flag_inhibit_size_directive;
/* Nonzero means place each function into its own section on those platforms
which support arbitrary section names and unlimited numbers of sections. */
extern int flag_function_sections;
/* ... and similar for data. */
extern int flag_data_sections;
/* -fverbose-asm causes extra commentary information to be produced in
the generated assembly code (to make it more readable). This option
is generally only of use to those who actually need to read the
generated assembly code (perhaps while debugging the compiler itself).
-fno-verbose-asm, the default, causes the extra information
to not be added and is useful when comparing two assembler files. */
extern int flag_verbose_asm;
/* -dA causes debug information to be produced in
the generated assembly code (to make it more readable). This option
is generally only of use to those who actually need to read the
@ -543,57 +187,12 @@ extern int flag_verbose_asm;
extern int flag_debug_asm;
/* Generate code for GNU or NeXT Objective-C runtime environment. */
extern int flag_next_runtime;
extern int flag_dump_rtl_in_asm;
/* Greater than zero if user symbols are prepended by a leading underscore
in generated assembly code. */
extern int flag_leading_underscore;
/* Tag all structures with __attribute__(packed) */
extern int flag_pack_struct;
/* This flag is only tested if alias checking is enabled.
0 if pointer arguments may alias each other. True in C.
1 if pointer arguments may not alias each other but may alias
global variables.
2 if pointer arguments may not alias each other and may not
alias global variables. True in Fortran.
The value is ignored if flag_alias_check is 0. */
extern int flag_argument_noalias;
/* Nonzero if we should do (language-dependent) alias analysis.
Typically, this analysis will assume that expressions of certain
types do not alias expressions of certain other types. Only used
if alias analysis (in general) is enabled. */
extern int flag_strict_aliasing;
/* Emit code to probe the stack, to help detect stack overflow; also
may cause large objects to be allocated dynamically. */
extern int flag_stack_check;
/* Do the full regmove optimization pass. */
extern int flag_regmove;
/* Instrument functions with calls at entry and exit, for profiling. */
extern int flag_instrument_function_entry_exit;
/* Perform a peephole pass before sched2. */
extern int flag_peephole2;
/* Try to guess branch probabilities. */
extern int flag_guess_branch_prob;
/* -fcheck-bounds causes gcc to generate array bounds checks.
For C, C++ and ObjC: defaults off.
For Java: defaults to on.
For Fortran: defaults to off. */
extern int flag_bounds_check;
/* This will attempt to merge constant section constants, if 1 only
string constants and constants from constant pool, if 2 also constant
variables. */
extern int flag_merge_constants;
/* If one, renumber instruction UIDs to reduce the number of
unused UIDs if there are a lot of instructions. If greater than
one, unconditionally renumber instruction UIDs. */
@ -607,13 +206,6 @@ extern int flag_renumber_insns;
extern int frame_pointer_needed;
/* Nonzero if the generated code should trap on signed overflow
for PLUS / SUB / MULT. */
extern int flag_trapv;
/* Nonzero if the signed arithmetic overflow should wrap around. */
extern int flag_wrapv;
/* Nonzero if subexpressions must be evaluated from left-to-right. */
extern int flag_evaluation_order;
@ -626,16 +218,12 @@ extern bool g_switch_set;
For each variable, there is an _log variant which is the power
of two not less than the variable, for .align output. */
extern int align_loops;
extern int align_loops_log;
extern int align_loops_max_skip;
extern int align_jumps;
extern int align_jumps_log;
extern int align_jumps_max_skip;
extern int align_labels;
extern int align_labels_log;
extern int align_labels_max_skip;
extern int align_functions;
extern int align_functions_log;
/* Like align_functions_log above, but used by front-ends to force the
@ -653,92 +241,26 @@ enum graph_dump_types
};
extern enum graph_dump_types graph_dump_format;
/* Nonzero means ignore `#ident' directives. 0 means handle them.
On SVR4 targets, it also controls whether or not to emit a
string identifying the compiler. */
extern int flag_no_ident;
/* Nonzero means perform global CSE. */
extern int flag_gcse;
/* Nonzero if we want to perform enhanced load motion during gcse. */
extern int flag_gcse_lm;
/* Nonzero if we want to perform store motion after gcse. */
extern int flag_gcse_sm;
/* Nonzero if we want to perform redundant load-after-store elimination
in gcse. */
extern int flag_gcse_las;
/* Nonzero if value histograms should be used to optimize code. */
extern int flag_value_profile_transformations;
/* Perform branch target register optimization before prologue / epilogue
threading. */
extern int flag_branch_target_load_optimize;
/* Perform branch target register optimization after prologue / epilogue
threading and jump2. */
extern int flag_branch_target_load_optimize2;
/* Nonzero means we should do dwarf2 duplicate elimination. */
extern int flag_eliminate_dwarf2_dups;
/* Nonzero means we should do unused type elimination. */
extern int flag_eliminate_unused_debug_types;
/* Nonzero means to collect statistics which might be expensive
and to print them when we are done. */
extern int flag_detailed_statistics;
/* Nonzero means enable synchronous exceptions for non-call instructions. */
extern int flag_non_call_exceptions;
/* Nonzero means put zero initialized data in the bss section. */
extern int flag_zero_initialized_in_bss;
/* Nonzero means disable transformations observable by signaling NaNs. */
extern int flag_signaling_nans;
extern int flag_unit_at_a_time;
extern int flag_web;
/* Nonzero means that we defer emitting functions until they are actually
used. */
extern int flag_remove_unreachable_functions;
/* Nonzero if we should track variables. */
extern int flag_var_tracking;
/* True if flag_speculative_prefetching was set by user. Used to suppress
warning message in case flag was set by -fprofile-{generate,use}. */
extern bool flag_speculative_prefetching_set;
/* A string that's used when a random name is required. NULL means
to make it really random. */
extern const char *flag_random_seed;
/* The version of the C++ ABI in use. The following values are
allowed:
0: The version of the ABI believed most conformant with the
C++ ABI specification. This ABI may change as bugs are
discovered and fixed. Therefore, 0 will not necessarily
indicate the same ABI in different versions of G++.
1: The version of the ABI first used in G++ 3.2.
Additional positive integers will be assigned as new versions of
the ABI become the default version of the ABI. */
extern int flag_abi_version;
/* Returns TRUE if generated code should match ABI version N or
greater is in use. */
@ -747,7 +269,7 @@ extern int flag_abi_version;
/* True if the given mode has a NaN representation and the treatment of
NaN operands is important. Certain optimizations, such as folding
x * 0 into x, are not correct for NaN operands, and are normally
x * 0 into 0, are not correct for NaN operands, and are normally
disabled for modes with NaNs. The user can ask for them to be
done anyway using the -funsafe-math-optimizations switch. */
#define HONOR_NANS(MODE) \
@ -771,4 +293,53 @@ extern int flag_abi_version;
#define HONOR_SIGN_DEPENDENT_ROUNDING(MODE) \
(MODE_HAS_SIGN_DEPENDENT_ROUNDING (MODE) && flag_rounding_math)
/* True if overflow wraps around for the given integral type. That
is, TYPE_MAX + 1 == TYPE_MIN. */
#define TYPE_OVERFLOW_WRAPS(TYPE) \
(TYPE_UNSIGNED (TYPE) || flag_wrapv)
/* True if overflow is undefined for the given integral type. We may
optimize on the assumption that values in the type never overflow.
IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
must issue a warning based on warn_strict_overflow. In some cases
it will be appropriate to issue the warning immediately, and in
other cases it will be appropriate to simply set a flag and let the
caller decide whether a warning is appropriate or not. */
#define TYPE_OVERFLOW_UNDEFINED(TYPE) \
(!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
/* True if overflow for the given integral type should issue a
trap. */
#define TYPE_OVERFLOW_TRAPS(TYPE) \
(!TYPE_UNSIGNED (TYPE) && flag_trapv)
/* Names for the different levels of -Wstrict-overflow=N. The numeric
values here correspond to N. */
enum warn_strict_overflow_code
{
/* Overflow warning that should be issued with -Wall: a questionable
construct that is easy to avoid even when using macros. Example:
folding (x + CONSTANT > x) to 1. */
WARN_STRICT_OVERFLOW_ALL = 1,
/* Overflow warning about folding a comparison to a constant because
of undefined signed overflow, other than cases covered by
WARN_STRICT_OVERFLOW_ALL. Example: folding (abs (x) >= 0) to 1
(this is false when x == INT_MIN). */
WARN_STRICT_OVERFLOW_CONDITIONAL = 2,
/* Overflow warning about changes to comparisons other than folding
them to a constant. Example: folding (x + 1 > 1) to (x > 0). */
WARN_STRICT_OVERFLOW_COMPARISON = 3,
/* Overflow warnings not covered by the above cases. Example:
folding ((x * 10) / 5) to (x * 2). */
WARN_STRICT_OVERFLOW_MISC = 4,
/* Overflow warnings about reducing magnitude of constants in
comparison. Example: folding (x + 2 > y) to (x + 1 >= y). */
WARN_STRICT_OVERFLOW_MAGNITUDE = 5
};
/* Whether to emit an overflow warning whose code is C. */
#define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c))
#endif /* ! GCC_FLAGS_H */

View File

@ -14,8 +14,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you include this header file into source
files compiled by GCC, this header file does not by itself cause

View File

@ -1,4 +1,5 @@
/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004
Free Software Foundation, Inc.
This file is part of GCC.
@ -14,8 +15,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, if you include this header file into source
files compiled by GCC, this header file does not by itself cause
@ -295,7 +296,7 @@ typedef _BSD_RUNE_T_ rune_t;
#define _BSD_WCHAR_T_DEFINED_
#define _BSD_RUNE_T_DEFINED_ /* Darwin */
#if defined (__FreeBSD__) && (__FreeBSD__ < 5)
/* Why is this file so hard to maintain properly? In constrast to
/* Why is this file so hard to maintain properly? In contrast to
the comment above regarding BSD/386 1.1, on FreeBSD for as long
as the symbol has existed, _BSD_RUNE_T_ must not stay defined or
redundant typedefs will occur when stdlib.h is included after this file. */
@ -410,16 +411,8 @@ typedef __WINT_TYPE__ wint_t;
#ifdef _STDDEF_H
/* Offset of member MEMBER in a struct of type TYPE. */
#ifndef __cplusplus
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#else
/* The cast to "char &" below avoids problems with user-defined
"operator &", which can appear in a POD type. */
#define offsetof(TYPE, MEMBER) \
(__offsetof__ (reinterpret_cast <size_t> \
(&reinterpret_cast <const volatile char &> \
(static_cast<TYPE *> (0)->MEMBER))))
#endif /* C++ */
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#endif /* _STDDEF_H was defined this time */
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Prints out tree in human readable form - GCC
Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
@ -16,8 +16,8 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "config.h"
@ -28,6 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "real.h"
#include "ggc.h"
#include "langhooks.h"
#include "tree-iterator.h"
/* Define the hash table of nodes already seen.
Such nodes are not repeated; brief cross-references are used. */
@ -49,19 +50,29 @@ static struct bucket **table;
void
debug_tree (tree node)
{
table = xcalloc (HASH_SIZE, sizeof (struct bucket *));
table = XCNEWVEC (struct bucket *, HASH_SIZE);
print_node (stderr, "", node, 0);
free (table);
table = 0;
putc ('\n', stderr);
}
/* Print PREFIX and ADDR to FILE. */
void
dump_addr (FILE *file, const char *prefix, void *addr)
{
if (flag_dump_noaddr || flag_dump_unnumbered)
fprintf (file, "%s#", prefix);
else
fprintf (file, "%s%p", prefix, addr);
}
/* Print a node in brief fashion, with just the code, address and name. */
void
print_node_brief (FILE *file, const char *prefix, tree node, int indent)
{
char class;
enum tree_code_class class;
if (node == 0)
return;
@ -72,15 +83,21 @@ print_node_brief (FILE *file, const char *prefix, tree node, int indent)
name if any. */
if (indent > 0)
fprintf (file, " ");
fprintf (file, "%s <%s " HOST_PTR_PRINTF,
prefix, tree_code_name[(int) TREE_CODE (node)], (char *) node);
fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
dump_addr (file, " ", node);
if (class == 'd')
if (class == tcc_declaration)
{
if (DECL_NAME (node))
fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
else if (TREE_CODE (node) == LABEL_DECL
&& LABEL_DECL_UID (node) != -1)
fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
else
fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
DECL_UID (node));
}
else if (class == 't')
else if (class == tcc_type)
{
if (TYPE_NAME (node))
{
@ -121,7 +138,7 @@ print_node_brief (FILE *file, const char *prefix, tree node, int indent)
d = TREE_REAL_CST (node);
if (REAL_VALUE_ISINF (d))
fprintf (file, " Inf");
fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
else if (REAL_VALUE_ISNAN (d))
fprintf (file, " Nan");
else
@ -156,15 +173,17 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
int hash;
struct bucket *b;
enum machine_mode mode;
char class;
enum tree_code_class class;
int len;
int first_rtl;
int i;
expanded_location xloc;
enum tree_code code;
if (node == 0)
return;
class = TREE_CODE_CLASS (TREE_CODE (node));
code = TREE_CODE (node);
class = TREE_CODE_CLASS (code);
/* Don't get too deep in nesting. If the user wants to see deeper,
it is easy to use the address of a lowest-level node
@ -176,7 +195,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
return;
}
if (indent > 8 && (class == 't' || class == 'd'))
if (indent > 8 && (class == tcc_type || class == tcc_declaration))
{
print_node_brief (file, prefix, node, indent);
return;
@ -200,7 +219,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
}
/* Add this node to the table. */
b = xmalloc (sizeof (struct bucket));
b = XNEW (struct bucket);
b->node = node;
b->next = table[hash];
table[hash] = b;
@ -209,16 +228,22 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
indent_to (file, indent);
/* Print the slot this node is in, and its code, and address. */
fprintf (file, "%s <%s " HOST_PTR_PRINTF,
prefix, tree_code_name[(int) TREE_CODE (node)], (void *) node);
fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
dump_addr (file, " ", node);
/* Print the name, if any. */
if (class == 'd')
if (class == tcc_declaration)
{
if (DECL_NAME (node))
fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
else if (TREE_CODE (node) == LABEL_DECL
&& LABEL_DECL_UID (node) != -1)
fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
else
fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
DECL_UID (node));
}
else if (class == 't')
else if (class == tcc_type)
{
if (TYPE_NAME (node))
{
@ -245,18 +270,22 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
indent_to (file, indent + 3);
}
if (TREE_SIDE_EFFECTS (node))
if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node))
fputs (" side-effects", file);
if (TREE_READONLY (node))
if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node))
fputs (" readonly", file);
if (TREE_CONSTANT (node))
if (!TYPE_P (node) && TREE_CONSTANT (node))
fputs (" constant", file);
else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
fputs (" sizes-gimplified", file);
if (TREE_INVARIANT (node))
fputs (" invariant", file);
if (TREE_ADDRESSABLE (node))
fputs (" addressable", file);
if (TREE_THIS_VOLATILE (node))
fputs (" volatile", file);
if (TREE_UNSIGNED (node))
fputs (" unsigned", file);
if (TREE_ASM_WRITTEN (node))
fputs (" asm_written", file);
if (TREE_USED (node))
@ -273,6 +302,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fputs (" static", file);
if (TREE_DEPRECATED (node))
fputs (" deprecated", file);
if (TREE_VISITED (node))
fputs (" visited", file);
if (TREE_LANG_FLAG_0 (node))
fputs (" tree_0", file);
if (TREE_LANG_FLAG_1 (node))
@ -292,27 +323,32 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
switch (TREE_CODE_CLASS (TREE_CODE (node)))
{
case 'd':
mode = DECL_MODE (node);
if (DECL_IGNORED_P (node))
fputs (" ignored", file);
if (DECL_ABSTRACT (node))
fputs (" abstract", file);
if (DECL_IN_SYSTEM_HEADER (node))
fputs (" in_system_header", file);
if (DECL_COMMON (node))
fputs (" common", file);
if (DECL_EXTERNAL (node))
fputs (" external", file);
if (DECL_WEAK (node))
fputs (" weak", file);
if (DECL_REGISTER (node) && TREE_CODE (node) != FIELD_DECL
case tcc_declaration:
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
if (DECL_UNSIGNED (node))
fputs (" unsigned", file);
if (DECL_IGNORED_P (node))
fputs (" ignored", file);
if (DECL_ABSTRACT (node))
fputs (" abstract", file);
if (DECL_EXTERNAL (node))
fputs (" external", file);
if (DECL_NONLOCAL (node))
fputs (" nonlocal", file);
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
{
if (DECL_WEAK (node))
fputs (" weak", file);
if (DECL_IN_SYSTEM_HEADER (node))
fputs (" in_system_header", file);
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)
&& TREE_CODE (node) != LABEL_DECL
&& TREE_CODE (node) != FUNCTION_DECL
&& TREE_CODE (node) != LABEL_DECL)
&& DECL_REGISTER (node))
fputs (" regdecl", file);
if (DECL_NONLOCAL (node))
fputs (" nonlocal", file);
if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
fputs (" suppress-debug", file);
@ -331,94 +367,132 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (TREE_CODE (node) == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
fputs (" nonaddressable", file);
if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node))
fputs (" too-late", file);
if (TREE_CODE (node) == LABEL_DECL && DECL_ERROR_ISSUED (node))
fputs (" error-issued", file);
if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
fputs (" in-text-section", file);
if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL (node))
fputs (" thread-local", file);
if (TREE_CODE (node) == VAR_DECL && DECL_COMMON (node))
fputs (" common", file);
if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL_P (node))
{
enum tls_model kind = DECL_TLS_MODEL (node);
switch (kind)
{
case TLS_MODEL_GLOBAL_DYNAMIC:
fputs (" tls-global-dynamic", file);
break;
case TLS_MODEL_LOCAL_DYNAMIC:
fputs (" tls-local-dynamic", file);
break;
case TLS_MODEL_INITIAL_EXEC:
fputs (" tls-initial-exec", file);
break;
case TLS_MODEL_LOCAL_EXEC:
fputs (" tls-local-exec", file);
break;
default:
gcc_unreachable ();
}
}
if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node))
fputs (" transparent-union", file);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
if (DECL_VIRTUAL_P (node))
fputs (" virtual", file);
if (DECL_PRESERVE_P (node))
fputs (" preserve", file);
if (DECL_LANG_FLAG_0 (node))
fputs (" decl_0", file);
if (DECL_LANG_FLAG_1 (node))
fputs (" decl_1", file);
if (DECL_LANG_FLAG_2 (node))
fputs (" decl_2", file);
if (DECL_LANG_FLAG_3 (node))
fputs (" decl_3", file);
if (DECL_LANG_FLAG_4 (node))
fputs (" decl_4", file);
if (DECL_LANG_FLAG_5 (node))
fputs (" decl_5", file);
if (DECL_LANG_FLAG_6 (node))
fputs (" decl_6", file);
if (DECL_LANG_FLAG_7 (node))
fputs (" decl_7", file);
mode = DECL_MODE (node);
fprintf (file, " %s", GET_MODE_NAME (mode));
}
if (DECL_VIRTUAL_P (node))
fputs (" virtual", file);
if (DECL_DEFER_OUTPUT (node))
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node))
fputs (" defer-output", file);
if (DECL_LANG_FLAG_0 (node))
fputs (" decl_0", file);
if (DECL_LANG_FLAG_1 (node))
fputs (" decl_1", file);
if (DECL_LANG_FLAG_2 (node))
fputs (" decl_2", file);
if (DECL_LANG_FLAG_3 (node))
fputs (" decl_3", file);
if (DECL_LANG_FLAG_4 (node))
fputs (" decl_4", file);
if (DECL_LANG_FLAG_5 (node))
fputs (" decl_5", file);
if (DECL_LANG_FLAG_6 (node))
fputs (" decl_6", file);
if (DECL_LANG_FLAG_7 (node))
fputs (" decl_7", file);
fprintf (file, " %s", GET_MODE_NAME (mode));
fprintf (file, " file %s line %d",
DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
xloc = expand_location (DECL_SOURCE_LOCATION (node));
fprintf (file, " file %s line %d", xloc.file, xloc.line);
print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
if (TREE_CODE (node) != FUNCTION_DECL
|| DECL_INLINE (node) || DECL_BUILT_IN (node))
indent_to (file, indent + 3);
if (TREE_CODE (node) != FUNCTION_DECL)
{
if (DECL_USER_ALIGN (node))
fprintf (file, " user");
fprintf (file, " align %d", DECL_ALIGN (node));
if (TREE_CODE (node) == FIELD_DECL)
fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
DECL_OFFSET_ALIGN (node));
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
if (TREE_CODE (node) != FUNCTION_DECL
|| DECL_INLINE (node) || DECL_BUILT_IN (node))
indent_to (file, indent + 3);
if (TREE_CODE (node) != FUNCTION_DECL)
{
if (DECL_USER_ALIGN (node))
fprintf (file, " user");
fprintf (file, " align %d", DECL_ALIGN (node));
if (TREE_CODE (node) == FIELD_DECL)
fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
DECL_OFFSET_ALIGN (node));
}
else if (DECL_BUILT_IN (node))
{
if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
else
fprintf (file, " built-in %s:%s",
built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
built_in_names[(int) DECL_FUNCTION_CODE (node)]);
}
if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC,
DECL_POINTER_ALIAS_SET (node));
}
else if (DECL_BUILT_IN (node))
{
if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
else
fprintf (file, " built-in %s:%s",
built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
built_in_names[(int) DECL_FUNCTION_CODE (node)]);
}
if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC,
DECL_POINTER_ALIAS_SET (node));
if (TREE_CODE (node) == FIELD_DECL)
{
print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
indent + 4);
if (DECL_BIT_FIELD_TYPE (node))
print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
indent + 4);
}
print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
print_node_brief (file, "attributes",
DECL_ATTRIBUTES (node), indent + 4);
print_node_brief (file, "abstract_origin",
DECL_ABSTRACT_ORIGIN (node), indent + 4);
print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
print_node_brief (file, "attributes",
DECL_ATTRIBUTES (node), indent + 4);
print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
{
print_node_brief (file, "abstract_origin",
DECL_ABSTRACT_ORIGIN (node), indent + 4);
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
{
print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4);
print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
}
(*lang_hooks.print_decl) (file, node, indent);
lang_hooks.print_decl (file, node, indent);
if (DECL_RTL_SET_P (node))
{
@ -429,8 +503,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (TREE_CODE (node) == PARM_DECL)
{
print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
print_node (file, "arg-type-as-written",
DECL_ARG_TYPE_AS_WRITTEN (node), indent + 4);
if (DECL_INCOMING_RTL (node) != 0)
{
@ -440,13 +512,25 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
}
}
else if (TREE_CODE (node) == FUNCTION_DECL
&& DECL_SAVED_INSNS (node) != 0)
&& DECL_STRUCT_FUNCTION (node) != 0)
{
indent_to (file, indent + 4);
fprintf (file, "saved-insns " HOST_PTR_PRINTF,
(void *) DECL_SAVED_INSNS (node));
dump_addr (file, "saved-insns ", DECL_STRUCT_FUNCTION (node));
}
if ((TREE_CODE (node) == VAR_DECL || TREE_CODE (node) == PARM_DECL)
&& DECL_HAS_VALUE_EXPR_P (node))
print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4);
if (TREE_CODE (node) == STRUCT_FIELD_TAG)
{
fprintf (file, " sft size " HOST_WIDE_INT_PRINT_DEC,
SFT_SIZE (node));
fprintf (file, " sft offset " HOST_WIDE_INT_PRINT_DEC,
SFT_OFFSET (node));
print_node_brief (file, "parent var", SFT_PARENT_VAR (node),
indent + 4);
}
/* Print the decl chain only if decl is at second level. */
if (indent == 4)
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
@ -454,7 +538,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
break;
case 't':
case tcc_type:
if (TYPE_UNSIGNED (node))
fputs (" unsigned", file);
/* The no-force-blk flag is used for different things in
different types. */
if ((TREE_CODE (node) == RECORD_TYPE
@ -528,8 +615,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (TREE_CODE (node) == ENUMERAL_TYPE)
print_node (file, "values", TYPE_VALUES (node), indent + 4);
else if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
else if (TREE_CODE (node) == ARRAY_TYPE)
print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
else if (TREE_CODE (node) == VECTOR_TYPE)
fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node));
else if (TREE_CODE (node) == RECORD_TYPE
|| TREE_CODE (node) == UNION_TYPE
|| TREE_CODE (node) == QUAL_UNION_TYPE)
@ -549,7 +638,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (TYPE_CONTEXT (node))
print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
(*lang_hooks.print_type) (file, node, indent);
lang_hooks.print_type (file, node, indent);
if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
indent_to (file, indent + 3);
@ -561,21 +650,14 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
break;
case 'b':
print_node (file, "vars", BLOCK_VARS (node), indent + 4);
print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), indent + 4);
print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
print_node (file, "abstract_origin",
BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
break;
case 'e':
case '<':
case '1':
case '2':
case 'r':
case 's':
case tcc_expression:
case tcc_comparison:
case tcc_unary:
case tcc_binary:
case tcc_reference:
case tcc_statement:
if (TREE_CODE (node) == BIT_FIELD_REF && BIT_FIELD_REF_UNSIGNED (node))
fputs (" unsigned", file);
if (TREE_CODE (node) == BIND_EXPR)
{
print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
@ -586,44 +668,19 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
len = TREE_CODE_LENGTH (TREE_CODE (node));
/* Some nodes contain rtx's, not trees,
after a certain point. Print the rtx's as rtx's. */
first_rtl = first_rtl_op (TREE_CODE (node));
for (i = 0; i < len; i++)
{
if (i >= first_rtl)
{
indent_to (file, indent + 4);
fprintf (file, "rtl %d ", i);
if (TREE_OPERAND (node, i))
print_rtl (file, (rtx) TREE_OPERAND (node, i));
else
fprintf (file, "(nil)");
fprintf (file, "\n");
}
else
{
char temp[10];
char temp[10];
sprintf (temp, "arg %d", i);
print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
}
sprintf (temp, "arg %d", i);
print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
}
if (TREE_CODE (node) == EXPR_WITH_FILE_LOCATION)
{
indent_to (file, indent+4);
fprintf (file, "%s:%d:%d",
(EXPR_WFL_FILENAME_NODE (node ) ?
EXPR_WFL_FILENAME (node) : "(no file info)"),
EXPR_WFL_LINENO (node), EXPR_WFL_COLNO (node));
}
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
break;
case 'c':
case 'x':
case tcc_constant:
case tcc_exceptional:
switch (TREE_CODE (node))
{
case INTEGER_CST:
@ -652,7 +709,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
d = TREE_REAL_CST (node);
if (REAL_VALUE_ISINF (d))
fprintf (file, " Inf");
fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
else if (REAL_VALUE_ISNAN (d))
fprintf (file, " Nan");
else
@ -708,7 +765,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
break;
case IDENTIFIER_NODE:
(*lang_hooks.print_identifier) (file, node, indent);
lang_hooks.print_identifier (file, node, indent);
break;
case TREE_LIST:
@ -729,14 +786,91 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
}
break;
case STATEMENT_LIST:
dump_addr (file, " head ", node->stmt_list.head);
dump_addr (file, " tail ", node->stmt_list.tail);
fprintf (file, " stmts");
{
tree_stmt_iterator i;
for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
{
/* Not printing the addresses of the (not-a-tree)
'struct tree_stmt_list_node's. */
dump_addr (file, " ", tsi_stmt (i));
}
fprintf (file, "\n");
for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
{
/* Not printing the addresses of the (not-a-tree)
'struct tree_stmt_list_node's. */
print_node (file, "stmt", tsi_stmt (i), indent + 4);
}
}
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
break;
case BLOCK:
print_node (file, "vars", BLOCK_VARS (node), indent + 4);
print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
indent + 4);
print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
print_node (file, "abstract_origin",
BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
break;
case SSA_NAME:
print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
print_node_brief (file, "def_stmt",
SSA_NAME_DEF_STMT (node), indent + 4);
indent_to (file, indent + 4);
fprintf (file, "version %u", SSA_NAME_VERSION (node));
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
fprintf (file, " in-abnormal-phi");
if (SSA_NAME_IN_FREE_LIST (node))
fprintf (file, " in-free-list");
if (SSA_NAME_PTR_INFO (node)
|| SSA_NAME_VALUE (node))
{
indent_to (file, indent + 3);
if (SSA_NAME_PTR_INFO (node))
dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
if (SSA_NAME_VALUE (node))
dump_addr (file, " value ", SSA_NAME_VALUE (node));
}
break;
case OMP_CLAUSE:
{
int i;
fprintf (file, " %s",
omp_clause_code_name[OMP_CLAUSE_CODE (node)]);
for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
{
indent_to (file, indent + 4);
fprintf (file, "op %d:", i);
print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
}
}
break;
default:
if (TREE_CODE_CLASS (TREE_CODE (node)) == 'x')
(*lang_hooks.print_xnode) (file, node, indent);
if (EXCEPTIONAL_CLASS_P (node))
lang_hooks.print_xnode (file, node, indent);
break;
}
break;
}
if (EXPR_HAS_LOCATION (node))
{
expanded_location xloc = expand_location (EXPR_LOCATION (node));
indent_to (file, indent+4);
fprintf (file, "%s:%d", xloc.file, xloc.line);
}
fprintf (file, ">");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff