免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4842 | 回复: 2

GCC中spec的问题 [复制链接]

论坛徽章:
0
发表于 2015-01-16 10:04 |显示全部楼层
在gcc/gcc.c中有如下代码:
static const struct compiler default_compilers[] =
{
  /* Add lists of suffixes of known languages here.  If those languages
     were not present when we built the driver, we will hit these copies
     and be given a more meaningful error than "file not used since
     linking is not done".  */
  {".m",  "#Objective-C", 0, 0, 0}, {".mi",  "#Objective-C", 0, 0, 0},
  {".mm", "#Objective-C++", 0, 0, 0}, {".M", "#Objective-C++", 0, 0, 0},
  {".mii", "#Objective-C++", 0, 0, 0},
  {".cc", "#C++", 0, 0, 0}, {".cxx", "#C++", 0, 0, 0},
  {".cpp", "#C++", 0, 0, 0}, {".cp", "#C++", 0, 0, 0},
  {".c++", "#C++", 0, 0, 0}, {".C", "#C++", 0, 0, 0},
  {".CPP", "#C++", 0, 0, 0}, {".ii", "#C++", 0, 0, 0},
  {".ads", "#Ada", 0, 0, 0}, {".adb", "#Ada", 0, 0, 0},
  {".f", "#Fortran", 0, 0, 0}, {".F", "#Fortran", 0, 0, 0},
  {".for", "#Fortran", 0, 0, 0}, {".FOR", "#Fortran", 0, 0, 0},
  {".ftn", "#Fortran", 0, 0, 0}, {".FTN", "#Fortran", 0, 0, 0},
  {".fpp", "#Fortran", 0, 0, 0}, {".FPP", "#Fortran", 0, 0, 0},
  {".f90", "#Fortran", 0, 0, 0}, {".F90", "#Fortran", 0, 0, 0},
  {".f95", "#Fortran", 0, 0, 0}, {".F95", "#Fortran", 0, 0, 0},
  {".f03", "#Fortran", 0, 0, 0}, {".F03", "#Fortran", 0, 0, 0},
  {".f08", "#Fortran", 0, 0, 0}, {".F08", "#Fortran", 0, 0, 0},
  {".r", "#Ratfor", 0, 0, 0},
  {".p", "#Pascal", 0, 0, 0}, {".pas", "#Pascal", 0, 0, 0},
  {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0},
  {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0},
  /* Next come the entries for C.  */
  {".c", "@c", 0, 1, 1},
  {"@c",
   /* cc1 has an integrated ISO C preprocessor.  We should invoke the
      external preprocessor if -save-temps is given.  */
     "%{E|M|MM:%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)}\
      %{!E:%{!M:%{!MM:\
          %{traditional|ftraditional:\
%eGNU C no longer supports -traditional without -E}\
       %{!combine:\
      %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
        %(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i} \n\
            cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} \
            %(cc1_options)}\
      %{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\
        cc1 %(cpp_unique_options) %(cc1_options)}}}\
          %{!fsyntax-only:%(invoke_as)}} \
      %{combine:\
      %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
        %(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i}}\
      %{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\
        cc1 %(cpp_unique_options) %(cc1_options)}}\
                %{!fsyntax-only:%(invoke_as)}}}}}}", 0, 1, 1},
  {"-",
   "%{!E:%e-E or -x required when input is from standard input}\
    %(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)", 0, 0, 0},
  {".h", "@c-header", 0, 0, 0},
  {"@c-header",
   /* cc1 has an integrated ISO C preprocessor.  We should invoke the
      external preprocessor if -save-temps is given.  */
     "%{E|M|MM:%(trad_capable_cpp) %(cpp_options) %(cpp_debug_options)}\
      %{!E:%{!M:%{!MM:\
          %{save-temps|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
                %(cpp_options) -o %{save-temps:%b.i} %{!save-temps:%g.i} \n\
                    cc1 -fpreprocessed %{save-temps:%b.i} %{!save-temps:%g.i} \
                        %(cc1_options)\
                        -o %g.s %{!o*:--output-pch=%i.gch}\
                        %W{o*:--output-pch=%*}%V}\
          %{!save-temps:%{!traditional-cpp:%{!no-integrated-cpp:\
                cc1 %(cpp_unique_options) %(cc1_options)\
                    -o %g.s %{!o*:--output-pch=%i.gch}\
                    %W{o*:--output-pch=%*}%V}}}}}}", 0, 0, 0},
  {".i", "@cpp-output", 0, 1, 0},
  {"@cpp-output",
   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 1, 0},
  {".s", "@assembler", 0, 1, 0},
  {"@assembler",
   "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 1, 0},
  {".sx", "@assembler-with-cpp", 0, 1, 0},
  {".S", "@assembler-with-cpp", 0, 1, 0},
  {"@assembler-with-cpp",
#ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT
   "%(trad_capable_cpp) -lang-asm %(cpp_options) -fno-directives-only\
      %{E|M|MM:%(cpp_debug_options)}\
      %{!M:%{!MM:%{!E:%{!S %|.s |\n\
       as %(asm_debug) %(asm_options) %|.s %A }}}}"
#else
   "%(trad_capable_cpp) -lang-asm %(cpp_options) -fno-directives-only\
      %{E|M|MM:%(cpp_debug_options)}\
      %{!M:%{!MM:%{!E:%{!S %|.s |\n\
       as %(asm_debug) %(asm_options) %m.s %A }}}}"
#endif
   , 0, 1, 0},

#include "specs.h"   /* Mark end of table.  */
  {0, 0, 0, 0, 0}        //结束标识
};

现在的问题是:
1.  {".m",  "#Objective-C", 0, 0, 0}中"#Objective-C"表示什么意思?#有什么特殊意义吗?
2.  {".h", "@c-header", 0, 0, 0},
  {"@c-header",
   //省略
},
中"@c-header"好像表示的是一个SPEC的“名称”,其中的@符号有什么特殊含义?

上述这些问题需要从哪里获取帮助?请各位指点。

论坛徽章:
2
摩羯座
日期:2013-10-10 14:29:04天蝎座
日期:2014-01-03 09:14:49
发表于 2015-01-16 11:38 |显示全部楼层

论坛徽章:
0
发表于 2015-01-16 11:54 |显示全部楼层
回复 2# EricFisher

谢谢版主,看到了如下的描述:


@language:表示该后缀是某个已知语言language的别名,例如:
.ZZ:
@c++
表示.ZZ文件实际上是一个c++的源文件
#name :用来生成“name compiler not installed on this system.”的错误信息。

感谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP