⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decl.c

📁 GUN开源阻止下的编译器GCC
💻 C
📖 第 1 页 / 共 5 页
字号:
/* Process declarations and variables for C compiler.   Copyright (C) 1988, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.   Hacked by Michael Tiemann (tiemann@cygnus.com)This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING.  If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA.  *//* Process declarations and symbol lookup for C front end.   Also constructs types; the standard scalar types at initialization,   and structure, union, array and enum types when they are declared.  *//* ??? not all decl nodes are given the most useful possible   line numbers.  For example, the CONST_DECLs for enum values.  */#include <stdio.h>#include "config.h"#include "tree.h"#include "rtl.h"#include "flags.h"#include "cp-tree.h"#include "decl.h"#include "lex.h"#include <sys/types.h>#include <signal.h>#include "obstack.h"#define obstack_chunk_alloc xmalloc#define obstack_chunk_free freeextern tree builtin_return_address_fndecl;extern struct obstack permanent_obstack;extern int current_class_depth;extern tree cleanups_this_call;extern tree static_ctors, static_dtors;/* Stack of places to restore the search obstack back to.  */   /* Obstack used for remembering local class declarations (like   enums and static (const) members.  */#include "stack.h"static struct obstack decl_obstack;static struct stack_level *decl_stack;#ifndef CHAR_TYPE_SIZE#define CHAR_TYPE_SIZE BITS_PER_UNIT#endif#ifndef SHORT_TYPE_SIZE#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))#endif#ifndef INT_TYPE_SIZE#define INT_TYPE_SIZE BITS_PER_WORD#endif#ifndef LONG_TYPE_SIZE#define LONG_TYPE_SIZE BITS_PER_WORD#endif#ifndef LONG_LONG_TYPE_SIZE#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)#endif#ifndef WCHAR_UNSIGNED#define WCHAR_UNSIGNED 0#endif#ifndef FLOAT_TYPE_SIZE#define FLOAT_TYPE_SIZE BITS_PER_WORD#endif#ifndef DOUBLE_TYPE_SIZE#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)#endif#ifndef LONG_DOUBLE_TYPE_SIZE#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)#endif#ifndef BOOL_TYPE_SIZE#ifdef SLOW_BYTE_ACCESS#define BOOL_TYPE_SIZE ((SLOW_BYTE_ACCESS) ? (BITS_PER_WORD) : (BITS_PER_UNIT))#else#define BOOL_TYPE_SIZE BITS_PER_UNIT#endif#endif/* We let tm.h override the types used here, to handle trivial differences   such as the choice of unsigned int or long unsigned int for size_t.   When machines start needing nontrivial differences in the size type,   it would be best to do something here to figure out automatically   from other information what type to use.  */#ifndef SIZE_TYPE#define SIZE_TYPE "long unsigned int"#endif#ifndef PTRDIFF_TYPE#define PTRDIFF_TYPE "long int"#endif#ifndef WCHAR_TYPE#define WCHAR_TYPE "int"#endifstatic tree grokparms				PROTO((tree, int));static tree lookup_nested_type			PROTO((tree, tree));static char *redeclaration_error_message	PROTO((tree, tree));static void grok_op_properties			PROTO((tree, int, int));tree define_function			PROTO((char *, tree, enum built_in_function, void (*)(), char *));/* a node which has tree code ERROR_MARK, and whose type is itself.   All erroneous expressions are replaced with this node.  All functions   that accept nodes as arguments should avoid generating error messages   if this node is one of the arguments, since it is undesirable to get   multiple error messages from one error in the input.  */tree error_mark_node;/* Erroneous argument lists can use this *IFF* they do not modify it.  */tree error_mark_list;/* INTEGER_TYPE and REAL_TYPE nodes for the standard data types */tree short_integer_type_node;tree integer_type_node;tree long_integer_type_node;tree long_long_integer_type_node;tree short_unsigned_type_node;tree unsigned_type_node;tree long_unsigned_type_node;tree long_long_unsigned_type_node;tree ptrdiff_type_node;tree unsigned_char_type_node;tree signed_char_type_node;tree char_type_node;tree wchar_type_node;tree signed_wchar_type_node;tree unsigned_wchar_type_node;tree wchar_decl_node;tree float_type_node;tree double_type_node;tree long_double_type_node;tree intQI_type_node;tree intHI_type_node;tree intSI_type_node;tree intDI_type_node;tree unsigned_intQI_type_node;tree unsigned_intHI_type_node;tree unsigned_intSI_type_node;tree unsigned_intDI_type_node;/* a VOID_TYPE node, and the same, packaged in a TREE_LIST.  */tree void_type_node, void_list_node;tree void_zero_node;/* Nodes for types `void *' and `const void *'.  */tree ptr_type_node, const_ptr_type_node;/* Nodes for types `char *' and `const char *'.  */tree string_type_node, const_string_type_node;/* Type `char[256]' or something like it.   Used when an array of char is needed and the size is irrelevant.  */tree char_array_type_node;/* Type `int[256]' or something like it.   Used when an array of int needed and the size is irrelevant.  */tree int_array_type_node;/* Type `wchar_t[256]' or something like it.   Used when a wide string literal is created.  */tree wchar_array_type_node;/* The bool data type, and constants */tree boolean_type_node, boolean_true_node, boolean_false_node;/* type `int ()' -- used for implicit declaration of functions.  */tree default_function_type;/* function types `double (double)' and `double (double, double)', etc.  */tree double_ftype_double, double_ftype_double_double;tree int_ftype_int, long_ftype_long;/* Function type `void (void *, void *, int)' and similar ones.  */tree void_ftype_ptr_ptr_int, int_ftype_ptr_ptr_int, void_ftype_ptr_int_int;/* Function type `char *(char *, char *)' and similar ones */tree string_ftype_ptr_ptr, int_ftype_string_string;/* Function type `size_t (const char *)' */tree sizet_ftype_string;/* Function type `int (const void *, const void *, size_t)' */tree int_ftype_cptr_cptr_sizet;/* C++ extensions */tree vtable_entry_type;tree delta_type_node;#if 0/* Old rtti stuff. */tree __baselist_desc_type_node;tree __i_desc_type_node, __m_desc_type_node;tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type;#endiftree __t_desc_type_node, __tp_desc_type_node;tree __access_mode_type_node;tree __bltn_desc_type_node, __user_desc_type_node, __class_desc_type_node;tree __ptr_desc_type_node, __attr_desc_type_node, __func_desc_type_node;tree __ptmf_desc_type_node, __ptmd_desc_type_node;#if 0/* Not needed yet?  May be needed one day?  */tree __bltn_desc_array_type, __user_desc_array_type, __class_desc_array_type;tree __ptr_desc_array_type, __attr_dec_array_type, __func_desc_array_type;tree __ptmf_desc_array_type, __ptmd_desc_array_type;#endiftree class_star_type_node;tree class_type_node, record_type_node, union_type_node, enum_type_node;tree unknown_type_node;tree opaque_type_node, signature_type_node;tree sigtable_entry_type;tree maybe_gc_cleanup;/* Array type `vtable_entry_type[]' */tree vtbl_type_node;/* In a destructor, the point at which all derived class destroying   has been done, just before any base class destroying will be done.  */tree dtor_label;/* In a constructor, the point at which we are ready to return   the pointer to the initialized object.  */tree ctor_label;/* A FUNCTION_DECL which can call `abort'.  Not necessarily the   one that the user will declare, but sufficient to be called   by routines that want to abort the program.  */tree abort_fndecl;extern rtx cleanup_label, return_label;/* If original DECL_RESULT of current function was a register,   but due to being an addressable named return value, would up   on the stack, this variable holds the named return value's   original location.  */rtx original_result_rtx;/* Sequence of insns which represents base initialization.  */tree base_init_expr;/* C++: Keep these around to reduce calls to `get_identifier'.   Identifiers for `this' in member functions and the auto-delete   parameter for destructors.  */tree this_identifier, in_charge_identifier;/* Used in pointer to member functions, in vtables, and in sigtables. */tree pfn_identifier, index_identifier, delta_identifier, delta2_identifier;tree pfn_or_delta2_identifier, tag_identifier;tree vb_off_identifier, vt_off_identifier;/* A list (chain of TREE_LIST nodes) of named label uses.   The TREE_PURPOSE field is the list of variables defined   the the label's scope defined at the point of use.   The TREE_VALUE field is the LABEL_DECL used.   The TREE_TYPE field holds `current_binding_level' at the   point of the label's use.   Used only for jumps to as-yet undefined labels, since   jumps to defined labels can have their validity checked   by stmt.c.  */static tree named_label_uses;/* A list of objects which have constructors or destructors   which reside in the global scope.  The decl is stored in   the TREE_VALUE slot and the initializer is stored   in the TREE_PURPOSE slot.  */tree static_aggregates;/* -- end of C++ *//* Two expressions that are constants with value zero.   The first is of type `int', the second of type `void *'.  */tree integer_zero_node;tree null_pointer_node;/* A node for the integer constants 1, 2, and 3.  */tree integer_one_node, integer_two_node, integer_three_node;/* Nonzero if we have seen an invalid cross reference   to a struct, union, or enum, but not yet printed the message.  */tree pending_invalid_xref;/* File and line to appear in the eventual error message.  */char *pending_invalid_xref_file;int pending_invalid_xref_line;/* While defining an enum type, this is 1 plus the last enumerator   constant value.  */static tree enum_next_value;/* Nonzero means that there was overflow computing enum_next_value.  */static int enum_overflow;/* Parsing a function declarator leaves a list of parameter names   or a chain or parameter decls here.  */tree last_function_parms;/* Parsing a function declarator leaves here a chain of structure   and enum types declared in the parmlist.  */static tree last_function_parm_tags;/* After parsing the declarator that starts a function definition,   `start_function' puts here the list of parameter names or chain of decls.   `store_parm_decls' finds it here.  */static tree current_function_parms;/* Similar, for last_function_parm_tags.  */static tree current_function_parm_tags;/* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function   that have names.  Here so we can clear out their names' definitions   at the end of the function.  */static tree named_labels;/* A list of LABEL_DECLs from outer contexts that are currently shadowed.  */static tree shadowed_labels;#if 0 /* Not needed by C++ *//* Nonzero when store_parm_decls is called indicates a varargs function.   Value not meaningful after store_parm_decls.  */static int c_function_varargs;#endif/* The FUNCTION_DECL for the function currently being compiled,   or 0 if between functions.  */tree current_function_decl;/* Set to 0 at beginning of a function definition, set to 1 if   a return statement that specifies a return value is seen.  */int current_function_returns_value;/* Set to 0 at beginning of a function definition, set to 1 if   a return statement with no argument is seen.  */int current_function_returns_null;/* Set to 0 at beginning of a function definition, and whenever   a label (case or named) is defined.  Set to value of expression   returned from function when that value can be transformed into   a named return value.  */tree current_function_return_value;/* Set to nonzero by `grokdeclarator' for a function   whose return type is defaulted, if warnings for this are desired.  */static int warn_about_return_type;/* Nonzero means give `double' the same size as `float'.  */extern int flag_short_double;/* Nonzero means don't recognize any builtin functions.  */extern int flag_no_builtin;/* Nonzero means don't recognize the non-ANSI builtin functions.   -ansi sets this.  */extern int flag_no_nonansi_builtin;/* Nonzero means enable obscure ANSI features and disable GNU extensions   that might cause ANSI-compliant code to be miscompiled.  */extern int flag_ansi;/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)   objects. */extern int flag_huge_objects;/* Nonzero if we want to conserve space in the .o files.  We do this   by putting uninitialized data and runtime initialized data into   .common instead of .data at the expense of not flagging multiple   definitions.  */extern int flag_conserve_space;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -