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

📄 c-decl.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 5 页
字号:
/* Nonzero means don't recognize the keyword `asm'.  */int flag_no_asm;/* Nonzero means don't recognize any builtin functions.  */int flag_no_builtin;/* Nonzero means don't recognize the non-ANSI builtin functions.   -ansi sets this.  */int flag_no_nonansi_builtin;/* Nonzero means do some things the same way PCC does.  */int flag_traditional;/* Nonzero means to treat bitfields as signed unless they say `unsigned'.  */int flag_signed_bitfields = 1;int explicit_flag_signed_bitfields = 0;/* Nonzero means handle `#ident' directives.  0 means ignore them.  */int flag_no_ident = 0;/* Nonzero means warn about implicit declarations.  */int warn_implicit;/* Nonzero means give string constants the type `const char *'   to get extra warnings from them.  These warnings will be too numerous   to be useful, except in thoroughly ANSIfied programs.  */int warn_write_strings;/* Nonzero means warn about pointer casts that can drop a type qualifier   from the pointer target type.  */int warn_cast_qual;/* Warn about traditional constructs whose meanings changed in ANSI C.  */int warn_traditional;/* Nonzero means warn about sizeof(function) or addition/subtraction   of function pointers.  */int warn_pointer_arith;/* Nonzero means warn for non-prototype function decls   or non-prototyped defs without previous prototype.  */int warn_strict_prototypes;/* Nonzero means warn for any global function def   without separate previous prototype decl.  */int warn_missing_prototypes;/* Nonzero means warn about multiple (redundant) decls for the same single   variable or function.  */int warn_redundant_decls = 0;/* Nonzero means warn about extern declarations of objects not at   file-scope level and about *all* declarations of functions (whether   extern or static) not at file-scope level.  Note that we exclude   implicit function declarations.  To get warnings about those, use   -Wimplicit.  */int warn_nested_externs = 0;/* Warn about *printf or *scanf format/argument anomalies. */int warn_format;/* Warn about a subscript that has type char.  */int warn_char_subscripts = 0;/* Warn if a type conversion is done that might have confusing results.  */int warn_conversion;/* Warn if adding () is suggested.  */int warn_parentheses;/* Nonzero means `$' can be in an identifier.   See cccp.c for reasons why this breaks some obscure ANSI C programs.  */#ifndef DOLLARS_IN_IDENTIFIERS#define DOLLARS_IN_IDENTIFIERS 1#endifint dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 1;char *language_string = "GNU C";/* Decode the string P as a language-specific option for C.   Return 1 if it is recognized (and handle it);   return 0 if not recognized.  */   intc_decode_option (p)     char *p;{  if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))    {      flag_traditional = 1;      flag_writable_strings = 1;#if DOLLARS_IN_IDENTIFIERS > 0      dollars_in_ident = 1;#endif    }  else if (!strcmp (p, "-fnotraditional") || !strcmp (p, "-fno-traditional"))    {      flag_traditional = 0;      flag_writable_strings = 0;      dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 1;    }  else if (!strcmp (p, "-fsigned-char"))    flag_signed_char = 1;  else if (!strcmp (p, "-funsigned-char"))    flag_signed_char = 0;  else if (!strcmp (p, "-fno-signed-char"))    flag_signed_char = 0;  else if (!strcmp (p, "-fno-unsigned-char"))    flag_signed_char = 1;  else if (!strcmp (p, "-fsigned-bitfields")	   || !strcmp (p, "-fno-unsigned-bitfields"))    {      flag_signed_bitfields = 1;      explicit_flag_signed_bitfields = 1;    }  else if (!strcmp (p, "-funsigned-bitfields")	   || !strcmp (p, "-fno-signed-bitfields"))    {      flag_signed_bitfields = 0;      explicit_flag_signed_bitfields = 1;    }  else if (!strcmp (p, "-fshort-enums"))    flag_short_enums = 1;  else if (!strcmp (p, "-fno-short-enums"))    flag_short_enums = 0;  else if (!strcmp (p, "-fcond-mismatch"))    flag_cond_mismatch = 1;  else if (!strcmp (p, "-fno-cond-mismatch"))    flag_cond_mismatch = 0;  else if (!strcmp (p, "-fshort-double"))    flag_short_double = 1;  else if (!strcmp (p, "-fno-short-double"))    flag_short_double = 0;  else if (!strcmp (p, "-fasm"))    flag_no_asm = 0;  else if (!strcmp (p, "-fno-asm"))    flag_no_asm = 1;  else if (!strcmp (p, "-fbuiltin"))    flag_no_builtin = 0;  else if (!strcmp (p, "-fno-builtin"))    flag_no_builtin = 1;  else if (!strcmp (p, "-fno-ident"))    flag_no_ident = 1;  else if (!strcmp (p, "-fident"))    flag_no_ident = 0;  else if (!strcmp (p, "-ansi"))    flag_no_asm = 1, flag_no_nonansi_builtin = 1, dollars_in_ident = 0;  else if (!strcmp (p, "-Wimplicit"))    warn_implicit = 1;  else if (!strcmp (p, "-Wno-implicit"))    warn_implicit = 0;  else if (!strcmp (p, "-Wwrite-strings"))    warn_write_strings = 1;  else if (!strcmp (p, "-Wno-write-strings"))    warn_write_strings = 0;  else if (!strcmp (p, "-Wcast-qual"))    warn_cast_qual = 1;  else if (!strcmp (p, "-Wno-cast-qual"))    warn_cast_qual = 0;  else if (!strcmp (p, "-Wpointer-arith"))    warn_pointer_arith = 1;  else if (!strcmp (p, "-Wno-pointer-arith"))    warn_pointer_arith = 0;  else if (!strcmp (p, "-Wstrict-prototypes"))    warn_strict_prototypes = 1;  else if (!strcmp (p, "-Wno-strict-prototypes"))    warn_strict_prototypes = 0;  else if (!strcmp (p, "-Wmissing-prototypes"))    warn_missing_prototypes = 1;  else if (!strcmp (p, "-Wno-missing-prototypes"))    warn_missing_prototypes = 0;  else if (!strcmp (p, "-Wredundant-decls"))    warn_redundant_decls = 1;  else if (!strcmp (p, "-Wno-redundant-decls"))    warn_redundant_decls = 0;  else if (!strcmp (p, "-Wnested-externs"))    warn_nested_externs = 1;  else if (!strcmp (p, "-Wno-nested-externs"))    warn_nested_externs = 0;  else if (!strcmp (p, "-Wtraditional"))    warn_traditional = 1;  else if (!strcmp (p, "-Wno-traditional"))    warn_traditional = 0;  else if (!strcmp (p, "-Wformat"))    warn_format = 1;  else if (!strcmp (p, "-Wno-format"))    warn_format = 0;  else if (!strcmp (p, "-Wchar-subscripts"))    warn_char_subscripts = 1;  else if (!strcmp (p, "-Wno-char-subscripts"))    warn_char_subscripts = 0;  else if (!strcmp (p, "-Wconversion"))    warn_conversion = 1;  else if (!strcmp (p, "-Wno-conversion"))    warn_conversion = 0;  else if (!strcmp (p, "-Wparentheses"))    warn_parentheses = 1;  else if (!strcmp (p, "-Wno-parentheses"))    warn_parentheses = 0;  else if (!strcmp (p, "-Wreturn-type"))    warn_return_type = 1;  else if (!strcmp (p, "-Wno-return-type"))    warn_return_type = 0;  else if (!strcmp (p, "-Wcomment"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wno-comment"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wcomments"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wno-comments"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wtrigraphs"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wno-trigraphs"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wimport"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wno-import"))    ; /* cpp handles this one.  */  else if (!strcmp (p, "-Wall"))    {      extra_warnings = 1;      warn_uninitialized = 1;      warn_implicit = 1;      warn_return_type = 1;      warn_unused = 1;      warn_switch = 1;      warn_format = 1;      warn_char_subscripts = 1;      warn_parentheses = 1;    }  else    return 0;  return 1;}/* Hooks for print_node.  */voidprint_lang_decl (){}voidprint_lang_type (){}voidprint_lang_identifier (file, node, indent)     FILE *file;     tree node;     int indent;{  print_node (file, "global", IDENTIFIER_GLOBAL_VALUE (node), indent + 4);  print_node (file, "local", IDENTIFIER_LOCAL_VALUE (node), indent + 4);  print_node (file, "label", IDENTIFIER_LABEL_VALUE (node), indent + 4);  print_node (file, "implicit", IDENTIFIER_IMPLICIT_DECL (node), indent + 4);  print_node (file, "error locus", IDENTIFIER_ERROR_LOCUS (node), indent + 4);  print_node (file, "limbo value", IDENTIFIER_LIMBO_VALUE (node), indent + 4);}/* Create a new `struct binding_level'.  */staticstruct binding_level *make_binding_level (){  /* NOSTRICT */  return (struct binding_level *) xmalloc (sizeof (struct binding_level));}/* Nonzero if we are currently in the global binding level.  */intglobal_bindings_p (){  return current_binding_level == global_binding_level;}voidkeep_next_level (){  keep_next_level_flag = 1;}/* Nonzero if the current level needs to have a BLOCK made.  */intkept_level_p (){  return ((current_binding_level->keep_if_subblocks	   && current_binding_level->blocks != 0)	  || current_binding_level->keep	  || current_binding_level->names != 0	  || (current_binding_level->tags != 0	      && !current_binding_level->tag_transparent));}/* Identify this binding level as a level of parameters.   DEFINITION_FLAG is 1 for a definition, 0 for a declaration.  */voiddeclare_parm_level (definition_flag)     int definition_flag;{  current_binding_level->parm_flag = 1 + definition_flag;}/* Nonzero if currently making parm declarations.  */intin_parm_level_p (){  return current_binding_level->parm_flag;}/* Enter a new binding level.   If TAG_TRANSPARENT is nonzero, do so only for the name space of variables,   not for that of tags.  */voidpushlevel (tag_transparent)     int tag_transparent;{  register struct binding_level *newlevel = NULL_BINDING_LEVEL;  /* If this is the top level of a function,     just make sure that NAMED_LABELS is 0.  */  if (current_binding_level == global_binding_level)    {      named_labels = 0;    }  /* Reuse or create a struct for this binding level.  */  if (free_binding_level)    {      newlevel = free_binding_level;      free_binding_level = free_binding_level->level_chain;    }  else    {      newlevel = make_binding_level ();    }  /* Add this level to the front of the chain (stack) of levels that     are active.  */  *newlevel = clear_binding_level;  newlevel->tag_transparent    = (tag_transparent       || (current_binding_level	   ? current_binding_level->subblocks_tag_transparent	   : 0));  newlevel->level_chain = current_binding_level;  current_binding_level = newlevel;  newlevel->keep = keep_next_level_flag;  keep_next_level_flag = 0;  newlevel->keep_if_subblocks = keep_next_if_subblocks;  keep_next_if_subblocks = 0;}/* Exit a binding level.   Pop the level off, and restore the state of the identifier-decl mappings   that were in effect when this level was entered.   If KEEP is nonzero, this level had explicit declarations, so   and create a "block" (a BLOCK node) for the level   to record its declarations and subblocks for symbol table output.   If FUNCTIONBODY is nonzero, this level is the body of a function,   so create a block as if KEEP were set and also clear out all   label names.   If REVERSE is nonzero, reverse the order of decls before putting   them into the BLOCK.  */treepoplevel (keep, reverse, functionbody)     int keep;     int reverse;     int functionbody;{  register tree link;  /* The chain of decls was accumulated in reverse order.

⌨️ 快捷键说明

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