|
This document allows you to compare the features added to the Sun C
compiler
for the following compiler and tools releases:
- Sun Studio 12 (SS12): C compiler version 5.9 released June 2007
- Sun Studio 11 (SS11): C compiler version 5.8 released November 2005
- Sun Studio 10 (SS10): C compiler version 5.7 released January 2005
- Sun Studio 9 (SS9): C compiler version 5.6 released July 2004
- Sun ONE Studio 8 (S1S8): C compiler version 5.5 released May 2003
- Forte Developer 6 update 2 (FD6u2): C compiler version 5.3 released
July 2001
- Forte Developer 6 (FD6): C compiler version 5.1 released May 2000
|
Release |
| Feature |
|
|
|
|
|
|
|
Linux support - Sun Studio Compilers available on Linux x86 platforms
|
|
|
|
|
|
|
X |
-m32 and -m64 options to specify 32-bit or 64-bit memory model
|
|
|
|
|
|
|
X |
-D option accepts macros with arguments
|
|
|
|
|
|
|
X |
-errhdr option limits warnings from header files
|
|
|
|
|
|
|
X |
-xnorunpath option
|
|
|
|
|
|
|
X |
-xMMD, -xMD, -xMF options
|
|
|
|
|
|
|
X |
Support for the #include_next directive
|
|
|
|
|
|
|
X |
Support for aligned and visibility attributes
|
|
|
|
|
|
|
X |
| Additions to the __attributes__ clause: always_inline, noinline, pure, const,
malloc, and aligned |
|
|
|
|
|
|
X |
Support for value-returning blocks
|
|
|
|
|
|
|
X |
Support for typeof and __alignof__ operators
|
|
|
|
|
|
|
X |
Support for zero-length arrays
|
|
|
|
|
|
|
X |
Support for local labels
|
|
|
|
|
|
|
X |
-xarch=sse3 and -xarch=sse3a options on x86 platforms
|
|
|
|
|
|
|
X |
-fast includes -xregs=frameptr on x86 platforms
|
|
|
|
|
|
|
X |
New SPARC platform support: -xtarget=sparc64vi, -xtarget=ultraT2 and -xarch=sparcfmaf
|
|
|
|
|
|
|
X |
-xinstrument=datarace enables thread analysis
|
|
|
|
|
|
|
X |
-fma=fused enables fused multiply-add instructions on SPARC
|
|
|
|
|
|
|
X |
| New -xarch Flags for x64 Development
|
|
|
|
|
|
X | X |
| A New -xmodel Option To Specify
x64 Memory Models |
|
|
|
|
|
X | X |
| Support For SSE/SSE2 Integral Media
Intrinsics |
|
|
|
|
|
X | X |
| New -xvector Flags for x64
SSE2 Platforms |
|
|
|
|
|
X | X |
| Support For x86 -xpagesize
Options |
|
|
|
|
|
X | X |
| Binary Optimizer for SPARC |
|
|
|
|
|
X | X |
| New UltraSPARC IIIiplus,
UltraSPARC T1, and UltraSPARC IVplus processors |
|
|
|
|
|
X | X |
| A New Default Format For Debugger
Information |
|
|
|
|
|
X | X |
| Enhancements to the STACKSIZE Environment
Variable |
|
|
|
|
|
X | X |
| OpenMP Autoscoping |
|
|
|
|
|
X | X |
| New Pragmas |
|
|
|
|
|
X | X |
| New -xarch option, -xarch=amd64,
specifies
compilation for the 64-bit AMD instruction set. |
|
|
|
|
X |
X | X |
| A new -xtarget option,
-xtarget=opteron,
specifies settings for 32-bit AMD compilation. |
|
|
|
|
X |
X | X |
| -xarch=generic now supports both x86 and
SPARC platforms |
|
|
|
|
X |
X | X |
| A new x86-only flag for the -xregs option,
-xregs=[no%]frameptr |
|
|
|
|
X |
X | X |
| Improved performance through new defaults for the
-xarch, -xcode,
-xmemalign, and
-xprefetch options and through new
expansions
for the -fast and -O
options. |
|
|
|
X |
X |
X | X |
| New -xarch,
-xtarget, and -xchip flags for
the x86 architecture. |
|
|
|
X |
X |
X | X |
| Improved runtime performance through the
-xlibmopt, -xnolibmopt,
-xipo_archive, and
-xprefetch_auto_type options. |
|
|
|
X |
X |
X | X |
| Improved compile-time performance through
automatically-generated precompiled-headers with
-xpch. |
|
|
|
X |
X |
X | X |
| Expanded SPARC support with new
-xchip and -xtarget
flags.
|
|
|
|
X |
X |
X | X |
| Full support on Solaris 10 for 1999 C ISO features including
extern inline functions, designated
initializers,
and universal character names. |
|
|
|
X |
X |
X | X |
Linker Mapfiles No Longer Needed for
Variable Scoping:
-xldscope
|
|
|
X |
X |
X |
X | X |
| Implementation of Additional C99
Features |
|
|
X |
X |
X |
X | X |
Precompiled Headers, -xpch
|
|
|
X |
X |
X |
X | X |
Using Multiple Processors With
-xjobs=n
(SPARC)
|
|
|
X |
X |
X |
X | X |
Improving Run-Time With Linker Supported
Thread-Local
Storage of Data: -xthreadvar (SPARC)
|
|
|
X |
X |
X |
X | X |
| Dwarf-Format Debugger-Information With
-xdebugformat |
|
|
X |
X |
X |
X | X |
| Interprocedural Optimization
(-xipo) (SPARC) |
|
X |
X |
X |
X |
X | X |
| OpenMP Support (SPARC) |
|
X |
X |
X |
X |
X | X |
| Lint support for type-based
alias-analysis |
|
X |
X |
X |
X |
X | X |
| Code Set Independence Via
-xcsi |
|
X |
X |
X |
X |
X | X |
| Partial Support for C99 Standard |
|
X |
X |
X |
X |
X | X |
| Lint Support for Implemented C99
SS8_features |
|
X |
X |
X |
X |
X | X |
| C compiler now predefines a static, constant, char
array named __func__ for every function definition. |
X |
X |
X |
X |
X |
X | X |
| Support for larger array objects |
X |
X |
X |
X |
X |
X | X |
| New lint directive
(PRINTFLIKE(n)) |
X |
X |
X |
X |
X |
X | X |
| New -xmemalign option |
X |
X |
X |
X |
X |
X | X |
| New -xprefetch option |
X |
X |
X |
X |
X |
X | X |
| New -xvector option |
X |
X |
X |
X |
X |
X | X |
Sun Studio 12 C New Features
This section describes new and changed features for this release of
the C compiler 5.9. For additional information regarding new features in other
Sun Studio 12 components, see the SDN Sun Studio portal at
http://developers.sun.com/sunstudio/documentation/index.jsp.
A New Way To Specify 32-bit or 64-bit Address Model
You no longer need use the -xarch option to specify a 32-bit or
64-bit address model (LP64 versus ILP32). Two new options make it easier:
- -m32 specifies the ILP32 model: 32-bit ints, longs, and pointer types.
- -m64 specifies the LP64 model: 32-bit ints, 64-bit longs and pointers types.
(Note that -m64 is the default on 64-bit Linux platforms.)
Deprecated -xarch Flags and Their Replacements Across SPARC and x86
If you are using -xarch=v9 or -xarch=amd64 to specify a
64-bit address model, use just -m64 instead. No -xarch value is
required.
- Use -m64 in place of -xarch=generic64
- Use -m64 -xarch=native in place of -xarch=native64
Deprecated -xarch Flags and Their Replacements on SPARC Only
- Use -xarch=sparc in place -xarch=v8plus
- Use -xarch=sparcvis in place of -xarch=v8plusa
- Use -xarch=sparcvis2 in place of -xarch=v8plusb
- Use -xarch=sparc -m64 in place of -xarch=v9
- Use -xarch=sparcvis -m64 in place of -xarch=v9a
- Use -xarch=sparcvis2 -m64 in place of -xarch=v9b
Deprecated -xarch Flags and Their Replacements on x86 Only
- Use -xarch=sse2 -m64 in place of -xarch=amd64.
- Use -xarch=sse2a -m64 in place of -xarch=amd64a.
Disallowed Combinations and Warnings
The compilers do not allow the combination of a deprecated -xarch
value and the new -m32, -m64 options on the command line. For example,
specifying -xarch=v9 -m32 is now a fatal error. Specifying
-xarch=sparc -xarch=v9 is also a fatal error.
Some older -xarch values do not have 64-bit counterparts. You cannot
combine the following -xarch options with -m64 on the
command line"
- SPARC platforms: -xarch=v7, -xarch=v8, -xarch=v8a
- x86 platforms: -xarch=386, -xarch=pentium_pro, -xarch=pentium_proa, -xarch=sse,
-xarch=ssea
If you specify a 32-bit -xarch value followed by -m64, the
compiler does not issue a warning. For example -m64 -fast or
-fast -m64 are allowed. However, if you specify a 64-bit -xarch
value followed by -m32, the compiler issues a warning that -m32
overrides the -xarch value. This situation does not occur using macro
options, only when an -xarch option has been explicitly specified.
New C Compiler Options and Features
In addition to the new options and features detailed in the rest of this readme,
the following new C compiler options are supported in this release:
- Expanded -D to accept marcos with arguments.
- A new -errhdr option which limits warnings from header files to a
specified group.
- A new -xnorunpath option prevents the compiler from building a
runtime search path for shared libraries into the executable.
- A new -xMMD option generates makefile dependencies excluding system
headers. This is the same functionality as with -xM1, but includes
compilation.
- A new -xMD option generates makefile dependencies. This is the same
functionality as with -xM, but includes compilation.
- A new -xMF filename options allows you to specify a filename
for makefile-dependency output.
The -xM, -xM1, -xMD, and -xMMD options are
mutually exclusive, and only one can be in effect. When you specify -xMD
or -xMMD, but do not specify -xMF, the compiler generates an
output file for makefile-dependency output whose default filename is derived from
the input filename but with the addition of a .d suffix. The -xM and -xM1 options behave as usual when you do not
specify -xMF. If you do specify -xMF, all makefile-dependency
output is appended to the specified file. There is no way to specify individual
filenames for multiple input files with -xMF on one command line. - Support for the #include_next directive
The C compiler now supports the #include_next directive. The
directive does not distinguish between <filename> and
"filename" inclusion, nor does it check that the file you
specify has the same name as the current file. The compiler looks for the
specified file starting with the directory in the search path after the one where
the current file which contains the #include_next directive.
- Additions to the __attributes__ clause
The always_inline, noinline, pure, const,
malloc, and aligned attributes are now supported by the
__attributes__ clause. - Support for the aligned attribute
int __attribute__ ((aligned (16))) i = 0;
- Support for the visibility attribute
The visibility attribute has been mapped to the linker
scoping specifiers of the Sun Studio C compiler as follows:
The symbol has global linker scoping and is the least
restrictive linker scoping. All references to the symbol bind to the
definition in the first dynamic module that defines the symbol. This
linker scoping is the current linker scoping for extern symbols.
int __attribute__ ((visibility ("default"))) v5 = 0; int __global v6 = 0;
The symbol has symbolic linker scoping and is more restrictive than
global linker scoping. All references to the symbol from within the
dynamic module being linked bind to the symbol defined within the
module. Outside of the module, the symbol appears as though it were
global.
int __attribute__ ((visibility ("protected"))) v1 = 0; int __symbolic v2 = 0;
The symbol has hidden linker scoping. Hidden linker scoping is more
restrictive than symbolic and global linker scoping. All references
within a dynamic module bind to a definition within that module. The
symbol will not be visible outside of the module.
int __attribute__ ((visibility ("internal"))) v3 = 0; int __attribute__ ((visibility ("hidden"))) v4 = 0; int __hidden l = 0;
- Support for value-returning blocks
#define maxint(a,b) \ ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
- Support for the typeof operator
#define max(a,b) \ ({ __typeof__ (a) _a = (a); \ __typeof__ (b) _b = (b); \ _a > _b ? _a : _b; })
- Support for zero-length arrays
struct foo { int a; int flexarray [0]; int b; int c; };
- Support for the __alignof__ operator
The __alignof__ operator returns the alignment associated with a given type or expression. Its syntax is the same as the syntax of the sizeof operator. The following examples demonstrate how to call __alignof__ and supply an argument:
__alignof__(float) /* return 4 __alignof__(double) /* returns 8
char foo; __alignof__(foo) /* returns 1 __alignof__(1+1) /* returns 4 (default integer alignment)
It's an error to ask for the alignment of an incomplete type or of a bit-field.
- Support for local labels
The following search-macro example demonstrates a typical use of
local labels. The example incorporates statement expressions and the
typeof operator. A search for an element of a one dimensional array
could be written as follows:
#define SEARCH(array, value,max) \ ({ \ __label__ found_it; \ typeof (value) _value =(value); \ typeof (*(array)) *_array = (array); \ typeof (max) _max = (max); \ typeof (max) i, index; \ \ for (i =0; i < max; i++) \ if (_array[i] == _value) \ { \ index= i; \ goto found_it; \ } index = -1; \ found_it: \ index; \ })
Note the use of the local label
"found_it". Without the ability to declare a local label
(through the __label__ declaration), multiple uses of the macro would
result in multiple definitions for "found_it". Note also
that local labels can be used in any block, not just within statement
expression blocks.
- Support for GNU-style inline assembly and support for long-long bitfields.
New x86 Features and Updates
The following are new x86 flags for the -xarch option:
- -xarch=sse3 specifies that the compiler should generate instructions
based on both the SSE3 and SSE2 architectures.
- -xarch=sse3a specifies that the compiler should generate instructions
based on the SSE3, SSE2 and AMD extended architectures as well as the 3DNow extensions.
Changes to -fast
The -fast option on x86 now includes -xregs=frameptr, which
means that the compiler can use the frame-pointer register (%ebp on IA32,
%rbp on AMD64) as a general purpose register to generate code for all
the compilation units. Consequently frame pointers will not be generated in each
function or routine.
However, if you want to override this new behavior, specify
-xregs=no%frameptr after -fast in the compilation command and
the frame-pointer register will not be used as a general purpose register. The
following example demonstrates how to override the -fast default for
-xregs:
cc -fast -xregs=no%frameptr foo.c
Static data-race and deadlock-detection with lock_lint
The C compiler option -Zll creates database files (.ll) for use by
the lock_lint utility. See lock_lint(1). The -Zll
option and the lock_lint utility are now available on x86.
New SPARC Features and Updates
This release of the Sun Studio compilers includes support for the SPARC64 VI
and UltraSPARC T2 processors. Use the following new options to specify these
processors:
- -xtarget=sparc64vi
- -xtarget=ultraT2
You can also specify the following -xchip options to generate code
for these processors without setting the -xarch value automatically as
happens when you use -xtarget:
- -xchip=sparc64vi
- -xchip=ultraT2
You can also specify the -xarch values explicitly:
- -xarch=[v8plusc|v9c] for the SPARC64 VI fused
multiply-add instructions set architecture
- -xarch=[v8plusv|v9v] for privileged and
hyper-privileged code
New Math and Visual Instruction Set Support in SPARC64 VI
Specify the following new option if you want to use instructions
from the SPARC-V9 instruction set including the UltraSPARC
extensions, the Visual Instruction Set (VIS) version 1.0, the
UltraSPARC-III extensions, the Visual Instruction Set (VIS) version
2.0, and the SPARC64 VI extensions for floating-point multiply-add:
You must also specify -m32 or -m64 when you specify
-xarch=sparcfmaf to get 32-bit code or 64-bit code respectively. When
you specify -xarch=sparcfmaf, the compiler predefines the following
new values:
- -D__FP_FAST_FMA__
- -D__FP_FAST_FMAF__
Note: You must use -xarch=sparcfmaf in conjunction with the
new -fma=fused option detailed below and some optimization level in
order for the compiler to find opportunities to use the multiply-add instructions
automatically.
New Option for Floating-Point, Fused or Multiply-Add Instructions
Specify the following new option to enable or disable the
automatic generation of floating-point, fused, multiply-add
instructions:
The none value indicates that the compiler should not generate any
floating-point, fused, or multiply-add instructions. The fused value
allows the compiler to attempt to find opportunities to improve the
performance of the code by using floating-point, fused, or
multiply-add instructions.
Linux Support
This release of the Sun Studio compilers supports the Linux OS as follows.
- SuSE Linux Enterprise Server 9 with Service Pack 3 (or later)
- Red Hat Enterprise Linux 4
- Other Linux distributions based on the 2.6 kernel though these are not
officially supported
See the release notes for processor and distribution version requirements.
The New Thread Analyzer
The following new compiler option causes the compiler to
instrument your multi-threaded application for analysis by the new
Thread Analyzer.
The default is -xinstrument=no%datarace. See tha(1) and
the Thread Analyzer User's Guide. The user's guide includes two tutorials,
a FAQ and lists of supported APIs.
This section describes the new and changed features for the Sun
Studio 11 C 5.8 compiler. For details on any of the compiler options,
see the C User's Guide and the cc(1) man page.
- New -xarch Flags For x64 Development
The -xarch option now supports the following new flags
for development on the 64-bit x86 platform: amd64a,
pentium_proa, ssea, sse2a. See the
description of -xarch in the Sun Studio 11 cc(1) man page
for more information.
- Support For x86 -xpagesize
Options
The -xpagesize, -xpagesize_heap,
-xpagesize_stack
options are now enabled for x86 platforms as well as SPARC.
- A New -xmodel Option To Specify x64 Memory
Models
The new -xmodel option lets you specify the kernel, small, or
medium memory models on the 64-bit AMD architecture. If the size of your
global and static variables exceeds two gigabytes, specify
-xmodel=medium. Otherwise, use the default -xmodel=small
setting.
- Support For SSE/SSE2 Integral Media
Intrinsics
This release supports intrinsic functions for SSE2
128-bit XMM register integral media-instructions.
Include the sunmedia_intrin.h header file in the source
code and specify the -xbuiltin option to take advantage of these
functions. Furthermore, these intrinsic functions require SSE2
support so specify options such as -xarch=sse2,
-xarch=amd64, or -xtarget=opteron.
Essentially, the compiler generates inline code for these
instrinsic functions. This is easier than manipulating the
instructions through assembly language and it can be optimized
by the compiler. For more information about intrinsics,
explanations for the function prototypes contained in the header
files, and the data types used by these functions, see the
Intel C++ Intrinsics Reference section of the
Intel(R) C++ Compiler for Linux Systems manual.
- New -xvector Flags for x64
SSE2 Platforms
The -xvector option enables automatic generation of
calls to the vector library functions and/or the generation of
the SIMD (Single Instruction Multiple Data) instructions.
- Binary Optimizer for SPARC
A new -xbinopt option allows the compiler to prepare
the binary file for further optimization by the binopt(1)
binary optimizer.
- New SPARC -xtarget and
-xchip
Values
The new -xtarget flags ultra3iplus,
ultra4plus,
and ultraT1 along with the new -xchip flags
ultra3iplus, ultra4plus, and ultraT1 provide
code generation for the UltraSPARC IIIiplus, UltraSPARC T1, and UltraSPARC
IVplus processors.
- A New Default Format For Debugger
Information
The C compiler now generates debugger information in
the dwarf format by default. This change should be
transparent, as the dbx and Performance Analyzer
readily accept and prefer the dwarf format. You can
generate debugger information in the stabs format by
specifying -xdebugformat=stabs.
- Enhancements to the STACKSIZE Environment
Variable
The syntax of the STACKSIZE environment variable has
been enhanced to accept a units keyword for denoting
the slave thread stacksize: B for Bytes, K for Kilobytes,
M for Megabytes, G for Gigabytes.
For example, setenv STACKSIZE 8192 sets the slave
thread stack size to 8 MB. 1235B sets the slave thread
stack size for 1235 Bytes. 1235G sets it for 1235
Gigabytes. The default for an integer value without a
suffix letter is still Kilobytes.
- OpenMP Autoscoping
Autoscoping is now available for C programs. This
feature is described in chapter 3 of the Sun Studio 11
OpenMP API User's Guide.
- New Pragmas
There are two new pragmas in this release of the C
compiler:
- # pragma c99
- # pragma
[no_]warn_missing_parameter_info
Use the c99 (implicit | no%implicit) pragma
to find implicit function declarations. Use the
[no_]warn_missing_parameter_info pragma to find function
declarations
which contain no parameter-type information. See the C User's
Guide for
detailed descriptions of these new pragmas.
This section describes the new and changed features for the
Sun Studio 10 C 5.7 compiler.
This release supports the compilation of 64-bit code
for Solaris x86
platforms. The following is a brief summary of the new option flags.
See the
cc(1) man page for complete descriptions of -xarch and
-xtarget options.
A new -xarch option, -xarch=amd64, specifies
compilation for the 64-bit AMD instruction set.
A new -xtarget option,
-xtarget=opteron, specifies the
-xarch, -xchip, and -xcache settings for
32-bit AMD
compilation.
You must specify -xarch=amd64 to the right of
-fast
and -xtarget on the command line to generate 64-bit code. The new
-xtarget=opteron option does not automatically generate 64-bit
code. It
expands to -xarch=sse2, -xchip=opteron, and
-xcache=64/64/2:1024/64/16 which results in 32-bit code. The
-fast
option also results in 32-bit code because it is a macro which also defines
-xtarget=native. All the current -xtarget values, with
the exception
of -xtarget=native64 and -xtarget=generic64, result in
32-bit code.
You must specify -xarch=amd64 after (to the right of)
-fast or
-xtarget to compile 64-bit code, as in:
cc -fast -xarch=amd64
or
cc -xtarget=opteron -xarch=amd64
The existing -xarch=generic64 option
now supports
the x86 platform in addition to the traditional SPARC platform.
The C compiler now predefines __amd64 and
__x86_64 when you
specify -xarch=amd64.
A new x86-only flag for the -xregs
option,
-xregs=[no%]frameptr, lets you use the frame-pointer register
as an
unallocated callee-saves register to increase the run-time performance of
applications. See the cc.1 man page for full details.
Sun Studio 10 C 5.7 Changed Features
-xopenmp=stubs
This option is no longer supported. An OpenMP stubs library is provided for
users' convenvience. To compile an OpenMP program that calls OpenMP library
functions but ignores the OpenMP pragmas, compile the program without an
-xopenmp option, and link the object files with the
libompstubs.a library. For example,
% cc omp_ignore.c -lompstubs
Linking with both libompstubs.a and the OpenMP
runtime library libmtsk.so is unsupported and
may result in unexpected behavior.
This section describes the new and changed features for
the C compiler. For information about other Sun Studio 9
components, see the What's New manual. To access this manual,
go to http://docs.sun.com.
- Improved performance through new defaults for the
-xarch, -xcode,
-xmemalign, and
-xprefetch options and through new
expansions
for the -fast and -O
options.
- New -xarch,
-xtarget, and -xchip, flags as
well as the new -flteval option for
the Intel architecture.
- Improved runtime performance through the
-xlibmopt, -xnolibmopt,
-xipo_archive, and
-xprefetch_auto_type options.
- Improved compile-time performance through
automatically-generated precompiled-headers with
-xpch.
- Expanded SPARC support with new
-xchip and -xtarget
flags.
- Full support on Solaris 10 for 1999 C ISO features including
extern inline functions, designated
initializers,
and universal character names.
- New security checks through the lint
utility.
The New -xarch Default: v8plus
The default architecture for which the C compiler produces code is
now v8plus (UltraSPARC). Support for v7 will be dropped in a future
release.
The new default yields higher run-time performance for
nearly all machines in current use. However, applications that are
intended for deployment on pre-UltraSPARC computers no longer execute
by default on those computers. Compile with -xarch=v8 to ensure
that the applications execute on those computers.
If you want to deploy on v8 systems, you must specify the option
-xarch=v8 explicitly on every compiler command line as well as any
link-time commands. The provided system libraries run on v8 architectures.
If you want to deploy on v7 systems, you must specify the option
-xarch=v7 explicitly on every compiler command line as well as any
link-time commands. The provided system libraries use the v8 instruction
set. For the Sun Studio 9 release, the only supported operating system for
v7 is the Solaris 8 release. When a v8 instruction is encountered, the
Solaris 8 operating system interprets the instruction in software. The
program runs, but performance is degraded.
For x86, -xarch defaults to generic. Note that
-fast
on x86 expands to -xarch=native.
For more information on -xarch, see the C man page
cc(1).
The New -xcode Default
(SPARC) The default on V9 is -xcode=abs44. The default on V8 is
still -xcode=abs32.
For more information on -xcode, see the C man page
cc(1)
.
The New -xmemalign Default
(SPARC) The default of -xmemalign is -xmemalign=8i
for all
v8 architectures. The default for all v9 architectures is
-xmemalign=8s
.
For more information on -xmemalign, see the C man page
cc(1)
.
The New -xprefetch Default
(SPARC) The default of -xprefetch is now
-xprefetch=auto,explicit. This change adversely affects
applications
that have essentially non-linear memory access patterns. To disable the
change,
specify -xprefetch=no%auto,no%explicit.
For more information on -xprefetch, see the C man page
cc(1)
.
The New -fast Expansion
The -fast option now includes the new option
-xlibmopt in its expansion.
The New -O Expansion
(SPARC and x86) The -O macro now expands to -xO3
instead
of -xO2.
The change in default yields higher run-time performance. However,
-x03 may be inappropriate for programs that rely on all
variables being automatically considered volatile. Typical programs that
might have this assumption are device drivers and older multi-threaded
applications that implement their own synchronization primitives.
The work around is to compile with -xO2 instead of -O.
For more information on -O, see the C man page cc(1)
.
New -xarch, -xtarget, and
-xchip Flags for the Intel Architecture.
The C compiler supports new flags for -xarch,
-xtarget,
and -xchip on Intel. These new flags are designed to take
advantage of
Pentium 3 and Pentium 4 chips in combination with Solaris software support
for sse and sse2 instructions on the Intel platform.
Here are
the new flags:
You can determine which combination of the new -xarch,
-xchip,
and -xtarget flags is appropriate for your needs by following
these
guidelines:
For more information on -xarch, -xtarget, and
-xchip, see the C man page cc(1).
The New -xlibmopt and -xnolibmopt
Options
The -xlibmopt option enables the compiler to use a library of
optimized math routines. You must use default rounding mode by specifying
-fround=nearest when you specify this option. The math routine
library
is optimized for performance and usually generates faster code. The
results may
be slightly different from those produced by the normal math library. If
so,
they usually differ in the last bit.
You can explicitly turn off this library by specifying the new
-xnolibmopt option on the command line.
For more information on -xlibmopt, and -xnolibmopt,
see the
C man page cc(1).
The New -xipo_archive Option
Use the new -xipo_archive option to enable the compiler to
optimize object files that are passed to the linker with object files that
were compiled with -xipo and that reside in the archive library
(.a) before producing an executable. Any object files contained in the
library that were optimized during the compilation are replaced with their
optimized version.
For more information on the -xipo_archive option, see the
cc(1) man page.
The New -xprefetch_auto_type Option
Use the new -xprefetch_auto_type option to generate indirect
prefetches for the loops indicated by the option
-xprefetch_level=[1|2|3]
in the same fashion that the prefetches for direct memory accesses
are
generated.
Options such as -xdepend, -xrestrict, and
-xalias_level can improve the optimization benefits of
-xprefetch_auto_type. They affect the aggressiveness of
computing the
indirect prefetch candidates and therefore the aggressiveness of the
automatic
indirect prefetch insertion because they help produce better memory alias
disambiguation information.
For more information on the -xprefetch_auto_type option, see the
cc(1) man page.
Automatically Generated Precompiled Headers With
-xpch
This release of the C compiler expands the precompiled header facility to
include an automatic capability on the part of the compiler to generate the
precompiled header file. You still have the option to manually generate the
precompiled header file, but if you are interested in the new capability
of the
compiler, see the explanation for the -xpch option in the
cc(1) man page for more information. See also the
CCadmin(1)
man page.
Expanded SPARC Support With New
-xchip and -xtarget Flags.
(SPARC) The -xchip and -xtarget options now support
ultra3i and ultra4 as values so you can build
applications
that are optimized for the UltraSPARC IIIi and UltraSPARC IV processors.
Support For Extern Inline Functions
Inline function definitions and extern inline functions now
work as specified by the 1999 C ISO standard.
An inline function definition is a function defined with
the keyword inline, and without either the keywords
static or extern, and all prototypes appearing within
the source (or included files) also contain the keyword
inline without either the keywords static or
extern.
An inline function definition does not provide an external
definition for the function. Any function call appearing
in the source file containing an inline definition will
either be satisfied by inlining the function definition at
the call site, or by a reference to an externally defined
function.
The compiler will only inline calls to inline definitions
when -xO3 or higher has been specified, and the compiler
optimizer believes it is profitable to do so. Otherwise a
call to an external function will be made. Therefore any
program containing inline definitions should link with an
object file containing an extern function definition.
Use of both the keywords extern and inline
with a function definition (or on any prototype in the file
continuing the function definition) will result in an
external function being defined in that object file. To be
compatible with C++ linking with objects that contain
multiple definitions of extern inline functions will result
in the linker choosing just one of these functions to
satisfy any external references.
To get standard conforming behavior, old code must be recompiled using
the current compiler. However, if you have instances of extern
inline
function definitions in old C and C++ binaries (pre C/C++ 5.6) and you
wish to
link those binaries with new C and C++ binaries without changing the
behavior
of the old binaries, specify -features=no%extinl.
For more information on -features, see the C man page
cc(1)
.
Designated Initializers
Designated initializers provide a mechanism for
initializing sparse arrays, a practice common in numerical
programming.
Designated initializers allows initialization of sparse
structures, common in systems programming, and allows
initialization of unions via any member, regardless of
whether or not it is the first member.
Consider these examples. This first example shows how designated
initializers are used to initialize an array:
enum { first, second, third }; const char *nm[] = { [third] = "third member", [first] = "first member", [second] = "second member", };
This example demonstrates how designated initializers are used to
initialize the fields of a struct object:
division_t result = { .quot = 2, .rem = -1 };
This example shows how designated initializers can be used to initialize
complicated structures that might otherwise be misunderstood:
struct { int z[3], count; } w[] = { [0].z = {1}, [1].z[0] = 2 };
An array can be created from both ends by using a single
designator:
int z[MAX] = {1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0};
If MAX is greater than ten, the array will contain
zero-valued elements in the middle; if MAX is less than ten,
some of the values provided by the first five initializers
will be overridden by the second five.
Any member of a union can be initialized:
union { /* ... */ } u = { .any_member = 42 };
Universal Character Names (UCN)
UCN allows the use of any character in a C source, not just English
characters. A UCN has the format:
- \u 4_hex_digits_value
- \U 8_hex_digits_value
A UCN must not specify a value less than 00A0 other than
0024 ($), 0040 (@), or 0060 (?), nor a value in the range
D800 through DFFF inclusive.
UCN may be used in identifiers,
character constants, and string literals to designate
characters that are not in the C basic character set.
The UCN \Unnnnnnnn designates the
character whose eight-digit short identifier (as specified
by ISO/IEC 10646 is nnnnnnnn. Similarly, the universal
character name \unnnn designates the character whose
four-digit short identifier is nnnn (and whose eight-digit
short identifier is 0000nnnn.
The New -flteval Option
(Intel) Use this option to control how floating point expressions
are evaluated.
For more information on the -flteval option, see the
cc(1) man page.
New Security Checks with lint
This release of the lint utility features a new
security-checking
facility. You can use the new -errsecurity option before
compilation
to check your code for security liabilities.
-errsecurity[={core, standard, extended, %none}]
lint -errsecurity=core
This level checks for source code constructs that are almost
always either unsafe or difficult to verify. Checks at this
level include:
Consider source code that produces warnings at this level to be a
bug. The
source code in question should be changed. In all cases, straightforward
safer
alternatives are available.
lint -errsecurity=standard
This level includes all checks from the core level plus
constructs that may be safe, but have better alternatives
available. This level is recommended when checking
newly-written code. Additional checks at this level include:
Replace source code that produces warnings at this level with new or
significantly modified code. Balance addressing these warnings in legacy
code against the risks of destabilizing the application.
lint -errsecurity=extended
This level contains the most complete set of checks, including
everything from the Core and Standard levels. In addition, a
number of warnings are generated about constructs that may be
unsafe in some situations. The checks at this level are useful
as an aid in reviewing code, but need not be used as a standard
with which acceptable source code must comply. Additional
checks at this level include:
Review source code which produces warnings at this level to
determine if the potential security issue is present.
If you do not specify a setting for -errsecurity, the compiler
sets it to -errsecury=%none. If you do specify
-errsecurity,
but not an argument, the compiler sets it to -errsecurity=standard.
This section describes the new and changed features for
the C compiler. For information about other Sun ONE Studio 8
components, see the What's New manual. To access this manual
on your local system or network, go to
file:/opt/SUNWspro/docs/index.html. You can also access this
manual
by going to http://docs.sun.com.
General Enhancements
Linker Mapfiles No Longer Needed for Variable
Scoping:
-xldscope
Implementation of Additional C99 Features
Support for the VIS[tm] Developers Kit With
-xvis (SPARC)
Larger Default Stack Size for Slave Threads
Improved -xprofile
(SPARC)
Compiler and lint Support for UTF-16
String
Literals: -xustr, -Xustr
Faster Compilation
Faster Profiling With -xprofile_ircache
(SPARC)
Precompiled Headers, -xpch
Using Multiple Processors With
-xjobs=n
(SPARC)
Improved Performance
Improving Run-Time With Linker Supported
Thread-Local
Storage: -xthreadvar (SPARC)
Improving Run-Time By Reducing Page Faults:
-xF
Improving Run-Time With -xlinkopt
(SPARC)
Improving Run-Time With
-xpagesize=n
(SPARC)
Hardware Counter-Based Profiling With
-xhwcprof
(SPARC)
Easier Debugging
Dwarf-Format Debugger-Information With
-xdebugformat
Support For Debugging OpenMP Programs:
-xopenmp=noopt
Linker Mapfiles No Longer Needed for Variable
Scoping:
-xldscope
There are now two different ways you can control the exporting of symbols
in dynamic libraries. This facility is called linker scoping, and has been
supported by linker mapfiles for some time. First, you can now embed new
declaration specifiers in code. By embedding __global,
__symbolic, and __hidden directly in code,
you no longer need to use mapfiles. Second, you can override the default
setting for variable scopping by specifying -xldscope at
the command line.
For details, see -xldscope in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide. The
declaration specifiers are detailed in chapter 2, "C Compiler Information
Specific to Sun's Implementation" of the C User's Guide.
Implementation of Additional C99 Features
The Sun ONE Studio 8 C compiler implements support for the following
ISO/IEC 9899:1999 (referred to as C99 in this document) features. The
sub-section number of the C99 standard is listed for each item.
- Sub-clause 6.2.5 _Bool
- Sub-clause 6.2.5 _Complex type
Partial implementation of _Complex in this release. You must link with
-lcplxsupp on Solaris 7, 8, and 9. Static initialization of
_Complex data does not yet work.
- Sub-clause 6.3.2.1 Conversion of arrays to pointers not limited to
lvalues
- Sub-clause 6.4.4.2 Hexadecimal floating-point literals
- Sub-clause 6.5.2.5 Compound literals
- Sub-clause 6.7.2 _Imaginary type
- Sub-clause 6.10.6 STDC pragmas
- Sub-clause 6.10.8 __STDC_IEC_559 and __STDC_IEC_559_COMPLEX macros
For more information, see Appendix E Supported Features of C99
and Appendix B ABI Extensions for 1999 ISO/IEC C of the Sun ONE
Studio 8 Compiler Collection C User's Guide.
Support for the VIS[tm] Developers Kit With
-xvis (SPARC)
Use the -xvis=[yes|no] option when you are using the
assembly-language templates defined in the VIS instruction set
Software Developers Kit (VSDK). The default is -xvis=no.
The VIS instruction set is an extension to the SPARC v9 instruction set.
Even though the UltraSPARC processors are 64-bit, there are many caese,
especially in multimedia applications, when the data are limited to
eight or
16 bits in size. The VIS instructions can process four 16-bit data with one
instruction so they greatly improve the performance of applications that
handle new media such as imaging, linear algebra, signal processing,
audio, video and networking.
For more information on the VSDK, see
http://www.sun.com/processors/vis
.
For details, see -xvis in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Larger Default Stack Size for Slave
Threads
The default stack size for slave threads is now larger. All slave
threads
have the same stack size, which is four megabytes for 32-bit
applications and
eight megabytes for 64-bit applications by default. The size is set with
the
STACKSIZE environment variable.
For details, see Chapter 3 Parallelizing Sun C Code in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Improved -xprofile
(SPARC)
The -xprofile option offers the following improvements:
- Support for profiling shared libraries
- Thread-safe profile collection using -xprofile=collect -mt
- Improved support for profiling multiple programs or shared libraries
in a single profile directory.
With -xprofile=use, the compiler can now find profile data in
profile directories that contain data for multiple object files
with nonunique basenames. For cases where the compiler is unable
to find an object file's profile data, the compiler provides a
new option -xprofile_pathmap=collect-prefix:
use-prefix.
For details, see -xprofile and -xprofile_pathmap
in cc(1) or in the Sun ONE Studio 8 Compiler Collection
C User's Guide.
Compiler and lint Support for UTF-16
String
Literals: -xustr, -Xustr
Specify -xustr=ascii_utf16_ushort if your code contains string
literals that you want the compiler to convert to UTF-16 strings in the
object
file. This option enables recognition of the U"ASCII_string"
string literals as an array of unsigned short int.
For details, see -xustr in cc(1) or see -Xustr
in lint(1). Also see chapter 5 'lint Source Code
Checker' or
Appendix A of the Sun ONE Studio 8 Compiler Collection C User's
Guide.
Faster Profiling With
-xprofile_ircache
(SPARC)
Use -xprofile_ircache[=path] with
-xprofile=collect|use to improve compilation time during the use
phase by reusing compilation data saved from the collect phase.
With large programs, compilation time in the use phase
can improve significantly because the intermediate
data is saved. Note that the saved data could increase
disk space requirements considerably.
For details, see -xprofile_ircache in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Precompiled Headers, -xpch
This release of the compiler introduces the new
precompiled-header feature. The precompiled-header file is designed to
reduce compile time for applications whose source files share a common
set of include files containing a large amount of source code. A
precompiled header works by collecting information about a sequence
of header files from one source file, and then using that information
when recompiling that source file, and when compiling other source
files that have the same sequence of headers. You can take advantage
of this feature through the -xpch and -xpchstop
options in combination with the #pragma hdrstop directive.
For details, see the -xpch and -xpchstop and
options in cc(1). The Sun ONE Studio 8 Compiler Collection
C User's Guide details these options as well as
#pragma hdrstop.
Using Multiple Processors With
-xjobs=n
(SPARC)
Specify the -xjobs=n option to set how many processes
the
compiler creates to complete its work. This option can reduce the build
time on a
multi-cpu machine. Currently, -xjobs works only with the
-xipo option. When you specify -xjobs=n, the
interprocedural optimizer uses n as the maximum number of code
generator
instances it can invoke to compile different files.
For details, see -xjobs in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Improving Run-Time With Linker Supported
Thread-Local
Storage of Data: -xthreadvar (SPARC)
Use the new linker supported thread-local storage facility of the
compiler
to do the following:
- Utilize a fast implementation for the POSIX interfaces for allocating
thread-specific data.
- Convert multi-process programs to multi-thread programs.
- Port Windows applications using thread-local storage to Solaris.
- Utilize a fast implementation for the threadprivate variables in
OpenMP.
Thread-local storage is now available in the compiler through the
declaration of thread-local variables. The declaration consists of a normal
variable declaration with the addition of the variable specifier
__thread and the command line option -xthreadvar.
For details, see -xthreadvar in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide. The declaration
specifiers are detailed in chapter 2 "C-Compiler Information Specific
to Sun's Implementation" of the C User's Guide.
Improving Run-Time By Reducing Page Faults:
-xF
Use the new functionality of -xF to enable the optimal
reordering
of variables and functions by the linker. This can help solve the following
problems which negatively impact run-time performance:
- Cache and page contention caused by unrelated variables that are
near each
other in memory.
- Unnecessarily large work-set size as a result of related variables which
are not near each other in memory.
- Unnecessarily large work-set size as a result of unused copies of weak
variables that decrease the effective data density.
For details, see -xF in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Improving Run-Time With
-xlinkopt
(SPARC)
The C compiler can now perform link-time optimization on relocatable
object files when you specify the -xlinkopt option. See
cc(1).
Specify -xlinkopt and the compiler performs some additional
optimizations at link time without modifying the .o files that are linked.
The optimizations appear only in the executable program. The
-xlinkopt
option is most effective when you use it to compile the whole program,
and with profile feedback.
For details, see -xlinkopt in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Improving Run-Time With
-xpagesize=n
(SPARC)
Use the -xpagesize=n option to set the preferred page
size
for the stack and the heap. n can be 8K, 64K,
512K, 4M, 32M, 256M, 2G,
16G, or default. You must specify a valid page size
for the
Solaris operating environment on the target platform, as returned by
getpagesize(3C). If you do not specify a valid page size, the
request
is silently ignored at run-time. You can use pmap(1) or
meminfo(2) to determine page size of the target platform.
This option is a macro for -xpagesize_stack and
-xpagesize_heap.
For details, see -xpagesize, -xpagesize_heap, and
-xpagesize_stack in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Hardware Counter-Based Profiling With
-xhwcprof
(SPARC)
Use the -xhwcprof=[enable|disable] option to
enable compiler support for hardware counter-based profiling.
When -xhwcprof is enabled, the compiler generates information
that helps tools match hardware counter data reference and miss events with
associated instructions. Corresponding data-types and structure-members may
also be identified in conjunction with symbolic information (produced with
-g). This information can be useful in performance analysis
because it is not easily identified from profiles based on code addresses,
source statements, or routines.
For more information on hardware counter-based profiling, see the
Program Performance Analysis Tools manual.
For details, see -xhwcprof in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Dwarf-Format Debugger-Information With
-xdebugformat
The C compiler is migrating the format of debugger information
from the stabs format to the dwarf format as specified in DWARF
Debugging Information Format. If you maintain software which
reads debugging information, you now have the option to transition
your tools from the stabs format to the dwarf format. The default
setting for this release is -xdebugformat=stabs.
Use the -xdebugformat=dwarf option as a way
of accessing the new format for the purpose of porting tools.
There is no need to use this option unless you maintain software
which reads debugger information, or unless a specific tool tells
you that it requires debugger information in one of these formats.
For details, see -debugformat in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
Support For OpenMP
Debugging:-xopenmp=noopt
If you are debugging an OpenMP program with dbx, compile with
-g and -xopenmp=noopt so you can breakpoint within
parallel
regions and display the contents of variables.
For details, see -xopenmp in cc(1) or in the
Sun ONE Studio 8 Compiler Collection C User's Guide.
The Sun WorkShop 6 update 2 C (5.3) compiler includes the
following additional new and changed features.
-
The Sun WorkShop 6 update 2 C compiler includes the following
new and changed features.
- Interprocedural Optimization
(-xipo) (SPARC)
- OpenMP (SPARC)
- Lint Support for Type-based
Alias-Analysis
- Code Set Independence Via
-xcsi
- Partial Support for C99 Standard
- Lint Support for Implemented C99
Features
- Identifying Whether a Plain char Is
Signed
- New and Changed Values for -xchip and
-xtarget
- Interprocedural Optimization
(-xipo) (SPARC)
This new compiler flag performs whole-program optimizations by
invoking an interprocedural analysis pass. Unlike
-xcrossfile, -xipo performs optimizations
across all object files in the link step, and is not limited to
just the source files on the compile command.
-xipo is particularly useful when compiling and
linking large multi-file applications. Object files compiled with
this flag have analysis information compiled within them that
enables interprocedural analysis across source and pre-compiled
program files. However, analysis and optimization is limited to the
object files compiled with -xipo, and does not
extend to object files in the libraries.
-xipo is multiphased, so you need to specify
-xipo for each step if you compile and link in
separate steps.
In this example, compilation and linking occur in a single
step:
cc -xipo -xO4 -o prog part1.c part2.c part3.c
The optimizer performs crossfile inlining across all three source
files. This is done in the final link step, so the compilation of
the source files need not all take place in a single compilation
and could take place over a number of separate compilations, each
specifying -xipo.
In this example, compilation and linking occur in separate
steps:
cc -xipo -xO4 -c part1.c part2.c cc -xipo -xO4 -c part3.c cc -xipo -xO4 -o prog part1.o part2.o part3.o
The object files created in the compilation steps have
additional analysis information compiled within them to permit
crossfile optimizations to take place at the link step.
A restriction is that libraries, even if compiled with
-xipo do not participate in crossfile interprocedural
analysis, as shown in this example:
cc -xipo -xO4 one.c two.c three.c ar -r mylib.a one.o two.o three.o ... cc -xipo -xO4 -o myprog main.c four.c mylib.a
Here interprocedural optimizations are performed between one.c,
two.c and three.c, and between main.c and four.c, but not between
main.c or four.c and the routines on mylib.a. (The first
compilation may generate warnings about undefined symbols, but the
interprocedural optimizations are performed because it is a compile
and link step.)
Other important information about -xipo:
- It requires an optimization level of at least
-xO4.
- It conflicts with -xcrossfile. If you use these
together, the result is a compilation error.
- Objects that are compiled without -xipo can be
linked freely with objects that are compiled with
-xipo.
- OpenMP (SPARC)
This release of the C compiler implements the OpenMP interface
for explicit parallelization including a set of source code
directives, run-time library routines, and environment variables
with the following new option:
cc -xopenmp
Note: If you issue the -xopenmp option and
optimization is not at -xO3 or higher, optimization is
raised to -xO3 and a warning is issued.
You can view the OpenMP specifications at http://www.openmp.org/specs
(Parallelization features require a Forte for High Performance
Computing (HPC) license.)
- Lint support for type-based
alias-analysis
The Lint program now support type-based alias-analysis through
the following command:
This option has the same defaults and arguments as cc
-xalias_level. See cc.1 or The C User's Guide
for more information.
- Code Set Independence Via
-xcsi
-xcsi
Allows the C compiler to accept source code written in locales
that do not conform to the ISO C source character code
requirements. These locales include: ja_JP.PCK.
Note, the compiler translation phases required to handle such
locales may result in significantly longer compile times. You
should only use this option when you compile source files that
contain source characters from one of these locales.
The compiler does not recognize source code written in locales
that do not conform to the ISO C source character code requirements
unless you issue -xcsi.
- Partial Support for C99 Standard
The -xc99 flag controls compiler recognition of the
implemented features from the C99 standard (ISO/IEC 9899:1999,
Programming Language - C).
-xc99=[%all|%none]
If you issue -xc99 without =%none, the
compiler assumes -xc99=%all. -xc99=%all turns
on recognition of the C99 features implemented so far.
Sun WorkShop 6 update 2 supports the following C99 features:
- C99 Keywords
The C99 standard introduces the following new keywords:
- inline
- restrict
- _Imaginary
- _Complex
- _Bool
The compiler issues a warning if you use these keywords as
identifiers while compiling with -xc99=%none. Without
-xc99=%none the compiler issues a warning or an error message
for use of these keywords as identifiers depending on context.
- __func__ Support
The compiler provides support for the predefined identifier
__func__ .
- Variable Length Arrays
VLAs are allocated on the stack as if by calling the
alloca function. Their lifetime, regardless of their scope, is
the same as any data allocated on the stack by calling
alloca; until the function returns. The space allocated is
freed when the stack is released upon returning from the function
in which the VLA is allocated.
The compiler provides C99 support for Varaible Length Arrays.
Not all constraints are yet enforced. Constraint violations will
lead to undefined results.
- inline Specifier For Static Functions
The C99 function-specifier inline has been added.
inline is fully functional for functions with internal
linkage. For functions defined with external linkage use of the
inline function-specifier creates an inline definition
only, no external definition of the function is created. Thus
pointers to inline functions with external linkage are unique to
each translation unit and will not compare equal.
- Commenting Code With //
Code preceeded by a set of forward slashes is recognized as a
comment when you issue -xc99=%all. One set of forward
slashes is required per line of commentary.
- Lint Support for Implemented C99
Features
lint's -Xc99 flag enables you to check whether or not
your code is properly calling supported C99 featues.
- Identifying Whether a Plain char Is
Signed
The -xchar[={signed|s|unsigned|u}] option is provided
solely for the purpose of easing the migration of code from systems
where the char type is defined as unsigned. Do not use
this option unless you are migrating from such a system. Only code
that relies on the sign of a char type needs to be
rewritten to explicitly specify signed or unsigned.
| signed |
Treat character constants and variables declared as char as
signed. This impacts the behavior of compiled code, it does not
affect the behavior of library routines. |
| s |
Equivalent to signed |
| unsigned |
Treat character constants and variables declared as char as
unsigned. This impacts the behavior of compiled code, it does not
affect the behavior of library routines. |
| u |
Equivalent to unsigned |
If you do not specify -xchar, the compiler assumes
-xchar=s. If you specify -xchar, but do not specify a
value, the compiler assumes -xchar=s.
The -xchar option changes the range of values for the
type char only for code compiled with -xchar. This option
does not change the range of values for type char in any system
routine or header file. In particular, the value of
CHAR_MAX and CHAR_MIN, as defined by
limits.h, do not change when this option is specified.
Therefor, CHAR_MAX and CHAR_MIN no longer
represent the range of values encodable in a plain char.
If you use -xchar, be particularly careful when you
compare a char against a predefined system macro because
the value in the macro may be signed. This is most common for any
routine that returns an error code which is accessed through a
macro. Error codes are typically negative values so when you
compare a char against the value from such a macro, the
result is always false. A negative number can never be equal to any
value of an unsigned type.
It is strongly recommended that you never use -xcharto
compile routines for any interface exported through a library. By
default, the C compiler defines char as signed as per the
Solaris ABI and -xchar does not change that. Therefore,
any users of such a library needs to be cautioned to also use this
option or otherwise deal with any char values being passed or
returned.
- New and Changed Values for -xchip
and -xtarget
The -xchip option now accepts the value ultra2e
for specifying the UltraSPARCIIe processor.
Also the implied -xarch setting for the following
-xtarget values has changed from v8 to
v8plusa:
- entr2/1170
- entr2/1200
- entr2/2170
- entr2/2200
- entr3000
- entr4000
- entr5000
- entr6000
- ultra
- ultra/140
- ultra/170
- ultra/200
- ultra2
- ultra2/1170
- ultra2/1200
- ultra2/1300
- ultra2/2170
- ultra2/2200
- ultra2/2300
- ultra2e
- ultra2i
- ultra3
-
Sun WorkShop 6 update 1 C Compiler included the following new
and changed features.
- Support for the UltraSPARC III Processor
The -xtarget and -xchip flags now accept
ultra3.
- Optimizing Through Type-Based Analysis
The C compiler now accepts the -xalias_level option and
several pragmas which allow it to perform type-based alias analysis
and optimizations.
- Enhancing Math Routine Performance With New Pragmas
cc -fast now expands to include the macro
__MATHERR_ERRNO_DONTCARE. This macro causes math.h on
Solaris 8 to assert performance-related pragmas for some of the
math routines prototyped in math.h.
- Using Built-in Standard -Library Functions
Use the new -xbuiltin command when you want the
compiler to improve performance of generated code through
substitution of intrinsics, or inlining, of standard library
functions as the compiler determines it is profitable.
- Enabling or Disabling Trigraph Interpretation
Use the -xtrigraphs command when you want to enable or
disable trigraph translation.
- Prefetch Latency
Use -xprefetch=latx:n.n to specify a factor to
adjust the prefetch-to-load and prefetch-to-store latencies.
- Overriding the Default Search Path
The new -I- option gives you more control over the
algorithm that the compiler uses when searching for include
files.
This version of the Forte Developer C compiler includes the following
new features:
-
Incremental Link Editor Chapter
This version of the C User's Guide includes a full chapter about
the incremental link editor.
-
__func__
The C compiler now predefines a static, constant, char
array named __func__ for every function definition.
The array is initialized with the name of the function and
can be used anywhere a static function scope array can be
used, such as when printing the name of the enclosing function.
-
Variable argument macro
You can now issue a #define preprocessor directive
in the following form:
#define <identifier> (...) <replacement-list> new-line
#define <identifier> (<identifier-list> , ...)
<replacement-list> new-line
The C preprocessor accepts a variable number of arguments for a
#define preprocessor directive. If the macro definition
includes an ellipsis as part of the identifier list, then there
will be more arguments when the macro is invoked then there were
parameters in the macro definition.
-
SUNW_MP_THR_IDLE
You can now use the SUNW_MP_THR_IDLE
environment variable to control whether a thread
continues to use system resources after it finishes its task or it "sleeps."
-
Large arrays
The C compiler now supports significantly larger array objects.
For specifics, see Appendix A of the C User's Guide.
-
-errchk=locfmtchk
lint now accepts a new flag, -errchk=locfmtchk, that
checks for printf-like format strings during lint's
first pass.
-
New lint directive
(PRINTFLIKE(n))
lint now accepts a new directive that identifies all calls to
the printf() family through a pointer. All such
calls through the pointer can now be checked for argument
consistency by lint.
-
-errwarn=t
The C compiler and the lint source code checker now support a
new option
-errwarn=t, which causes the compiler to exit with a
failure status if any of the specified warnings are issued.
-
-errchk
The -errchk option of lint now has a new value
signext that you can use in conjunction with the
longptr64 option: -errchk=longptr64,signext.
This new option warns about sign extension in order to facilitate
migration to the 64-bit development environment.
-
-xchar_byte_order
The -xchar_byte_order option produces an integer constant by
placing the characters of a multi-character character-constant in the
specified byte order.
-
-xinline
The -xinline option now accepts two new values:
%auto and no%function_name.
The %auto value takes effect at the -x04
level of optimization and allows the compiler
to automatically inline functions in addition to
those listed in -xinline. The no%function_name
value tells the compiler to not inline the function
function_name.
-
-xmemalign
The C compiler now offers a new option called -xmemalign. This
option controls code generated for potentially misaligned memory
accesses and controls program behavior in the event of a misaligned access.
-
-xprefetch
SPARC only - You can use the new option
-xprefetch, in conjunction with the header
file, sun_prefetch.h to specify prefetch
instructions on those architectures that support
prefetch, such as UltraSPARC II.
-
-xvector
The -xvector option enables automatic generation of calls to
the vector library functions.
|