JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: C User's Guide     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information


1.  Introduction to the C Compiler

2.  C-Compiler Implementation-Specific Information

3.  Parallelizing C Code

4.  lint Source Code Checker

5.  Type-Based Alias Analysis

6.  Transitioning to ISO C

7.  Converting Applications for a 64-Bit Environment

8.  cscope: Interactively Examining a C Program

A.  Compiler Options Grouped by Functionality

B.  C Compiler Options Reference

B.1 Option Syntax

B.2 cc Options

B.2.1 -#

B.2.2 -###

B.2.3 -Aname[(tokens)]

B.2.4 -B[static|dynamic]

B.2.5 -C

B.2.6 -c

B.2.7 -Dname[(arg[,arg])][=expansion]

B.2.8 -d[y|n]

B.2.9 -dalign

B.2.10 -E

B.2.11 -errfmt[=[no%]error]

B.2.12 -errhdr[=h]

B.2.13 -erroff[=t]

B.2.14 -errshort[=i]

B.2.15 -errtags[=a]

B.2.16 -errwarn[=t]

B.2.17 -fast

B.2.18 -fd

B.2.19 -features=[v]

B.2.19.1 --features=typeof Examples

B.2.20 -flags

B.2.21 -flteval[={any|2}]

B.2.22 -fma[={none|fused}]

B.2.23 -fnonstd

B.2.24 -fns[={no|yes}]

B.2.25 -fPIC

B.2.26 -fpic

B.2.27 -fprecision=p

B.2.28 -fround=r

B.2.29 -fsimple[=n]

B.2.30 -fsingle

B.2.31 -fstore

B.2.32 -ftrap=t[,t...]

B.2.33 -G

B.2.34 -g

B.2.35 -g3

B.2.36 -H

B.2.37 -h name

B.2.38 -I[-|dir]

B.2.39 -i

B.2.40 -include filename

B.2.41 -KPIC

B.2.42 -Kpic

B.2.43 -keeptmp

B.2.44 -Ldir

B.2.45 -lname

B.2.46 -library=sunperf

B.2.47 -m32|-m64

B.2.48 -mc

B.2.49 -misalign

B.2.50 -misalign2

B.2.51 -mr[,string]

B.2.52 -mt[={yes|no}]

B.2.53 -native

B.2.54 -nofstore

B.2.55 -O

B.2.56 -o filename

B.2.57 -P

B.2.58 -p

B.2.59 -Qoption phase option[,option..]

B.2.60 -Q[y|n]

B.2.61 -qp

B.2.62 -Rdir[:dir]

B.2.63 -S

B.2.64 -s

B.2.65 -traceback[={%none|common|signals_list}]

B.2.66 -Uname

B.2.67 -V

B.2.68 -v

B.2.69 -Wc,arg

B.2.70 -w

B.2.71 -X[c|a|t|s]

B.2.72 -x386

B.2.73 -x486

B.2.74 -Xlinker arg

B.2.75 -xaddr32[=yes|no]

B.2.76 -xalias_level[=l]

B.2.77 -xanalyze={code|no}

B.2.78 -xannotate[=yes|no]

B.2.79 -xarch=isa

B.2.79.1 -xarch Flags for SPARC and x86

B.2.79.2 -xarch Flags for SPARC

B.2.79.3 -xarch Flags for x86

B.2.79.4 Interactions

B.2.79.5 Warnings

B.2.80 -xautopar

B.2.81 -xbinopt={prepare|off}

B.2.82 -xbuiltin[=(%all|%default|%none)]

B.2.83 -xCC

B.2.84 -xc99[=o]

B.2.85 -xcache[=c]

B.2.86 -xcg[89|92]

B.2.87 -xchar[=o]

B.2.88 -xchar_byte_order[=o]

B.2.89 -xcheck[=o]

B.2.89.1 Initialization Values for -xcheck=init_local

Basic Types

Initializing Structs, Unions, and Arrays

B.2.90 -xchip[=c]

B.2.91 -xcode[=v]

B.2.92 -xcrossfile

B.2.93 -xcsi

B.2.94 -xdebugformat=[stabs|dwarf]

B.2.95 -xdepend=[yes|no]

B.2.96 -xdryrun

B.2.97 -xdumpmacros[=value[,value...]]

B.2.98 -xe

B.2.99 -xF[=v[,v...]]

B.2.99.1 Values

B.2.100 -xhelp=flags

B.2.101 -xhwcprof

B.2.102 -xinline=list

B.2.103 -xinstrument=[no%]datarace

B.2.104 -xipo[=a]

B.2.104.1 -xipo Examples

B.2.104.2 When Not To Use -xipo=2 Interprocedural Analysis

B.2.105 -xipo_archive=[a]

B.2.106 -xivdep[=p]

B.2.107 -xjobs=n

B.2.108 -xkeepframe[=[%all,%none,name,no%name]]

B.2.109 -xldscope={v}

B.2.110 -xlibmieee

B.2.111 -xlibmil

B.2.112 -xlibmopt

B.2.113 -xlic_lib=sunperf

B.2.114 -xlicinfo

B.2.115 -xlinkopt[=level]

B.2.116 -xloopinfo

B.2.117 -xM

B.2.118 -xM1

B.2.119 -xMD

B.2.120 -xMF filename

B.2.121 -xMMD

B.2.122 -xMerge

B.2.123 -xmaxopt[=v]

B.2.124 -xmemalign=ab

B.2.125 -xmodel=[a]

B.2.126 -xnolib

B.2.127 -xnolibmil

B.2.128 -xnolibmopt

B.2.129 -xnorunpath

B.2.130 -xO[1|2|3|4|5]

B.2.130.1 SPARC Optimizations

B.2.130.2 x86 Optimization Levels

B.2.131 -xopenmp[=i]

B.2.132 -xP

B.2.133 -xpagesize=n

B.2.134 -xpagesize_heap=n

B.2.135 -xpagesize_stack=n

B.2.136 -xpch=v

B.2.136.1 Creating a Precompiled-Header File Automatically

B.2.136.2 Creating a Precompiled-Header File Manually

B.2.136.3 How the Compiler Handles an Existing Precompiled-Header File

B.2.136.4 Directing the Compiler to Use a Specific Precompiled-Header File

B.2.136.5 The Viable Prefix

B.2.136.6 Screening a Header File for Problems

B.2.136.7 Precompiled-Header File Cache

B.2.136.8 Caveats

B.2.136.9 Precompiled-Header File Dependencies and make Files

B.2.137 -xpchstop=[file|<include>]

B.2.138 -xpec[={yes|no}]

B.2.139 -xpentium

B.2.140 -xpg

B.2.141 -xprefetch[=val[,val]]

B.2.141.1 Prefetch Latency Ratio

B.2.142 -xprefetch_auto_type=a

B.2.143 -xprefetch_level=l

B.2.144 -xprofile=p

B.2.145 -xprofile_ircache[=path]

B.2.146 -xprofile_pathmap

B.2.147 -xreduction

B.2.148 -xregs=r[,r...]

B.2.149 -xrestrict[=f]

B.2.150 -xs

B.2.151 -xsafe=mem

B.2.152 -xsfpconst

B.2.153 -xspace

B.2.154 -xstrconst

B.2.155 -xtarget=t

B.2.155.1 -xtarget Values on SPARC Platforms

B.2.155.2 -xtarget Values on x86 Platforms

B.2.156 -xtemp=dir

B.2.157 -xthreadvar[=o]

B.2.158 -xtime

B.2.159 -xtransition

B.2.160 -xtrigraphs[={yes|no}]

B.2.161 -xunroll=n

B.2.162 -xustr={ascii_utf16_ushort|no}

B.2.163 -xvector[=a]

B.2.164 -xvis

B.2.165 -xvpara

B.2.166 -Yc, dir

B.2.167 -YA, dir

B.2.168 -YI, dir

B.2.169 -YP, dir

B.2.170 -YS, dir

B.2.171 -Zll

B.3 Options Passed to the Linker

B.4 User-Supplied Default Options File

C.  Implementation-Defined ISO/IEC C99 Behavior

D.  Features of C99

E.  Implementation-Defined ISO/IEC C90 Behavior

F.  ISO C Data Representations

G.  Performance Tuning

H.  Oracle Solaris Studio C: Differences Between K&R C and ISO C


B.4 User-Supplied Default Options File

The default compiler options file enables the user to specify a set of default options that are applied to all compiles, unless otherwise overridden. For example, the file could specify that all compiles default at —xO2, or automatically include the file

At startup, the compiler searches for a default options file listing default options it should include for all compiles. The environment variable SPRO_DEFAULTS_PATH specifies a colon separated list of directories to search for the the defaults file.

If the environment variable is not set, a standard set of defaults is used. If the environment variable is set but is empty, no defaults are used.

The defaults file name must be of the form compiler.defaults, where compiler is one of the following: cc, c89, c99, CC, ftn, or lint. For example, the defaults for the C compiler would be cc.defaults

If a defaults file for the compiler is found in the directories listed in SPRO_DEFAULTS_PATH, the compiler will read the file and process the options prior to processing the options on the command line. The first defaults file found will be used and the search terminated.

System administrators may create system-wide default files in Studio-install-path/prod/etc/config. If the environment variable is set, the installed defaults file will not be read.

The format of a defaults file is similar to the command line. Each line of the file may contain one or more compiler options separated by white space. Shell expansions, such as wild cards and substitutions, will not be applied to the options in the defaults file.

The value of the SPRO_DEFAULTS_PATH and the fully expanded command line will be displayed in the verbose output produced by options —#, —###, and —dryrun.

Options specified by the user on the command line will usually override options read from the defaults file. For example, if the defaults file specifies compiling with —xO4 and the user specifies —xO2 on the command line, —xO2 will be used.

Some options appearing in the default options file will be appended after the options specified on the command line. These are the preprocessor option —I, linker options —B, —L, —R, and —l, and all file arguments, such as source files, object files, archives, and shared objects.

The following is an example of how a user-supplied default compiler option startup file might be used.

demo% cat /project/defaults/cc.defaults
-I/project/src/hdrs —L/project/libs —llibproj —xvpara
demo% setenv SPRO_DEFAULTS_PATH /project/defaults
demo% cc —c —I/local/hdrs —L/local/libs —lliblocal tst.c

This command is now equivalent to:

cc -fast —xvpara —c —I/local/hdrs —L/local/libs —lliblocal tst.c \ 
     —I/project/src/hdrs —L/project/libs —llibproj

While the compiler defaults file provides a convenient way to set the defaults for an entire project, it can become the cause of hard to diagnose problems. Set the environment variable SPRO_DEFAULTS_PATH to an absolute path rather than the current directory to avoid such problems.

The interface stability of the default options file is uncommitted. The order of option processing is subject to change in a future release.