home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gccdist / gcc / gcc.hlp < prev    next >
Encoding:
Text File  |  1992-06-11  |  17.4 KB  |  487 lines

  1. 1 GCC
  2.  
  3.  The GCC command invokes the GNU C compiler.
  4.  
  5.        GCC file-spec
  6.  
  7. 2 Parameters
  8.  
  9.  file-spec
  10.  
  11.  A C source file.  If no input file  extension  is  specified,  GNU  C
  12.  assumes  .C  as  the  default extension unless the /PLUS qualifier is
  13.  given, in which case .CC is assumed as the default extension.
  14.  
  15.  If an extension of .CPP is given, then the source file is assumed  to
  16.  be  the  output of the preprocessor, and thus the preprocessor is not
  17.  executed.
  18.  
  19.  If an extension of .S is given, then the source file is assumed to be
  20.  the  assembly  code output of the compiler, and only the assembler is
  21.  called to generate an object file.
  22.  
  23. 2 Qualifiers
  24.  
  25.  GNU C command qualifiers modify the  way  the  compiler  handles  the
  26.  compilation.
  27.  
  28.  The following is the list of available qualifiers for GNU C:
  29.  
  30.        /[NO]CASE_HACK            (default is /Case_Hack)
  31.        /CC1_OPTIONS=("option"[,"option"...]])
  32.        /[NO]DEBUG                (default is /noDebug)
  33.        /DEFINE=("identifier[=definition]"[,...])
  34.        /[NO]G_FLOAT
  35.        /INCLUDE_DIRECTORY=(path[,path...]])
  36.        /[NO]LIST[=filename]
  37.        /[NO]MACHINE_CODE[=filename]
  38.        /[NO]OBJECT[=filename]
  39.        /[NO]OPTIMIZE[=n]         (default is /Optimize=1)
  40.        /NAMES[=option]
  41.        /[NO]PLUS_PLUS            (default is /noPlus_Plus)
  42.        /PREPROCESS_ONLY[=filename]
  43.        /PROFILE[=identifier]
  44.        /SCAN=(file[,file...])
  45.        /SHOW[=option]
  46.        /[NO]STANDARD[=option]
  47.        /TARGET=machine
  48.        /UNDEFINE=("identifier"[,"identifier",...])
  49.        /[NO]VERBOSE[=option]
  50.        /VERSION
  51.        /WARNINGS
  52.  
  53. 2 Linking
  54.  
  55.  When linking programs compiled with GNU C, you should include the GNU
  56.  C library before the VAX C library.  For example,
  57.  
  58.    LINK object-file,GNU_CC:[000000]GCCLIB/LIB,SYS$LIBRARY:VAXCRTL/LIB
  59.  
  60.  You can also link your program with the shared VAX C  library.   This
  61.  can reduce the size of the .EXE file, as well as make it smaller when
  62.  it's running.  For example,
  63.  
  64.    $ LINK object-file, GNU_CC:[000000]GCCLIB/LIB,SYS$INPUT/OPT
  65.    SYS$SHARE:VAXCRTL/SHARE
  66.  
  67.  (If you use the second example and type it in by  hand,  be  sure  to
  68.  type ^Z after the last carriage return).  A simpler alternative would
  69.  be to place the single line:
  70.  
  71.    SYS$SHARE:VAXCRTL/SHARE
  72.  
  73.  into a file called VAXCRTL.OPT, and then use the link command:
  74.  
  75.    $ LINK object-file, GNU_CC:[000000]GCCLIB/LIB,VAXCRTL.OPT/OPT
  76.  
  77.  If a program has  been  compiled  with  /G_FLOAT,  then  the  linking
  78.  instructions  are  slightly  different.   If you are linking with the
  79.  non-shared library, then the command that you should use would be:
  80.  
  81.    LINK object-file,GNU_CC:[000000]GCCLIB/LIB,SYS$LIBRARY:VAXCRTLG/LIB -
  82.                                 ,SYS$LIBRARY:VAXCRTL/LIB
  83.  
  84.  Note that both VAXCRTL and VAXCRTLG must be linked to.   If  you  are
  85.  using the shared VAX C library, then you should use a command like:
  86.  
  87.    $ LINK object-file, GNU_CC:[000000]GCCLIB/LIB,SYS$INPUT:/OPTIONS
  88.    SYS$SHARE:VAXCRTLG/SHARE
  89.  
  90.  In the case of the sharable library, only one  library  needs  to  be
  91.  linked to.
  92.  
  93.  If you need to link to libg++, it  is  easiest  to  use  the  command
  94.  procedure supplied with libg++ to link your program.
  95.  
  96. 2 /CASE_HACK
  97.  
  98.    /[NO]CASE_HACK      D=/CASE_HACK
  99.  
  100.  Although the VMS Linker and Librarian are case sensitive with respect
  101.  to  symbol  names,  traditionally  compilers  have generated external
  102.  symbols  which  were  uppercase  only.   By  default  GCC   generates
  103.  uppercase  symbols,  but  a  "case-hack" is appended to a symbol name
  104.  when the symbol contains any upper case characters  (unless  it  also
  105.  contains  one  or  more dollar sign characters).  This allows symbols
  106.  whose spelling differs only in case to be used together in  the  same
  107.  program.   The dollar sign exception makes it easier to deal with VMS
  108.  run-time libraries.
  109.  
  110.  There are cases where this is undesirable (mainly when using  certain
  111.  applications  where modules have been precompiled, perhaps in another
  112.  language) and we want to compile  without  case  hacking.   In  these
  113.  cases the /NOCASE_HACK switch disables case hacking.
  114.  
  115.  The /NAMES qualifier supercedes /CASE_HACK.
  116.  
  117. 2 /CC1_OPTIONS
  118.  
  119.  This specifies additional  switches  to  the  compiler  itself  which
  120.  cannot be set by means of the compiler driver.
  121.  
  122. 2 /DEBUG
  123.  
  124.  /DEBUG includes additional information in the object file  output  so
  125.  that the program can be debugged with the VAX Symbolic Debugger.
  126.  
  127.  To use the debugger it is also necessary to link the debugger to your
  128.  program, which is done by specifying the /DEBUG qualifier to the link
  129.  command.  With the  debugger  it  is  possible  to  set  breakpoints,
  130.  examine  variables,  and  set  variables  to new values.  See the VAX
  131.  Symbolic Debugger manual for more information, or  type  "HELP"  from
  132.  the debugger prompt.
  133.  
  134. 2 /DEFINE
  135.  
  136.  /DEFINE=(identifier[=definition][,...])
  137.  
  138.  /DEFINE defines a string or macro ('definition')  to  be  substituted
  139.  for  every  occurrence of a given string ('identifier') in a program.
  140.  It is equivalent to the #define preprocessor directive.
  141.  
  142.  All definitions and identifiers are  converted  to  uppercase  unless
  143.  they are in quotation marks.
  144.  
  145.  The simple form of the /DEFINE qualifier:
  146.  
  147.     /DEFINE=vms
  148.  
  149.  results in a definition equivalent to the preprocessor directive:
  150.  
  151.   #define VMS 1
  152.  
  153.  You must enclose macro definitions in quotation  marks,  as  in  this
  154.  example:
  155.  
  156.   /DEFINE="C(x)=((x) & 0xff)"
  157.  
  158.  This definition is the same as the preprocessor definition:
  159.  
  160.   #define C(x) ((x) & 0xff)
  161.  
  162.  If more than one /DEFINE is present on the GCC command line, only the
  163.  last /DEFINE is used.
  164.  
  165.  If both /DEFINE and /UNDEFINE are present on a command line,  /DEFINE
  166.  is evaluated before /UNDEFINE.
  167.  
  168. 2 /G_FLOAT
  169.  
  170.  Instructs the compiler to use "G" floating point  arithmetic  instead
  171.  of  "D".   The  difference  is  that  double precision has a range of
  172.  approximately +/-0.56e-308 to +/-0.9  e+308,  with  approximately  15
  173.  decimal digits precision.
  174.  
  175.  "D" floating point has the same range as  single  precision  floating
  176.  point, with approximately 17 decimal digits precision.
  177.  
  178.  If you use the  /G_FLOAT  qualifier,  the  linking  instructions  are
  179.  different.  See "Linking" for further details.
  180.  
  181. 2 /LIST
  182.  
  183.  /LIST[=list_file_name]
  184.  
  185.  This does not generate a listing file in the usual sense, however  it
  186.  does  direct the compiler to save the preprocessor output.  If a file
  187.  is not specified, then this output is written into a  file  with  the
  188.  same name as the source file and an extension of .CPP.
  189.  
  190. 2 /INCLUDE_DIRECTORY
  191.  
  192.   /INCLUDE_DIRECTORY=(path [,path...])
  193.  
  194.  The /INCLUDE_DIRECTORY qualifier provides additional  directories  to
  195.  search  for  user-defined  include  files.   'path'  can  be either a
  196.  logical name or a directory specification.
  197.  
  198.  There  are  two  forms  for  specifying  include  files  -   #include
  199.  "file-spec"  and  #include <file-spec>.  For the #include "file-spec"
  200.  form, the search order is:
  201.  
  202.   1.  The directory containing the source file.
  203.  
  204.   2.  The directories in the /INCLUDE qualifier (if any).
  205.  
  206.   3.  The directory (or directories) specified in the logical name
  207.       GNU_CC_INCLUDE.
  208.  
  209.   4.  The directory (or directories) specified in the logical name
  210.       SYS$LIBRARY.
  211.  
  212.   For the #include <file-spec> form, the search order is:
  213.  
  214.   1.  The directories specified in the /INCLUDE qualifier (if any).
  215.  
  216.   2.  The directory (or directories) specified in the logical name
  217.       GNU_CC_INCLUDE.
  218.  
  219.   3.  The directory (or directories) specified in the logical name
  220.       SYS$LIBRARY.
  221.  
  222. 2 /MACHINE_CODE
  223.  
  224.  /[NO]MACHINE_CODE[=filename]
  225.  
  226.  Tells GNU C to output the machine code  generated  by  the  compiler.
  227.  The  machine  code  is output to the filename specified, or to a file
  228.  with the same name as the input file,  with  the  extension  .S.   An
  229.  object file is still generated, unless /NOOBJ is also specified.
  230.  
  231.  The  default  is  /NOMACHINE_CODE,  which  causes  the   intermediate
  232.  assembler  file  to be written to SYS$SCRATCH:file.S and then deleted
  233.  upon completion of the compilation.
  234.  
  235. 2 /OBJECT
  236.  
  237.    /OBJECT[=filename]
  238.    /NOOBJECT
  239.  
  240.  Controls whether or not an object file is generated by the compiler.
  241.  
  242.  The default is /OBJECT unless /PREPROCESS_ONLY is specified.
  243.  
  244. 2 /OPTIMIZE
  245.  
  246.  /[NO]OPTIMIZE[=n]
  247.  
  248.  Controls whether optimization  is  performed  by  the  compiler.   By
  249.  default,  optimization  is  on.   /NOOPTIMIZE turns optimization off.
  250.  You can also specify the  level  of  optimization  with  /OPTIMIZE=n,
  251.  where  0  <=  n <= 2.  The case n=0 is equivalent to /NOOPTIMIZE, and
  252.  the default is /OPTIMIZE=1.
  253.  
  254. 2 /NAME
  255.  
  256.  /NAME[=option]
  257.  
  258.         Controls the mapping of symbol names.   Possible  options  are
  259.  HEX_SUFFIX  (default),  LOWER,  UPPER,  and  MIXED.  The /NOCASE_HACK
  260.  switch is equivalent to the /NAME=UPPER switch.
  261.  
  262. 2 /PLUS_PLUS
  263.      /[NO]PLUS_PLUS
  264.  
  265.  Instructs the compiler driver to use the GNU-C++ compiler instead  of
  266.  the  GNU-C compiler.  Note that the default extension of source files
  267.  is .CC when this qualifier is in effect.
  268.  
  269.  The default is /NOPLUS_PLUS, indicating a normal C compilation.
  270.  
  271. 2 /PREPROCESS_ONLY
  272.      /[NO]PREPROCESS_ONLY[=filename]
  273.  
  274.  Instructs the compiler to execute only  the  preprocessing  phase  of
  275.  compilation.  If filename is not specified then the name used will be
  276.  the base portion of the input file with .CPP as the filetype.
  277.  
  278.  This is similar to /LIST, except that it also implies  /NOOBJECT  and
  279.  /NOMACHINE_CODE.
  280.  
  281. 2 /PROFILE
  282.  
  283.  /PROFILE[=identifier]
  284.  
  285.  Instructs the compiler to generate function profiling code.  You must
  286.  link  your  program  to  the profiler when you use this options.  The
  287.  profile statistics are automatically  printed  out  on  the  terminal
  288.  during  image  exit.  (i.e.  no modifications to your source file are
  289.  required in order to use the profiler).
  290.  
  291.  There are three identifiers  that  can  be  used  with  the  /PROFILE
  292.  switch.   These  are  ALL, FUNCTION, and BLOCK.  If /PROFILE is given
  293.  without an identifier, then FUNCTION is assumed.
  294.  
  295. 3 Block_Profiler
  296.  
  297.  The block profiler counts how  many  times  control  of  the  program
  298.  passes certain points in your program.  This is useful in determining
  299.  which  portions  of  a  program  would  benefit  from  recoding   for
  300.  optimization.
  301.  
  302.  The report for the block profiler contains the  function  name,  file
  303.  name, PC, and the source file line number as well as the count of how
  304.  many times control has passed through the specified source line.
  305.  
  306. 3 Function_Profiler
  307.  
  308.  The function profiler counts how many times each function is entered,
  309.  and keeps track of how much CPU time is used within each function.
  310.  
  311.  You should be careful about  interpreting  the  results  of  profiles
  312.  where  there  are  inline  functions.  When a function is included as
  313.  inline, then there is no call to the internal data collection routine
  314.  used  by  the  profiler,  and  thus  there  will be no record of this
  315.  function being called.  The compiler does generate a callable version
  316.  of each inline function, and if this called version is used, then the
  317.  profiler's data collection routine will be called.
  318.  
  319. 2 /SCAN
  320.  
  321.  /SCAN=(file[,file...])
  322.  
  323.  This qualifier supplies a list of files that will be read  as  input,
  324.  and  the output will be discarded before processing the regular input
  325.  file.  Because the output generated from the files is discarded,  the
  326.  only  effect  of  this qualifier is to make the macros defined in the
  327.  files available for use in the main input.
  328.  
  329. 2 /SHOW
  330.  
  331.  /SHOW[=option]
  332.  
  333.  This causes the preprocessor to generate information other  than  the
  334.  preprocessed  input  file.   When this qualifier is used, no assembly
  335.  code and no object file is generated.
  336.  
  337.  The output of the preprocessor is placed in the file specified by the
  338.  /LIST  qualifier, if present.  If the /LIST qualifier is not present,
  339.  then the output is placed in a file with the same name as  the  input
  340.  file  with  an  extension  that  depends  upon  which  option that is
  341.  selected.
  342.  
  343. 3 DEFINITIONS
  344.  
  345.  This option causes the preprocessor to dump a  list  of  all  of  the
  346.  definitions  to  the  output  file.   This  is  useful  for debugging
  347.  purposes, since it lets you determine whether or not  everything  has
  348.  been defined properly.
  349.  
  350.  If the default file name is used for the output, the  extension  will
  351.  be .DEF.
  352.  
  353. 3 RULES
  354.  
  355.  This option causes the preprocessor to output  a  rule  suitable  for
  356.  MAKE,  describing  the  dependencies  of  the  main source file.  The
  357.  preprocessor outputs one MAKE rule containing the  object  file  name
  358.  for  that  source  file,  a colon, and the names of all the concluded
  359.  files.  If there are many included files then the rule is split  into
  360.  several lines using the '\'-newline.
  361.  
  362.  When using this option, only files included with the "#include "file"
  363.  directive are mentioned.
  364.  
  365.  If the default file name is used for the  output,  a  null  extension
  366.  will be used.
  367.  
  368. 3 ALL
  369.  
  370.  This option is similar to RULES, except that it also  mentions  files
  371.  included with the "#include <file.h>" directive.
  372.  
  373.  If the default file name is used for the  output,  a  null  extension
  374.  will be used.
  375.  
  376. 2 /STANDARD
  377.      /STANDARD[=option]
  378.      /NOSTANDARD
  379.  
  380.  Controls use of GCC's -traditional,  -ansi,  and  -pedantic  options.
  381.  The  available options are PORTABLE and [NO]ANSI.  /STANDARD=PORTABLE
  382.  causes  the  ``-ansi  -pedantic''  switch  combination  to  be  used.
  383.  /STANDARD=ANSI is equivalent to /STANDARD, and causes ``-ansi'' to be
  384.  used.  /STANDARD=NOANSI is equivalent omitting /STANDARD  altogether,
  385.  and  is the default.  No special switches are used by the compiler in
  386.  that case.
  387.  
  388.  Specifying /NOSTANDARD is different from simply  omitting  /STANDARD;
  389.  it causes the ``-traditional'' switch to be used.
  390.  
  391.  See the GCC manual for the implications of these compiler switches.
  392.  
  393. 2 /UNDEFINE
  394.  
  395.  /UNDEFINE cancels a macro definition.  Thus, it is the  same  as  the
  396.  #undef preprocessor directive.
  397.  
  398.  If more than one /UNDEFINE is present on the GCC command  line,  only
  399.  the last /UNDEFINE is used.
  400.  
  401.  If both /DEFINE and /UNDEFINE are present on a command line,  /DEFINE
  402.  is evaluated before /UNDEFINE.
  403.  
  404. 2 /TARGET=machine
  405.  
  406.  Directs the compiler driver to look in a subdirectory (going  by  the
  407.  machine  name)  for  compiler  binaries.  This can be used for cross-
  408.  compilation or  this  can  be  used  to  maintain  several  different
  409.  versions of gcc on the system simultaneously.
  410.  
  411. 2 /VERBOSE
  412.      /[NO]VERBOSE[=(option,...)]
  413.  
  414.  Available  options  are  ALL,  ECHO,  VERIFY  (equivalent  to  ECHO),
  415.  STATISTICS,  and  NONE.   /VERBOSE=NONE  is equivalent to /NOVERBOSE,
  416.  which is the default.  /VERBOSE is equivalent to /VERBOSE=ALL,  which
  417.  in turn is equivalent to /VERBOSE=(ECHO,STATISTICS).
  418.  
  419.  /VERBOSE=ECHO causes DCL verification to  be  used  by  the  compiler
  420.  driver  routine  while  it invokes each separate phase of compilation
  421.  (preprocessor, compiler proper, and assembler back-end).
  422.  
  423.  /VERBOSE=STATISTICS causes GCC to provide  some  tracing  information
  424.  (source  function  names)  as  it  progresses,  and  also  to provide
  425.  internal timing statistics when it completes the primary  compilation
  426.  phase.
  427.  
  428.  /NOVERBOSE supresses the warning messages about debug being specified
  429.  while optimization is enabled.
  430.  
  431. 2 /VERSION
  432.  
  433.  Causes  the  driver,  preprocessor  and  the  compiler  to   identify
  434.  themselves by their version numbers, and in the case of the compiler,
  435.  the version number of the compiler that built it.
  436.  
  437. 2 /WARNINGS
  438.  
  439.  When this qualifier is present, warnings about usage that  should  be
  440.  avoided  are given by the compiler.  For more information, see "Using
  441.  and Porting GNU CC", in the section on command  line  options,  under
  442.  "-Wall".
  443.  
  444.  Warnings are also generated by the preprocessor when  this  qualifier
  445.  is given.
  446.  
  447. 2 Known_Incompatibilities_with_VAX-C
  448.  
  449.  There are several known incompatibilities between  GNU-C  and  VAX-C.
  450.  Some  common  ones  will  be  briefly  described  here.   A  complete
  451.  description can be found in "Using and Porting GNU CC" in the chapter
  452.  entitled "Using GNU CC on VMS".
  453.  
  454.      GNU-C provides case hacking as a means of giving case sensitivity
  455.  to  symbol  names.  The case hack is a hexadecimal number appended to
  456.  the symbol name, with a bit being set for  each  upper  case  letter.
  457.  Symbols with all lower case, or symbols that have a dollar sign ("$")
  458.  are not case hacked.  There  are  times  that  this  is  undesirable,
  459.  namely  when  you  wish  to  link  your program against a precompiled
  460.  library which was compiled with a non-GNU-C compiler.  X-windows  (or
  461.  DECWindows)   is  an  example  of  this.   In  these  instances,  the
  462.  /NOCASE_HACK switch should be used.
  463.  
  464.  If you require case hacking in some cases, but not  in  others  (i.e.
  465.  Libg++  with  DECWindows),  then it is recommended that you develop a
  466.  header file which will define all mixed case  functions  that  should
  467.  not have a case hack as the lower case equivalents.
  468.  
  469.      GNU-C does not provide  the  globaldef  and  globalref  mechanism
  470.  which  is  used  by VAX-C to coerce the VMS linker to include certain
  471.  object modules from a library.  There are assembler hacks, which  are
  472.  available  to  the  user  through  the macros defined in gnu_hacks.h,
  473.  which effectively give you the ability to  perform  these  functions.
  474.  While  not  syntactically  identical,  they  do  provide  most of the
  475.  functionality.
  476.  
  477.  Note that globaldefs of enums is not supported in the way that it  is
  478.  under  VAX-C.  This can be easily simulated, however, by globaldefing
  479.  an integer variable, and then globalvaluing  all  of  the  enumerated
  480.  states.
  481.  
  482.  Furthermore, the way that globalvalue is currently  implemented,  the
  483.  data type of the globalvalue variable is seen to the compiler to be a
  484.  pointer to the data type that you  specify.   This  is  necessary  in
  485.  order   to  make  the  compiler  correctly  address  the  globalvalue
  486.  variables.
  487.