Skip to content

OW2 Compiler Options

ifknot edited this page Nov 23, 2024 · 1 revision

Compiler options - summarized alphabetically

A terse summary is displayed on the screen by simply entering the compiler command name (wcc, wpp, wcc386, or wpp386) with no arguments.

Detailed information C/C++ Compiler Options

See https://github.com/open-watcom/open-watcom-v2#readme for details.

Usage: wcc [options] file [options]
 
Options:
-0              8086 instructions
-1              186 instructions
-2              286 instructions
-3              386 instructions
-4              386 instructions, optimize for 486
-5              386 instructions, optimize for Pentium
-6              386 instructions, optimize for Pentium Pro
-?              print this message
-aa             allow non const initializers for local aggregates or unions
        Make Dependency Information
-ad{[=<file>],bs,d[=<file>],fs,hp[=<file>],t[=<file>]} 
  [=<file>]     - generate make style automatic dependency file
  bs            - force path separators to '\' in auto-depend file
  d[=<file>]    - specify first dependency in make style auto-depend file
  fs            - force path separators to '/' in auto-depend file
  hp[=<file>]   - specify default path for headers without one
  t[=<file>]    - specify target in make style auto-depend file
-ai             turn off type checking on static initialization
-aq             turn off qualifier mismatch warning for const/volatile
-b{c,d,g,m,w}   Application type
  c             - build target is a console application
  d             - build target is a dynamic link library (DLL)
  g             - build target is a GUI application
  m             - build target is a multi-thread environment
  w             - build target is a default windowing application
-bt[=<os>]      build target is operating system <os>
        Debugging Information
-d{0,1,1+,2,2~,3} 
  0             - none
  1             - only line numbers
  1+            - only line numbers
  2             - symbolic information
  2~            - -d2 but without type names
  3             - symbolic information with unreferenced type names
-d<name>[=text] same as #define name [text] before compilation
-d+             allow extended -d macro definitions
-db             generate browsing information
-e[=<num>]      set limit on number of error messages
        Default calling convention
-ec{c,d,f,p,r,s,w} 
  c             - __cdecl
  d             - __stdcall
  f             - __fastcall
  p             - __pascal
  r             - __fortran
  s             - __syscall
  w             - __watcall (default)
-ee             call epilogue hook routine
-ef             use full path names in error messages
-ei             force enum base type to use at least an int
-em             force enum base type to use minimum integral type
-en             emit routine names in the code segment
-ep[=<num>]     call prologue hook routine with <num> stack bytes available
-eq             do not display error messages (but still write to .err file)
-fh[=<file>]    use pre-compiled header (PCH) file
-fhq[=<file>]   do not display pre-compiled header activity warnings
-fi=<file>      force <file> to be included
-fip[=<file>]   automatic inclusion of <file> instead of _preincl.h (default)
-fo[=<file>]    set object file name
-fp{2,3,5,6}    Generate Floating-point code
  2             - 80287 FPU code
  3             - 80387 FPU code
  5             - 80387 FPU code optimize for Pentium
  6             - 80387 FPU code optimize for Pentium Pro
-fpc            calls to floating-point library
-fpd            enable Pentium FDIV bug check
-fpi            inline 80x87 instructions with emulation
-fpi87          inline 80x87 instructions
-fpr            generate backward compatible 80x87 code
-fr[=<file>]    set error file name
-ft             check for truncated versions of file names
-fti            print informational message when opening include file
-fx             do not check for truncated versions of file names
-g=<name>       set code group name
-h{c,d,w}       Debugging Information format
  c             - generate Codeview debugging information
  d             - generate DWARF debugging information
  w             - generate Watcom debugging information
-i=<path>       add directory to list of include directories
-j              change char default from unsigned to signed
-m{c,h,l,m,s}   Memory model
  c             - compact - small code/large data
  h             - huge - large code/huge data
  l             - large - large code/large data
  m             - medium - large code/small data
  s             - small - small code/small data (defaul)
-nc=<name>      set code class name
-nd=<name>      set data segment name
-nm=<file>      set module name
-nt=<name>      set name of text segment
        Optimization
-o{a,b,c,d,e[=<num>],f,f+,h,i,k,l,l+,m,n,o,p,r,s,t,u,x,z} 
  a             - relax aliasing constraints
  b             - enable branch prediction
  c             - disable <call followed by return> to <jump> optimization
  d             - disable all optimizations
  e[=<num>]     - expand user functions inline (<num> controls max size)
  f             - generate traceable stack frames as needed
  f+            - always generate traceable stack frames
  h             - enable expensive optimizations (longer compiles)
  i             - expand intrinsic functions inline
  k             - include prologue/epilogue in flow graph
  l             - enable loop optimizations
  l+            - enable loop unrolling optimizations
  m             - generate inline code for math functions
  n             - allow numerically unstable optimizations
  o             - continue compilation if low on memory
  p             - generate consistent floating-point results
  r             - reorder instructions for best pipeline usage
  s             - favor code size over execution time in optimizations
  t             - favor execution time over code size in optimizations
  u             - all functions must have unique addresses
  x             - equivalent to -obmiler -s
  z             - NULL points to valid memory in the target environment
        Preprocess source file
-p{,c,l,w=<num>} 
                - preprocess source file
  c             - preserve comments
  l             - insert #line directives
  w=<num>       - wrap output lines at <num> columns. Zero means no wrap.
-pil            preprocessor ignores #line directives
-q              operate quietly (display only error messages)
-r              save/restore segment registers across calls
-ri             return chars and shorts as ints
-s              remove stack overflow checks
-sg             generate calls to grow the stack
-st             touch stack through SS first
-u[=<name>]     undefine macro name
-v              output function declarations to .def file
        Warning control
-w{=<num>,cd=<id>,ce=<id>,e,o,x} 
  =<num>        - set warning level number
  cd=<id>       - disable warning message <id>
  ce=<id>       - enable warning message <id>
  e             - treat all warnings as errors
  o             - warn about problems with overlaid code
  x             - set warning level to maximum setting
-x              ignore all ..INCLUDE environment variables
-xx             ignore default directories for file search (.,../h,../c,...)
-zA             disable all extensions (strict ISO/ANSI C)
-za             disable extensions (i.e., accept only ISO/ANSI C)
-zam            disable old non-ISO compliant names (macros, symbols)
-zastd=<std>    use specified ISO/ANSI C language standard (c89,c99)
-zc             place const data into the code segment
-zdf            DS floats (i.e. not fixed to DGROUP)
-zdp            DS is pegged to DGROUP
-ze             enable extensions (i.e., near, far, export, etc.)
-zev            enable arithmetic on void derived types
-zff            FS floats (i.e. not fixed to a segment)
-zfp            FS is pegged to a segment
-zfw            generate FWAIT instructions on 386 and later
-zg             generate function prototypes using base types
-zgf            GS floats (i.e. not fixed to a segment)
-zgp            GS is pegged to a segment
        Multi-byte/Unicode character support
-zk{0,0u,1,2,3,l,u=<num>,u8} 
  0             - Japanese (Kanji, CP 932)
  0u            - translate double-byte Kanji to Unicode
  1             - Chinese/Taiwanese (Traditional, CP 950)
  2             - Korean (Wansung, CP 949)
  3             - Chinese (Simplified, CP 936)
  l             - local installed language
  u=<num>       - load Unicode translate table for specified code page
  u8            - Unicode UTF-8
-zl             remove default library information
-zld            remove file dependency information
-zlf            always generate default library information
-zls            remove automatically inserted symbols
-zm             emit functions in separate segments
-zp=<num>       pack structure members with alignment {1,2,4,8,16}
-zpw            output warning when padding is added in a class
-zq             operate quietly (display only error messages)
-zri            inline floating point rounding calls
-zro            omit floating point rounding calls (non ANSI)
-zs             syntax check only
-zt[=<num>]     far data threshold (i.e., larger objects go in far memory)
-zu             SS != DGROUP (i.e., do not assume stack is in data segment)
-zW             more efficient Microsoft Windows entry sequences
-zw             generate code for Microsoft Windows
-zWs            generate code for Microsoft Windows with smart callbacks
-zws            generate code for Microsoft Windows with smart callbacks

Clone this wiki locally