OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [doc/] [standards.texi] - Diff between revs 38 and 154

Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 154
@c Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
@c Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@c For copying conditions, see the file gcc.texi.
 
 
@node Standards
@node Standards
@chapter Language Standards Supported by GCC
@chapter Language Standards Supported by GCC
@cindex C standard
@cindex C standard
@cindex C standards
@cindex C standards
@cindex ANSI C standard
@cindex ANSI C standard
@cindex ANSI C
@cindex ANSI C
@cindex ANSI C89
@cindex ANSI C89
@cindex C89
@cindex C89
@cindex ANSI X3.159-1989
@cindex ANSI X3.159-1989
@cindex X3.159-1989
@cindex X3.159-1989
@cindex ISO C standard
@cindex ISO C standard
@cindex ISO C
@cindex ISO C
@cindex ISO C90
@cindex ISO C90
@cindex ISO/IEC 9899
@cindex ISO/IEC 9899
@cindex ISO 9899
@cindex ISO 9899
@cindex C90
@cindex C90
@cindex ISO C94
@cindex ISO C94
@cindex C94
@cindex C94
@cindex ISO C95
@cindex ISO C95
@cindex C95
@cindex C95
@cindex ISO C99
@cindex ISO C99
@cindex C99
@cindex C99
@cindex ISO C9X
@cindex ISO C9X
@cindex C9X
@cindex C9X
@cindex Technical Corrigenda
@cindex Technical Corrigenda
@cindex TC1
@cindex TC1
@cindex Technical Corrigendum 1
@cindex Technical Corrigendum 1
@cindex TC2
@cindex TC2
@cindex Technical Corrigendum 2
@cindex Technical Corrigendum 2
@cindex AMD1
@cindex AMD1
@cindex freestanding implementation
@cindex freestanding implementation
@cindex freestanding environment
@cindex freestanding environment
@cindex hosted implementation
@cindex hosted implementation
@cindex hosted environment
@cindex hosted environment
@findex __STDC_HOSTED__
@findex __STDC_HOSTED__
 
 
For each language compiled by GCC for which there is a standard, GCC
For each language compiled by GCC for which there is a standard, GCC
attempts to follow one or more versions of that standard, possibly
attempts to follow one or more versions of that standard, possibly
with some exceptions, and possibly with some extensions.
with some exceptions, and possibly with some extensions.
 
 
GCC supports three versions of the C standard, although support for
GCC supports three versions of the C standard, although support for
the most recent version is not yet complete.
the most recent version is not yet complete.
 
 
@opindex std
@opindex std
@opindex ansi
@opindex ansi
@opindex pedantic
@opindex pedantic
@opindex pedantic-errors
@opindex pedantic-errors
The original ANSI C standard (X3.159-1989) was ratified in 1989 and
The original ANSI C standard (X3.159-1989) was ratified in 1989 and
published in 1990.  This standard was ratified as an ISO standard
published in 1990.  This standard was ratified as an ISO standard
(ISO/IEC 9899:1990) later in 1990.  There were no technical
(ISO/IEC 9899:1990) later in 1990.  There were no technical
differences between these publications, although the sections of the
differences between these publications, although the sections of the
ANSI standard were renumbered and became clauses in the ISO standard.
ANSI standard were renumbered and became clauses in the ISO standard.
This standard, in both its forms, is commonly known as @dfn{C89}, or
This standard, in both its forms, is commonly known as @dfn{C89}, or
occasionally as @dfn{C90}, from the dates of ratification.  The ANSI
occasionally as @dfn{C90}, from the dates of ratification.  The ANSI
standard, but not the ISO standard, also came with a Rationale
standard, but not the ISO standard, also came with a Rationale
document.  To select this standard in GCC, use one of the options
document.  To select this standard in GCC, use one of the options
@option{-ansi}, @option{-std=c89} or @option{-std=iso9899:1990}; to obtain
@option{-ansi}, @option{-std=c89} or @option{-std=iso9899:1990}; to obtain
all the diagnostics required by the standard, you should also specify
all the diagnostics required by the standard, you should also specify
@option{-pedantic} (or @option{-pedantic-errors} if you want them to be
@option{-pedantic} (or @option{-pedantic-errors} if you want them to be
errors rather than warnings).  @xref{C Dialect Options,,Options
errors rather than warnings).  @xref{C Dialect Options,,Options
Controlling C Dialect}.
Controlling C Dialect}.
 
 
Errors in the 1990 ISO C standard were corrected in two Technical
Errors in the 1990 ISO C standard were corrected in two Technical
Corrigenda published in 1994 and 1996.  GCC does not support the
Corrigenda published in 1994 and 1996.  GCC does not support the
uncorrected version.
uncorrected version.
 
 
An amendment to the 1990 standard was published in 1995.  This
An amendment to the 1990 standard was published in 1995.  This
amendment added digraphs and @code{__STDC_VERSION__} to the language,
amendment added digraphs and @code{__STDC_VERSION__} to the language,
but otherwise concerned the library.  This amendment is commonly known
but otherwise concerned the library.  This amendment is commonly known
as @dfn{AMD1}; the amended standard is sometimes known as @dfn{C94} or
as @dfn{AMD1}; the amended standard is sometimes known as @dfn{C94} or
@dfn{C95}.  To select this standard in GCC, use the option
@dfn{C95}.  To select this standard in GCC, use the option
@option{-std=iso9899:199409} (with, as for other standard versions,
@option{-std=iso9899:199409} (with, as for other standard versions,
@option{-pedantic} to receive all required diagnostics).
@option{-pedantic} to receive all required diagnostics).
 
 
A new edition of the ISO C standard was published in 1999 as ISO/IEC
A new edition of the ISO C standard was published in 1999 as ISO/IEC
9899:1999, and is commonly known as @dfn{C99}.  GCC has incomplete
9899:1999, and is commonly known as @dfn{C99}.  GCC has incomplete
support for this standard version; see
support for this standard version; see
@uref{http://gcc.gnu.org/gcc-4.2/c99status.html} for details.  To select this
@uref{http://gcc.gnu.org/gcc-4.2/c99status.html} for details.  To select this
standard, use @option{-std=c99} or @option{-std=iso9899:1999}.  (While in
standard, use @option{-std=c99} or @option{-std=iso9899:1999}.  (While in
development, drafts of this standard version were referred to as
development, drafts of this standard version were referred to as
@dfn{C9X}.)
@dfn{C9X}.)
 
 
Errors in the 1999 ISO C standard were corrected in two Technical
Errors in the 1999 ISO C standard were corrected in two Technical
Corrigenda published in 2001 and 2004.  GCC does not support the uncorrected
Corrigenda published in 2001 and 2004.  GCC does not support the uncorrected
version.
version.
 
 
By default, GCC provides some extensions to the C language that on
By default, GCC provides some extensions to the C language that on
rare occasions conflict with the C standard.  @xref{C
rare occasions conflict with the C standard.  @xref{C
Extensions,,Extensions to the C Language Family}.  Use of the
Extensions,,Extensions to the C Language Family}.  Use of the
@option{-std} options listed above will disable these extensions where
@option{-std} options listed above will disable these extensions where
they conflict with the C standard version selected.  You may also
they conflict with the C standard version selected.  You may also
select an extended version of the C language explicitly with
select an extended version of the C language explicitly with
@option{-std=gnu89} (for C89 with GNU extensions) or @option{-std=gnu99}
@option{-std=gnu89} (for C89 with GNU extensions) or @option{-std=gnu99}
(for C99 with GNU extensions).  The default, if no C language dialect
(for C99 with GNU extensions).  The default, if no C language dialect
options are given, is @option{-std=gnu89}; this will change to
options are given, is @option{-std=gnu89}; this will change to
@option{-std=gnu99} in some future release when the C99 support is
@option{-std=gnu99} in some future release when the C99 support is
complete.  Some features that are part of the C99 standard are
complete.  Some features that are part of the C99 standard are
accepted as extensions in C89 mode.
accepted as extensions in C89 mode.
 
 
The ISO C standard defines (in clause 4) two classes of conforming
The ISO C standard defines (in clause 4) two classes of conforming
implementation.  A @dfn{conforming hosted implementation} supports the
implementation.  A @dfn{conforming hosted implementation} supports the
whole standard including all the library facilities; a @dfn{conforming
whole standard including all the library facilities; a @dfn{conforming
freestanding implementation} is only required to provide certain
freestanding implementation} is only required to provide certain
library facilities: those in @code{<float.h>}, @code{<limits.h>},
library facilities: those in @code{<float.h>}, @code{<limits.h>},
@code{<stdarg.h>}, and @code{<stddef.h>}; since AMD1, also those in
@code{<stdarg.h>}, and @code{<stddef.h>}; since AMD1, also those in
@code{<iso646.h>}; and in C99, also those in @code{<stdbool.h>} and
@code{<iso646.h>}; and in C99, also those in @code{<stdbool.h>} and
@code{<stdint.h>}.  In addition, complex types, added in C99, are not
@code{<stdint.h>}.  In addition, complex types, added in C99, are not
required for freestanding implementations.  The standard also defines
required for freestanding implementations.  The standard also defines
two environments for programs, a @dfn{freestanding environment},
two environments for programs, a @dfn{freestanding environment},
required of all implementations and which may not have library
required of all implementations and which may not have library
facilities beyond those required of freestanding implementations,
facilities beyond those required of freestanding implementations,
where the handling of program startup and termination are
where the handling of program startup and termination are
implementation-defined, and a @dfn{hosted environment}, which is not
implementation-defined, and a @dfn{hosted environment}, which is not
required, in which all the library facilities are provided and startup
required, in which all the library facilities are provided and startup
is through a function @code{int main (void)} or @code{int main (int,
is through a function @code{int main (void)} or @code{int main (int,
char *[])}.  An OS kernel would be a freestanding environment; a
char *[])}.  An OS kernel would be a freestanding environment; a
program using the facilities of an operating system would normally be
program using the facilities of an operating system would normally be
in a hosted implementation.
in a hosted implementation.
 
 
@opindex ffreestanding
@opindex ffreestanding
GCC aims towards being usable as a conforming freestanding
GCC aims towards being usable as a conforming freestanding
implementation, or as the compiler for a conforming hosted
implementation, or as the compiler for a conforming hosted
implementation.  By default, it will act as the compiler for a hosted
implementation.  By default, it will act as the compiler for a hosted
implementation, defining @code{__STDC_HOSTED__} as @code{1} and
implementation, defining @code{__STDC_HOSTED__} as @code{1} and
presuming that when the names of ISO C functions are used, they have
presuming that when the names of ISO C functions are used, they have
the semantics defined in the standard.  To make it act as a conforming
the semantics defined in the standard.  To make it act as a conforming
freestanding implementation for a freestanding environment, use the
freestanding implementation for a freestanding environment, use the
option @option{-ffreestanding}; it will then define
option @option{-ffreestanding}; it will then define
@code{__STDC_HOSTED__} to @code{0} and not make assumptions about the
@code{__STDC_HOSTED__} to @code{0} and not make assumptions about the
meanings of function names from the standard library, with exceptions
meanings of function names from the standard library, with exceptions
noted below.  To build an OS kernel, you may well still need to make
noted below.  To build an OS kernel, you may well still need to make
your own arrangements for linking and startup.
your own arrangements for linking and startup.
@xref{C Dialect Options,,Options Controlling C Dialect}.
@xref{C Dialect Options,,Options Controlling C Dialect}.
 
 
GCC does not provide the library facilities required only of hosted
GCC does not provide the library facilities required only of hosted
implementations, nor yet all the facilities required by C99 of
implementations, nor yet all the facilities required by C99 of
freestanding implementations; to use the facilities of a hosted
freestanding implementations; to use the facilities of a hosted
environment, you will need to find them elsewhere (for example, in the
environment, you will need to find them elsewhere (for example, in the
GNU C library).  @xref{Standard Libraries,,Standard Libraries}.
GNU C library).  @xref{Standard Libraries,,Standard Libraries}.
 
 
Most of the compiler support routines used by GCC are present in
Most of the compiler support routines used by GCC are present in
@file{libgcc}, but there are a few exceptions.  GCC requires the
@file{libgcc}, but there are a few exceptions.  GCC requires the
freestanding environment provide @code{memcpy}, @code{memmove},
freestanding environment provide @code{memcpy}, @code{memmove},
@code{memset} and @code{memcmp}.
@code{memset} and @code{memcmp}.
Finally, if @code{__builtin_trap} is used, and the target does
Finally, if @code{__builtin_trap} is used, and the target does
not implement the @code{trap} pattern, then GCC will emit a call
not implement the @code{trap} pattern, then GCC will emit a call
to @code{abort}.
to @code{abort}.
 
 
For references to Technical Corrigenda, Rationale documents and
For references to Technical Corrigenda, Rationale documents and
information concerning the history of C that is available online, see
information concerning the history of C that is available online, see
@uref{http://gcc.gnu.org/readings.html}
@uref{http://gcc.gnu.org/readings.html}
 
 
@c FIXME: details of C++ standard.
@c FIXME: details of C++ standard.
 
 
@cindex Objective-C
@cindex Objective-C
@cindex Objective-C++
@cindex Objective-C++
 
 
There is no formal written standard for Objective-C or Objective-C++@.  The most
There is no formal written standard for Objective-C or Objective-C++@.  The most
authoritative manual is ``Object-Oriented Programming and the
authoritative manual is ``Object-Oriented Programming and the
Objective-C Language'', available at a number of web sites:
Objective-C Language'', available at a number of web sites:
 
 
@itemize
@itemize
@item
@item
@uref{http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/}
@uref{http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/}
is a recent (and periodically updated) version;
is a recent (and periodically updated) version;
@item
@item
@uref{http://www.toodarkpark.org/computers/objc/}
@uref{http://www.toodarkpark.org/computers/objc/}
is an older example;
is an older example;
@item
@item
@uref{http://www.gnustep.org}
@uref{http://www.gnustep.org}
and
and
@uref{http://gcc.gnu.org/readings.html}
@uref{http://gcc.gnu.org/readings.html}
have additional useful information.
have additional useful information.
@end itemize
@end itemize
 
 
@cindex treelang
@cindex treelang
There is no standard for treelang, which is a sample language front end
There is no standard for treelang, which is a sample language front end
for GCC@.  Its only purpose is as a sample for people wishing to write a
for GCC@.  Its only purpose is as a sample for people wishing to write a
new language for GCC@.  The language is documented in
new language for GCC@.  The language is documented in
@file{gcc/treelang/treelang.texi} which can be turned into info or
@file{gcc/treelang/treelang.texi} which can be turned into info or
HTML format.
HTML format.
 
 
@xref{Top, GNAT Reference Manual, About This Guide, gnat_rm,
@xref{Top, GNAT Reference Manual, About This Guide, gnat_rm,
GNAT Reference Manual}, for information on standard
GNAT Reference Manual}, for information on standard
conformance and compatibility of the Ada compiler.
conformance and compatibility of the Ada compiler.
 
 
@xref{Standards,,Standards, gfortran, The GNU Fortran Compiler}, for details
@xref{Standards,,Standards, gfortran, The GNU Fortran Compiler}, for details
of standards supported by GNU Fortran.
of standards supported by GNU Fortran.
 
 
@xref{Compatibility,,Compatibility with the Java Platform, gcj, GNU gcj},
@xref{Compatibility,,Compatibility with the Java Platform, gcj, GNU gcj},
for details of compatibility between @command{gcj} and the Java Platform.
for details of compatibility between @command{gcj} and the Java Platform.
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.