home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / DJGPP / DJDOC106.ZIP / DOCS / GCCINFO.DOC < prev    next >
Encoding:
INI File  |  1991-06-22  |  16.7 KB  |  321 lines

  1. [INFORMATION ABOUT GNU C]
  2.  
  3. This information is NOT intended to replace the official FSF manuals. 
  4. When the FSF manuals and this file conflict, the FSF manuals are
  5. correct. 
  6.  
  7. [Arguments to the GCC call]
  8.  
  9. df = default(ing), fn = function, xxxx = any text, nnnn = any number,
  10. var = variable. Note that gcc is case sensitive in its arguments.
  11.  
  12. <OVERALL>
  13. xxxx.cc        preprocess and compile and assemble and link this file
  14. xxxx.c        preprocess and compile and assemble and link this file
  15. xxxx.i        compile and assemble and link this file (do not preprocess it)
  16. xxxx.S        preprocess and assemble and link this file (do not compile it)
  17. xxxx.s        assemble and link this file (do not compile or preprocess it)
  18. xxxx.o        link this file (do not assemble or preprocess or compile it)
  19. -v        print commands and version numbers as they are executed
  20. -pipe        compilation stages communicate by pipes, not by temporary files
  21.         (-pipe does not work under DOS)
  22. -Bxxxx        look for cpp & cc1 & as & ld first with prefix xxxx
  23. -bxxxx        as -Bxxxx but before obeying -Bxxxx
  24.         (Then, compiler uses prefix as in PATH environmental variable)
  25.  
  26. <PREPROCESSING STAGE> (i.e. obeying the #directives)
  27. -E -oxxxx    send preprocessed C to file xxxx, then stop
  28. -E        send preprocessed C to standard output (= screen), then stop
  29. -C        pass comments through, do not delete them. Error unless -E also
  30. -D xxxx=yyyy    obey macro: #define xxxx yyyy
  31. -D xxxx        obey macro: #define xxxx 1
  32. -d        output list of #define's, not usual output. Error unless -E also
  33. -I xxxx        for #include'd files, look first in directory xxxx:-
  34.         (after or without -I-) for all #include'd files
  35.         (before -I-) only for #include"file", not for #include<file>
  36.         (after or before -I-) do not look first in current directory
  37. -I-        see under -I xxxx
  38. -i xxxx        preprocess file xxxx, keep macros defined in it, reject the rest
  39. -MM        write a MAKE rule for how program is put together. Implies -E
  40. -M        ditto, includung all #include'd files. Implies -E
  41. -nostdinc    do not search standard dictionaries for #include'd files
  42. -P        do not generate # lines with line number info
  43. -pedantic    work exactly by ANSI
  44. -trigraphs    process ANSI trigraphs (eg ??/ for \). Implied by -ansi
  45. -U xxxx        do not predefine macro xxxx. Defeats -D
  46. -undef         do not predefine any macros. Implied by -ansi
  47.  
  48. <COMPILATION STAGE> (converts C code into assembler code)
  49. -S -oxxxx    compile into assembler code onto file xxxx.S, then stop
  50. -S        ditto, where xxxx = source file's name without its suffix
  51. -ansi        ignore keywords asm, inline, typeof, and
  52.         do not predefine macros unix, vax, etc that say which system;
  53.         but still define them with __ attached at each end
  54. -traditional    various feature of older C compilers, see below
  55. -O        optimize
  56. -g        produce debugging info
  57. -gg        produce debugging info in an obsolete format
  58. -w        no warning messages
  59. -W        warn of:-    (the first two only if optimizing)
  60.         auto variable used before it is initialized
  61.         auto variable not declared volatile, if longjmp may zap it
  62.         function has both valued & valueless returns
  63.             (falling off end = valueless return)
  64.         statement is expression with no side effects
  65. -Wimplicit    warn when function is implicitly declared
  66. -Wreturn-type    warn if function defaults to int,
  67.         and of return with no argument if function is not void
  68. -Wunused    warn of vars and static fns and results which are not used
  69. -Wswitch    warn of missing and out of range cases with switch(enum value)
  70. -Wcomment    warn of /* in comment
  71. -Wtrigraphs    warn of trigraphs
  72. -Wall        as -W and all six abovementioned -Wxxxx arguments
  73. -Wshadow    warn if local var has same name as another var
  74. -Wid-clash-nnnn    warn if two names have first nnnn chars same
  75. -Wpointer-arith    warn if sizeof(function or void): these are treated as 1
  76. -Wcast-qual    warn if cast removes qualifier (e.g. const*int to *int)
  77. -Wwrite-strings    give string literals the type const char[]
  78. -p        insert code to write profile info for analysis program 'prof'
  79. -pg        insert code to write profile info for analysis program 'gprof'
  80. -a        insert code to write profile info for basic blocks
  81. -m68020        output for 68030, not 6800. Default.
  82. -mc68020    output for 68030, not 6800. Default.
  83. -m68000        output for 68000, not 68020
  84. -mc68000    output for 68000, not 68020
  85. -m68881        output 68881 instructions for floating point. Default
  86. -mshort        int (rather than long int or short int) will be 16 bits wide
  87. -mnobitfield    no bit fields. implied by -m68000
  88. -mbitfield    bit fields. default. implied by -m68020
  89. -mrtd        use a different way to call functions
  90. -fxxxx:    prefix or remove 'no-' after '-f' to reverse its effect.
  91.     In each -fxxxx and -fno-xxxx pair, the omitted form is default.
  92. -fpcc-struct-return    return struct and union values as in system's usual C
  93. -ffloat-store        do not store float values in registers
  94. -fno-asm        do not recognise keywords asm, inline, typeof
  95. -fno-defer-pop        pop function args at once after each function return
  96. -fstrength-reduce    some loop optimizations
  97. -fcombine-regs        combine register-to-register copy instructions
  98. -fforce-mem        copy memory values into registers before arithmetic
  99. -fforce-addr        copy address values into registers before arithmetic
  100. -fomit-frame-pointer    don't keep frame pointer in register if not needed
  101. -finline-functions    all 'simple' functions are compiled inline.
  102.             The compiler decides if each function is simple enough
  103. -fcaller-saves        allocate values in registers zapped by function calls
  104. -fkeep-inline-functions    output a separate version of all inline functions
  105. -fwritable-strings    store strings in writable data segment, not unique
  106. -found-mismatch        allow x?y:z with y & z mismatched types. Result is void
  107. -fno-function-cse    do not put function addresses in registers
  108. -fvolatile        all memory refs through pointers are treated as volatile
  109. -fshared-data        data and non-const vars are shared data, not private
  110. -funsigned-char        char = unsigned char
  111. -fsigned-char        char = signed char (default)
  112. -fdelayed-branch    re not wasting instruction spaces after jumps
  113. -ffixed-xxxx        generate code so it won't alter register xxxx
  114. -fcall-used-xxxx    let function calls zap register xxxx
  115. -fcall-saved-xxxx    don't let function calls zap register xxxx
  116. -pedantic    allow only what is legal by ANSI definition
  117. -Q        output function names, time taken by compiler stages, etc
  118. -dumpbase xxxx    specify first part of dump file names for -d<letter>
  119.         (Warning: default = whole input file name including its suffix,
  120.         which on PC's will cause illegal names for dump files.)
  121. -d<letter>    make RTL intermediate language dump after:-
  122.     <step that dump is made after>    <file that dump is written to>
  123. -dr    converting program to RTL    xxxx.RTL
  124. -dj    first jump optimization        xxxx.JUMP
  125. -ds    finding common subexpressions    xxxx.CSE
  126. -dL    loop optimization        xxxx.LOOP
  127. -df    flow analysis            xxxx.FLOW
  128. -dc    instruction combination        xxxx.COMBINE
  129. -dl    local register allocation    xxxx.LREG
  130. -dg    global register allocation    xxxx.GREG
  131. -dJ    last jump optimization        xxxx.JUMP2
  132. -dd    delayed branch scheduling    xxxx.DBR
  133.         where xxxx = as stated by -dumpbase.
  134.  
  135. <ASSEMBLY STAGE> (turning assembler code into object code)
  136. -c -oxxxx    compile into object code onto file xxxx.O, then stop
  137. -c        ditto, where xxxx = source file's name without its suffix
  138.  
  139. <LINKING STAGE> (turning object code files into executable file)
  140. -lxxxx        look in system directories for library xxxx.A
  141. -Lxxxx        also look in directory xxxx for libraries
  142. -nostdlib    do not look in standard system libraries
  143. ----------------------------------------------------------------------
  144. [Effects of -traditional]:-
  145.  
  146. All extern declarations are global even if inside a function.
  147. typeof, inline, signed, const, volatile are not recognized (but asm is).
  148. Pointers can be compared with integers.
  149. unsigned short and unsigned char promote to unsigned int.
  150. Out of range floating point literal is not an error.
  151. Strings are all stored separately and can be written to.
  152. longjmp preserves all auto variables (other than register variables)
  153. Preprocessor converts comments to nothing, not to space.
  154. Looks for macro arguments inside strings in macro definition.
  155. Newline in string (literal newline, not \n) ends the string.
  156. __STDC__ is not predefined.
  157. ----------------------------------------------------------------------
  158. [Features of the new ANSI standard for C]
  159.  
  160. \v in string and char constants means vertical tabulate (ctrl-K)
  161. \a in string and char constants means beep alias bell (ctrl-G)
  162. If you want two question marks together in a string, write them as ?\? to
  163.     avoid confusion with a trigraph, if you compile in trigraph mode.
  164. New standard macros: __DATE__ __TIME__ __FILE__ __LINE__ __STDC__
  165. New declaration qualifiers:-
  166.     const        this variable must not be written to.
  167.     volatile    the system may change this variable without warning.
  168.     signed        opposite to unsigned.
  169.             U or u appended to constants means 'unsigned'.
  170. Other new keywords:-
  171.     enum        e.g. enum color {red,blue,green,yellow} to declare
  172.             an enumerated type like in Pascal.
  173.     void        (1) in function declaration: it returns no type.
  174.             (2) in cast (void)           ignore value.
  175.             (3) in function declaration, e.g. int calc(void);
  176.                 function takes no parameters.
  177.             (4) type void*     general pointer to any value
  178. Old =- etc is no longer an operator, but is treated as = and -
  179. &x is now legal even if x is an array or a function.
  180. Unary + is legal.
  181. Two new operators allowed only in macro definitions:-
  182.     # before use of macro argument    insert stringified copy of call argument
  183.     ##     the matter before and after ## is concatenated
  184. Pointer void* can be cast to any pointer type and vice versa
  185. No implicit conversion between different pointer types; you must use a cast.
  186.   (pointers to functions with different parameter patterns, are different types)
  187. Function pointer can't be converted to or from non-function pointer.
  188. No macro substitution inside strings.
  189. Strings with nothing between but spaces/newlines/comments are concatenated.
  190.   (NB: e.g. "miaow""miaow" means "miaowmiaow"; the internal "" is <not> a quote-
  191.   image as in Algol68; the C 'quote image' is \"   )
  192.   (Hexadecimal characters (e.g. \xff)) don't extend across concatenation.)
  193. Writing to string constants is illegal, unless you use '-traditional'.
  194. Functions should be declared with prototypes.
  195. Function parameters are passed as they are declared.
  196. 'long float' is illegal. Use 'double' instead.
  197. Expression in switch(  ) can be any integral type, not only int.
  198. Structures & unions can be used without restriction as function result types.
  199. Functions can be used as initializers.
  200. Calling a pointer-to-function as if it was a function, is allowed.
  201. (*x) where x is a function, is allowed and means the same as x.
  202. ----------------------------------------------------------------------
  203. [Libraries]
  204.  
  205. <library>    <declares>
  206. <assert.h>    assert(xxxx) /* abort program if condition xxxx is false */
  207. <ctype.h>    char testing and conversion functions.
  208.         isascii(), although this is not now standard C
  209. <errno.h>    error handling functions
  210. <float.h>    information about types float, double, long double
  211. <limits.h>    information about integral types etc
  212. <locale.h>    controlling decimal point character, currency character,
  213.         collation order. (Not yet present.)
  214. <math.h>    mathematical functions that take and return double values.
  215.         You must compile with -lm to get the maths library.
  216. <setjmp.h>    type jmp_buf, macro setjmp, function longjmp.
  217. <signal.h>    macros and types re signal handling.
  218. <stdarg.h>    macros to advance through function parameters. Example of use:-
  219.         void calc(int nargs,...) {
  220.         va_list xx; /* you must declare a local variable of this type */
  221.         va_start(xx,nargs) /* xx now points to parameter nargs */
  222.         va_arg(xx,yyy) /* move xx to point to next parameter, which must
  223.            be of type yyy (where yyy is some type) (or effect
  224.            unpredictable). Returns the value of that parameter. */
  225.         va_end(xx) /* end the parameter lookup tidily */
  226. <stddef.h>    various standard types and macros such as NULL.
  227.         offsetof() /* find offset of a member within its structure */
  228. <stdio.h>    type FILE and many input & output macros & types & functions
  229. <stdlib.h>    miscellaneous, many system-dependent.
  230. <string.h>    string handling and memory accessing functions.
  231. <time.h>    types and functions re the time.
  232. ----------------------------------------------------------------------
  233. [Differences betwen Gnu C and many non-ANSI C's]
  234.  
  235. Most of these differences are removed by compiling with '-traditional'.
  236.  
  237. String constants are read only. Treats identical strings as the same string.
  238.   So, string constant can't be used as argument of mktemp, and of scanf and
  239.   fscanf and sscanf when they use their format argument as scratch paper
  240. Macro arguments are not substituted inside strings.
  241. Automatic allocation of variables to registers. So, setjmp and longjmp may zap
  242.   any auto variable not declared volatile. To stop a variable from being put in
  243.   a register, calculate its address somewhere.
  244. extern declarations within a function only apply within that function.
  245. Unterminated character constants cause fault in text skipped by preprocessor
  246.   conditionals. Always put /* */ around comments!
  247. In functions that return float, the float is not converted to double.
  248. ==== This difference can be removed by compiling with -fpcc-struct-return:-
  249. In functions that return struct or union values:-
  250.   Other C compilers return the address of static storage where the value is.
  251.   if sizeof(value) == 1 or 2 or 4 or 8, Gnu C function returns value as scalar
  252.   else Gnu C function stores value at address supplied by caller of function.
  253. ==== These differences can't be removed:-
  254. 'long', 'short', etc can't be followed by a type name declared by typedef.
  255. A type name declared by typedef can't be used as a function parameter.
  256. Operators += -= *= etc can't have a space inside them.
  257. On the Sparc, struct and union arguments of functions are passed:-
  258.   by other C compilers as their addresses, as if by reference.
  259.   by Gnu C by copying their vales into the parameter list.
  260. ----------------------------------------------------------------------
  261. [Gnu C features not in ANSI]
  262.  
  263. <expression>  ::=  ( { <statements and declarations> } )
  264.     obeys the enclosed compound statement, then keeps the value of its last
  265.     component statement.
  266.     This is not allowed where an expression must be constant.
  267. <declaration>  ::=  typedef <name> = <expression>;
  268.     declares the name as a typename for whatever type the expression is.
  269. <type_definition>  ::=  typeof ( <expression> )
  270.     means whatever type the expression is.
  271. <type_definition>  ::=  typeof ( <type_definition> )
  272.     means the type of the inner type definition. On occasions it can serve
  273.     as an aid to clarity by its bracketing effect.
  274. <lvalue>  ::=  <compound expression>
  275.     if its last component is a lvalue, e.g. (a,b,c) = 4;
  276. <lvalue>  ::=  <conditional expression>
  277.     if all of its alternatives are lvalues. e.g. (a?b:c) = 5;
  278. <lvalue>  ::=  <cast>
  279.     if the expression in the cast is a lvalue. It is obeyed thus:-
  280.     after &, e.g.  & ( int * ) x
  281.         value = address of x, of type int *
  282.     before =, e.g. (int) x = 5.5;
  283.         convert 5.5 to int, then to type of x, then copy it into x
  284.     before += -= *= etc, e.g. (int) x += 5.5;
  285.         convert value of x to int; convert 5.5 to int; obey += with
  286.         those values; convert result to type of x; copy it into x.
  287. <expression>  ::= <expression> ? : <expression>
  288.     e.g.  x ? : z  means  x ? x : z  , except that x is not recalculated.
  289. Declared array with length zero
  290.     useful as last element of struct which is intended as a header for a
  291.     variable-length object set up by e.g. malloc()
  292. Declared array whose bound is not constant
  293.     The array is set up at run time and deleted at block exit.
  294. Function declaration parameter is array whose bound is present & not constant
  295.     Here you tell the system the bounds of the array. As in Fortran, if you
  296.     tell lies about what the bounds are, the effect is unpredictable.
  297. Array value which is not an lvalue, can have subscripts.
  298. sizeof(void) means 1; sizeof(<function type>) means 1
  299. Arithmetic is allowed on void* and pointer to function values.
  300. If <constructable>  ::=  <array type or struct type or union type definition>:-
  301. In   <constructable> <name> = { <list of values> };
  302.     the values can be non-constants if the declaration is auto.
  303. <expression>  ::=  ( ( <constructable> ) { <list of values> } )
  304.     is a 'constructor expression'. A value of the type stated is set up.
  305. volatile  as qualifier for function declaration
  306.     tells the compiler that the function will never return.
  307. const  as qualifier for function declaration
  308.     tells the compiler that the function has no side effects and examines
  309.     nothing except its arguments.
  310. The character '$' can be used in names.
  311. __alignof__( <type> )
  312.     = alignment (recommended or compulsory) of that type
  313. inline  as qualifier for function declaration
  314.     means that that function is copied in in full instead of being called,
  315.     where the source form calls it.
  316. asm(      )
  317.     assembler instructions in C program
  318.  
  319.  
  320.  
  321.