This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR c/20631Support -std=c90 as alias for -std=c89


Bootstrapped and regression tested on x86_64-linux-gnu. make info and
make dvi succeed.

OK for GCC 4.5?

2010-02-26  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c/20631
	* doc/cpp.texi: Use c90 instead of c89 and gnu90 instead of gnu89.
	* doc/standards.texi: Likewise.
	* doc/extend.texi: Likewise.
	* doc/trouble.texi: Likewise.
	* doc/cppopts.texi: Likewise.
	* doc/install.texi: Likewise.
	* c.opt (std=c90,std=gnu90): New options.
	* c-opts.c (c_common_handle_option): Handle them.
	
testsuite/
	* gcc.dg/cpp/c90-pedantic.c: New.
	* gcc.dg/cpp/c90.c: New.
	* gcc.dg/gnu90-const-expr-1.c: New.
	* gcc.dg/Woverlength-strings-pedantic-c90.c: New.
Index: gcc/doc/cpp.texi
===================================================================
--- gcc/doc/cpp.texi	(revision 156927)
+++ gcc/doc/cpp.texi	(working copy)
@@ -213,11 +213,11 @@ C preprocessors vary in some details.  T
 preprocessor, which provides a small superset of the features of ISO
 Standard C@.  In its default mode, the GNU C preprocessor does not do a
 few things required by the standard.  These are features which are
 rarely, if ever, used, and may cause surprising changes to the meaning
 of a program which does not expect them.  To get strict ISO Standard C,
-you should use the @option{-std=c89} or @option{-std=c99} options, depending
+you should use the @option{-std=c90} or @option{-std=c99} options, depending
 on which version of the standard you want.  To get all the mandatory
 diagnostics, you must also use @option{-pedantic}.  @xref{Invocation}.
 
 This manual describes the behavior of the ISO preprocessor.  To
 minimize gratuitous differences, where the ISO preprocessor's
@@ -2062,11 +2062,11 @@ functions.  You should not use these mac
 sure that programs will execute with the same effect whether or not they
 are defined.  If they are defined, their value is 1.
 
 @item __GNUC_GNU_INLINE__
 GCC defines this macro if functions declared @code{inline} will be
-handled in GCC's traditional gnu89 mode.  Object files will contain
+handled in GCC's traditional gnu90 mode.  Object files will contain
 externally visible definitions of all functions declared @code{inline}
 without @code{extern} or @code{static}.  They will not contain any
 definitions of any functions declared @code{extern inline}.
 
 @item __GNUC_STDC_INLINE__
@@ -2075,14 +2075,14 @@ handled according to the ISO C99 standar
 externally visible definitions of all functions declared @code{extern
 inline}.  They will not contain definitions of any functions declared
 @code{inline} without @code{extern}.
 
 If this macro is defined, GCC supports the @code{gnu_inline} function
-attribute as a way to always get the gnu89 behavior.  Support for
+attribute as a way to always get the gnu90 behavior.  Support for
 this and @code{__GNUC_GNU_INLINE__} was added in GCC 4.1.3.  If
 neither macro is defined, an older version of GCC is being used:
-@code{inline} functions will be compiled in gnu89 mode, and the
+@code{inline} functions will be compiled in gnu90 mode, and the
 @code{gnu_inline} function attribute will not be recognized.
 
 @item __CHAR_UNSIGNED__
 GCC defines this macro if and only if the data type @code{char} is
 unsigned on the target machine.  It exists to cause the standard header
Index: gcc/doc/standards.texi
===================================================================
--- gcc/doc/standards.texi	(revision 156927)
+++ gcc/doc/standards.texi	(working copy)
@@ -61,11 +61,11 @@ differences between these publications, 
 ANSI standard were renumbered and became clauses in the ISO standard.
 This standard, in both its forms, is commonly known as @dfn{C89}, or
 occasionally as @dfn{C90}, from the dates of ratification.  The ANSI
 standard, but not the ISO standard, also came with a Rationale
 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=c90} or @option{-std=iso9899:1990}; to obtain
 all the diagnostics required by the standard, you should also specify
 @option{-pedantic} (or @option{-pedantic-errors} if you want them to be
 errors rather than warnings).  @xref{C Dialect Options,,Options
 Controlling C Dialect}.
 
@@ -97,16 +97,16 @@ By default, GCC provides some extensions
 rare occasions conflict with the C standard.  @xref{C
 Extensions,,Extensions to the C Language Family}.  Use of the
 @option{-std} options listed above will disable these extensions where
 they conflict with the C standard version selected.  You may also
 select an extended version of the C language explicitly with
-@option{-std=gnu89} (for C89 with GNU extensions) or @option{-std=gnu99}
+@option{-std=gnu90} (for C90 with GNU extensions) or @option{-std=gnu99}
 (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=gnu90}; this will change to
 @option{-std=gnu99} in some future release when the C99 support is
 complete.  Some features that are part of the C99 standard are
-accepted as extensions in C89 mode.
+accepted as extensions in C90 mode.
 
 The ISO C standard defines (in clause 4) two classes of conforming
 implementation.  A @dfn{conforming hosted implementation} supports the
 whole standard including all the library facilities; a @dfn{conforming
 freestanding implementation} is only required to provide certain
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi	(revision 156927)
+++ gcc/doc/extend.texi	(working copy)
@@ -19,12 +19,12 @@ features in conditional compilation, che
 
 These extensions are available in C and Objective-C@.  Most of them are
 also available in C++.  @xref{C++ Extensions,,Extensions to the
 C++ Language}, for extensions that apply @emph{only} to C++.
 
-Some features that are in ISO C99 but not C89 or C++ are also, as
-extensions, accepted by GCC in C89 mode and in C++.
+Some features that are in ISO C99 but not C90 or C++ are also, as
+extensions, accepted by GCC in C90 mode and in C++.
 
 @menu
 * Statement Exprs::     Putting statements and declarations inside expressions.
 * Local Labels::        Labels local to a block.
 * Labels as Values::    Getting pointers to labels, and computed gotos.
@@ -811,11 +811,11 @@ effects of recomputing it.
 @cindex multiprecision arithmetic
 @cindex @code{LL} integer suffix
 @cindex @code{ULL} integer suffix
 
 ISO C99 supports data types for integers that are at least 64 bits wide,
-and as an extension GCC supports them in C89 mode and in C++.
+and as an extension GCC supports them in C90 mode and in C++.
 Simply write @code{long long int} for a signed integer, or
 @code{unsigned long long int} for an unsigned integer.  To make an
 integer constant of type @code{long long int}, add the suffix @samp{LL}
 to the integer.  To make an integer constant of type @code{unsigned long
 long int}, add the suffix @samp{ULL} to the integer.
@@ -841,11 +841,11 @@ Likewise, if the function expects @code{
 @cindex complex numbers
 @cindex @code{_Complex} keyword
 @cindex @code{__complex__} keyword
 
 ISO C99 supports complex floating data types, and as an extension GCC
-supports them in C89 mode and in C++, and supports complex integer data
+supports them in C90 mode and in C++, and supports complex integer data
 types which are not part of ISO C99.  You can declare complex types
 using the keyword @code{_Complex}.  As an extension, the older GNU
 keyword @code{__complex__} is also supported.
 
 For example, @samp{_Complex double x;} declares @code{x} as a
@@ -1030,11 +1030,11 @@ are supported by the DWARF2 debug inform
 @cindex hex floats
 
 ISO C99 supports floating-point numbers written not only in the usual
 decimal notation, such as @code{1.55e1}, but also numbers such as
 @code{0x1.fp3} written in hexadecimal format.  As a GNU extension, GCC
-supports this in C89 mode (except in some cases when strictly
+supports this in C90 mode (except in some cases when strictly
 conforming) and in C++.  In that format the
 @samp{0x} hex introducer and the @samp{p} or @samp{P} exponent field are
 mandatory.  The exponent is a decimal number that indicates the power of
 2 by which the significant part will be multiplied.  Thus @samp{0x1.f} is
 @tex
@@ -1343,11 +1343,11 @@ member of type @code{char}.
 @cindex variable-length arrays
 @cindex arrays of variable length
 @cindex VLAs
 
 Variable-length automatic arrays are allowed in ISO C99, and as an
-extension GCC accepts them in C89 mode and in C++.  (However, GCC's
+extension GCC accepts them in C90 mode and in C++.  (However, GCC's
 implementation of variable-length arrays does not yet conform in detail
 to the ISO C99 standard.)  These arrays are
 declared like any other automatic arrays, but with a length that is not
 a constant expression.  The storage is allocated at the point of
 declaration and deallocated when the brace-level is exited.  For
@@ -1509,13 +1509,13 @@ yet been replaced with spaces.
 @cindex subscripting and function values
 In ISO C99, arrays that are not lvalues still decay to pointers, and
 may be subscripted, although they may not be modified or used after
 the next sequence point and the unary @samp{&} operator may not be
 applied to them.  As an extension, GCC allows such arrays to be
-subscripted in C89 mode, though otherwise they do not decay to
+subscripted in C90 mode, though otherwise they do not decay to
 pointers outside C99 mode.  For example,
-this is valid in GNU C though not valid in C89:
+this is valid in GNU C though not valid in C90:
 
 @smallexample
 @group
 struct foo @{int a[4];@};
 
@@ -1574,11 +1574,11 @@ foo (float f, float g)
 
 ISO C99 supports compound literals.  A compound literal looks like
 a cast containing an initializer.  Its value is an object of the
 type specified in the cast, containing the elements specified in
 the initializer; it is an lvalue.  As an extension, GCC supports
-compound literals in C89 mode and in C++.
+compound literals in C90 mode and in C++.
 
 Usually, the specified type is a structure.  Assume that
 @code{struct foo} and @code{structure} are declared as shown:
 
 @smallexample
@@ -1644,17 +1644,17 @@ static int z[] = @{1, 0, 0@};
 @cindex initializers with labeled elements
 @cindex labeled elements in initializers
 @cindex case labels in initializers
 @cindex designated initializers
 
-Standard C89 requires the elements of an initializer to appear in a fixed
+Standard C90 requires the elements of an initializer to appear in a fixed
 order, the same as the order of the elements in the array or structure
 being initialized.
 
 In ISO C99 you can give the elements in any order, specifying the array
 indices or structure field names they apply to, and GNU C allows this as
-an extension in C89 mode as well.  This extension is not
+an extension in C90 mode as well.  This extension is not
 implemented in GNU C++.
 
 To specify an array index, write
 @samp{[@var{index}] =} before the element value.  For example,
 
@@ -1867,11 +1867,11 @@ hack ((union foo) x);
 @cindex declarations, mixed with code
 @cindex code, mixed with declarations
 
 ISO C99 and ISO C++ allow declarations and code to be freely mixed
 within compound statements.  As an extension, GCC also allows this in
-C89 mode.  For example, you could do:
+C90 mode.  For example, you could do:
 
 @smallexample
 int i;
 /* @r{@dots{}} */
 i++;
@@ -2004,11 +2004,11 @@ if no optimization level was specified.
 
 @item gnu_inline
 @cindex @code{gnu_inline} function attribute
 This attribute should be used with a function which is also declared
 with the @code{inline} keyword.  It directs GCC to treat the function
-as if it were defined in gnu89 mode even when compiling in C99 or
+as if it were defined in gnu90 mode even when compiling in C99 or
 gnu99 mode.
 
 If the function is declared @code{extern}, then this definition of the
 function is used only for inlining.  In no case is the function
 compiled as a standalone function, not even if you take its address
@@ -3835,11 +3835,11 @@ extension is irrelevant.
 In GNU C, you may use C++ style comments, which start with @samp{//} and
 continue until the end of the line.  Many other C implementations allow
 such comments, and they are included in the 1999 C standard.  However,
 C++ style comments are not recognized if you specify an @option{-std}
 option specifying a version of ISO C before C99, or @option{-ansi}
-(equivalent to @option{-std=c89}).
+(equivalent to @option{-std=c90}).
 
 @node Dollar Signs
 @section Dollar Signs in Identifier Names
 @cindex $
 @cindex dollar signs in identifier names
@@ -4936,11 +4936,11 @@ inc (int *a)
 @{
   (*a)++;
 @}
 @end smallexample
 
-If you are writing a header file to be included in ISO C89 programs, write
+If you are writing a header file to be included in ISO C90 programs, write
 @code{__inline__} instead of @code{inline}.  @xref{Alternate Keywords}.
 
 The three types of inlining behave similarly in two important cases:
 when the @code{inline} keyword is used on a @code{static} function,
 like the example above, and when a function is first declared without
@@ -4999,11 +4999,11 @@ the @samp{always_inline} attribute for t
 @smallexample
 /* @r{Prototype.}  */
 inline void foo (const char) __attribute__((always_inline));
 @end smallexample
 
-The remainder of this section is specific to GNU C89 inlining.
+The remainder of this section is specific to GNU C90 inlining.
 
 @cindex non-static inline function
 When an inline function is not @code{static}, then the compiler must assume
 that there may be calls from other source files; since a global symbol can
 be defined only once in any program, the function must not be defined in
@@ -6842,11 +6842,11 @@ Many of these functions are only optimiz
 not optimized in a particular case, a call to the library function will
 be emitted.
 
 @opindex ansi
 @opindex std
-Outside strict ISO C mode (@option{-ansi}, @option{-std=c89} or
+Outside strict ISO C mode (@option{-ansi}, @option{-std=c90} or
 @option{-std=c99}), the functions
 @code{_exit}, @code{alloca}, @code{bcmp}, @code{bzero},
 @code{dcgettext}, @code{dgettext}, @code{dremf}, @code{dreml},
 @code{drem}, @code{exp10f}, @code{exp10l}, @code{exp10}, @code{ffsll},
 @code{ffsl}, @code{ffs}, @code{fprintf_unlocked},
@@ -6865,11 +6865,11 @@ Outside strict ISO C mode (@option{-ansi
 @code{strndup}, @code{toascii}, @code{y0f}, @code{y0l}, @code{y0},
 @code{y1f}, @code{y1l}, @code{y1}, @code{ynf}, @code{ynl} and
 @code{yn}
 may be handled as built-in functions.
 All these functions have corresponding versions
-prefixed with @code{__builtin_}, which may be used even in strict C89
+prefixed with @code{__builtin_}, which may be used even in strict C90
 mode.
 
 The ISO C99 functions
 @code{_Exit}, @code{acoshf}, @code{acoshl}, @code{acosh}, @code{asinhf},
 @code{asinhl}, @code{asinh}, @code{atanhf}, @code{atanhl}, @code{atanh},
@@ -6909,11 +6909,11 @@ The ISO C99 functions
 @code{scalblnl}, @code{scalbln}, @code{scalbnf}, @code{scalbnl},
 @code{scalbn}, @code{snprintf}, @code{tgammaf}, @code{tgammal},
 @code{tgamma}, @code{truncf}, @code{truncl}, @code{trunc},
 @code{vfscanf}, @code{vscanf}, @code{vsnprintf} and @code{vsscanf}
 are handled as built-in functions
-except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
+except in strict ISO C90 mode (@option{-ansi} or @option{-std=c90}).
 
 There are also built-in versions of the ISO C99 functions
 @code{acosf}, @code{acosl}, @code{asinf}, @code{asinl}, @code{atan2f},
 @code{atan2l}, @code{atanf}, @code{atanl}, @code{ceilf}, @code{ceill},
 @code{cosf}, @code{coshf}, @code{coshl}, @code{cosl}, @code{expf},
@@ -6931,11 +6931,11 @@ The ISO C94 functions
 @code{iswalnum}, @code{iswalpha}, @code{iswcntrl}, @code{iswdigit},
 @code{iswgraph}, @code{iswlower}, @code{iswprint}, @code{iswpunct},
 @code{iswspace}, @code{iswupper}, @code{iswxdigit}, @code{towlower} and
 @code{towupper}
 are handled as built-in functions
-except in strict ISO C90 mode (@option{-ansi} or @option{-std=c89}).
+except in strict ISO C90 mode (@option{-ansi} or @option{-std=c90}).
 
 The ISO C90 functions
 @code{abort}, @code{abs}, @code{acos}, @code{asin}, @code{atan2},
 @code{atan}, @code{calloc}, @code{ceil}, @code{cosh}, @code{cos},
 @code{exit}, @code{exp}, @code{fabs}, @code{floor}, @code{fmod},
Index: gcc/doc/trouble.texi
===================================================================
--- gcc/doc/trouble.texi	(revision 156927)
+++ gcc/doc/trouble.texi	(working copy)
@@ -465,11 +465,11 @@ is meant is an operator and two values, 
 requires that this be treated as erroneous.
 
 A @dfn{preprocessing token} is a @dfn{preprocessing number} if it
 begins with a digit and is followed by letters, underscores, digits,
 periods and @samp{e+}, @samp{e-}, @samp{E+}, @samp{E-}, @samp{p+},
-@samp{p-}, @samp{P+}, or @samp{P-} character sequences.  (In strict C89
+@samp{p-}, @samp{P+}, or @samp{P-} character sequences.  (In strict C90
 mode, the sequences @samp{p+}, @samp{p-}, @samp{P+} and @samp{P-} cannot
 appear in preprocessing numbers.)
 
 To make the above program fragment valid, place whitespace in front of
 the minus sign.  This whitespace will end the preprocessing number.
Index: gcc/doc/cppopts.texi
===================================================================
--- gcc/doc/cppopts.texi	(revision 156927)
+++ gcc/doc/cppopts.texi	(working copy)
@@ -372,16 +372,17 @@ Specify the standard to which the code s
 knows about C and C++ standards; others may be added in the future.
 
 @var{standard}
 may be one of:
 @table @code
-@item iso9899:1990
+@item c90
 @itemx c89
-The ISO C standard from 1990.  @samp{c89} is the customary shorthand for
+@itemx iso9899:1990
+The ISO C standard from 1990.  @samp{c90} is the customary shorthand for
 this version of the standard.
 
-The @option{-ansi} option is equivalent to @option{-std=c89}.
+The @option{-ansi} option is equivalent to @option{-std=c90}.
 
 @item iso9899:199409
 The 1990 C standard, as amended in 1994.
 
 @item iso9899:1999
@@ -389,11 +390,12 @@ The 1990 C standard, as amended in 1994.
 @itemx iso9899:199x
 @itemx c9x
 The revised ISO C standard, published in December 1999.  Before
 publication, this was known as C9X@.
 
-@item gnu89
+@item gnu90
+@itemx gnu89
 The 1990 C standard plus GNU extensions.  This is the default.
 
 @item gnu99
 @itemx gnu9x
 The 1999 C standard plus GNU extensions.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi	(revision 156927)
+++ gcc/doc/invoke.texi	(working copy)
@@ -1423,11 +1423,11 @@ accepts:
 @table @gcctabopt
 @cindex ANSI support
 @cindex ISO support
 @item -ansi
 @opindex ansi
-In C mode, this is equivalent to @samp{-std=c89}. In C++ mode, it is
+In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
 equivalent to @samp{-std=c++98}.
 
 This turns off certain features of GCC that are incompatible with ISO
 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
 such as the @code{asm} and @code{typeof} keywords, and
@@ -1465,32 +1465,33 @@ affected.
 @opindex std
 Determine the language standard. @xref{Standards,,Language Standards
 Supported by GCC}, for details of these standard versions.  This option
 is currently only supported when compiling C or C++.
 
-The compiler can accept several base standards, such as @samp{c89} or
+The compiler can accept several base standards, such as @samp{c90} or
 @samp{c++98}, and GNU dialects of those standards, such as
-@samp{gnu89} or @samp{gnu++98}.  By specifying a base standard, the
+@samp{gnu90} or @samp{gnu++98}.  By specifying a base standard, the
 compiler will accept all programs following that standard and those
 using GNU extensions that do not contradict it.  For example,
-@samp{-std=c89} turns off certain features of GCC that are
+@samp{-std=c90} turns off certain features of GCC that are
 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
 keywords, but not other GNU extensions that do not have a meaning in
 ISO C90, such as omitting the middle term of a @code{?:}
 expression. On the other hand, by specifying a GNU dialect of a
 standard, all features the compiler support are enabled, even when
 those features change the meaning of the base standard and some
 strict-conforming programs may be rejected.  The particular standard
 is used by @option{-pedantic} to identify which features are GNU
 extensions given that version of the standard. For example
-@samp{-std=gnu89 -pedantic} would warn about C++ style @samp{//}
+@samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
 comments, while @samp{-std=gnu99 -pedantic} would not.
 
 A value for this option must be provided; possible values are
 
 @table @samp
 @item c89
+@item c90
 @itemx iso9899:1990
 Support all ISO C90 programs (certain GNU extensions that conflict
 with ISO C90 are disabled). Same as @option{-ansi} for C code.
 
 @item iso9899:199409
@@ -1502,13 +1503,14 @@ ISO C90 as modified in amendment 1.
 @itemx iso9899:199x
 ISO C99.  Note that this standard is not yet fully supported; see
 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
 
-@item gnu89
+@item gnu90
+@itemx gnu89
 GNU dialect of ISO C90 (including some C99 features). This
-is the default for C code.
+is the default for C code. The name @samp{gnu89} is deprecated.
 
 @item gnu99
 @itemx gnu9x
 GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC,
 this will become the default.  The name @samp{gnu9x} is deprecated.
@@ -1545,11 +1547,12 @@ C99 mode.  Using this option is roughly 
 (@pxref{Function Attributes}).
 
 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
 specifies the default behavior).  This option was first supported in
-GCC 4.3.  This option is not supported in C89 or gnu89 mode.
+GCC 4.3.  This option is not supported in @option{-std=c90} or
+@option{-std=gnu90} mode.
 
 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
 in effect for @code{inline} functions.  @xref{Common Predefined
 Macros,,,cpp,The C Preprocessor}.
@@ -2810,11 +2813,11 @@ A feature to report any failure to confo
 some instances, but would require considerable additional work and would
 be quite different from @option{-pedantic}.  We don't have plans to
 support such a feature in the near future.
 
 Where the standard specified with @option{-std} represents a GNU
-extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
+extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
 corresponding @dfn{base standard}, the version of ISO C on which the GNU
 extended dialect is based.  Warnings from @option{-pedantic} are given
 where they are required by the base standard.  (It would not make sense
 for such warnings to be given only for features not in the specified GNU
 C dialect, since by definition the GNU dialects of C include all
@@ -4305,11 +4308,11 @@ maximum'' length specified in the C stan
 generally allow string constants which are much longer than the
 standard's minimum limit, but very portable programs should avoid
 using longer strings.
 
 The limit applies @emph{after} string constant concatenation, and does
-not count the trailing NUL@.  In C89, the limit was 509 characters; in
+not count the trailing NUL@.  In C90, the limit was 509 characters; in
 C99, it was raised to 4095.  C++98 does not specify a normative
 minimum maximum, so we do not diagnose overlength strings in C++@.
 
 This option is implied by @option{-pedantic}, and can be disabled with
 @option{-Wno-overlength-strings}.
@@ -5918,11 +5921,11 @@ release to an another.
 @item -fkeep-inline-functions
 @opindex fkeep-inline-functions
 In C, emit @code{static} functions that are declared @code{inline}
 into the object file, even if the function has been inlined into all
 of its callers.  This switch does not affect functions using the
-@code{extern inline} extension in GNU C89@.  In C++, emit any and all
+@code{extern inline} extension in GNU C90@.  In C++, emit any and all
 inline functions into the object file.
 
 @item -fkeep-static-consts
 @opindex fkeep-static-consts
 Emit variables declared @code{static const} when optimization isn't turned
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 156927)
+++ gcc/doc/install.texi	(working copy)
@@ -4119,15 +4119,15 @@ the CVS repository or applying the patch
 release.
 
 Sun bug 4296832 turns up when compiling X11 headers with GCC 2.95 or
 newer: @command{g++} will complain that types are missing.  These headers
 assume that omitting the type means @code{int}; this assumption worked for
-C89 but is wrong for C++, and is now wrong for C99 also.
+C90 but is wrong for C++, and is now wrong for C99 also.
 
 @command{g++} accepts such (invalid) constructs with the option
 @option{-fpermissive}; it will assume that any missing type is @code{int}
-(as defined by C89).
+(as defined by C90).
 
 There are patches for Solaris 7 (108376-21 or newer for SPARC,
 108377-20 for Intel), and Solaris 8 (108652-24 or newer for SPARC,
 108653-22 for Intel) that fix this bug.
 
Index: gcc/testsuite/gcc.dg/cpp/c90-pedantic.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/c90-pedantic.c	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/c90-pedantic.c	(revision 0)
@@ -0,0 +1,10 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+/* { dg-options "-std=c90 -pedantic" } */
+
+/* This file is for testing the preprocessor in -std=c90 -pedantic mode.
+   Neil Booth, 2 Dec 2000.  */
+
+#if 1LL				/* { dg-warning "long long" } */
+#endif
Index: gcc/testsuite/gcc.dg/cpp/c90.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/c90.c	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/c90.c	(revision 0)
@@ -0,0 +1,10 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.  */
+
+/* { dg-do preprocess } */
+/* { dg-options "-std=c90" } */
+
+/* This file is for testing the preprocessor in -std=c90 mode.
+   Neil Booth, 2 Dec 2000.  */
+
+#if 1LL
+#endif
Index: gcc/testsuite/gcc.dg/gnu90-const-expr-1.c
===================================================================
--- gcc/testsuite/gcc.dg/gnu90-const-expr-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/gnu90-const-expr-1.c	(revision 0)
@@ -0,0 +1,56 @@
+/* Test for constant expressions: GNU extensions.  */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu90 -pedantic-errors" } */
+
+int n;
+
+void
+f (void)
+{
+  int i = 0;
+  int a[n]; /* { dg-error "ISO C90 forbids variable length array" } */
+  enum e1 {
+    /* Integer constant expressions may not contain statement
+       expressions (not a permitted operand).  */
+    E1 = (1 ? 0 : ({ 0; })), /* { dg-error "constant expression" } */
+    /* { dg-error "ISO C forbids braced-groups" "ISO" { target *-*-* } 16 } */
+    /* Real and imaginary parts act like other arithmetic
+       operators.  */
+    E2 = __real__ (1 ? 0 : i++), /* { dg-error "constant expression" } */
+    E3 = __real__ 0,
+    E4 = __imag__ (1 ? 0 : i++), /* { dg-error "constant" } */
+    E5 = __imag__ 0,
+    /* __alignof__ always constant.  */
+    E6 = __alignof__ (int[n]), /* { dg-error "ISO C90 forbids variable length array" } */
+    E7 = __alignof__ (a),
+    /* __extension__ ignored for constant expression purposes.  */
+    E8 = __extension__ (1 ? 0 : i++), /* { dg-error "constant expression" } */
+    E9 = __extension__ 0,
+    /* Conditional expressions with omitted arguments act like the
+       standard type.  */ 
+    E10 = (1 ? : i++), /* { dg-error "constant expression" } */
+    /* { dg-error "ISO C forbids omitting" "ISO" { target *-*-* } 32 } */
+    E11 = (1 ? : 0) /* { dg-error "ISO C forbids omitting" } */
+  };
+  enum e2 {
+    /* Complex integer constants may be cast directly to integer
+       types, but not after further arithmetic on them.  */
+    F1 = (int) (_Complex int) 2i, /* { dg-error "constant expression" } */
+    /* { dg-error "complex" "complex" { target *-*-* } 39 } */
+    /* { dg-error "imaginary" "imaginary" { target *-*-* } 39 } */
+    F2 = (int) +2i, /* { dg-error "constant expression" } */
+    /* { dg-error "imaginary" "ISO" { target *-*-* } 42 } */
+    F3 = (int) (1 + 2i), /* { dg-error "constant expression" } */
+    /* { dg-error "imaginary" "ISO" { target *-*-* } 44 } */
+    F4 = (int) 2i /* { dg-error "imaginary" } */
+  };
+  static double dr = __real__ (1.0 + 2.0i);
+  /* { dg-error "imaginary" "ISO" { target *-*-* } 48 } */
+  static double di = __imag__ (1.0 + 2.0i);
+  /* { dg-error "imaginary" "ISO" { target *-*-* } 50 } */
+  /* Statement expressions allowed in unevaluated subexpressions in
+     initializers in gnu99 but not gnu89.  */
+  static int j = (1 ? 0 : ({ 0; })); /* { dg-error "constant expression" } */
+  /* { dg-error "braced" "ISO" { target *-*-* } 54 } */
+}
Index: gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90.c
===================================================================
--- gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90.c	(revision 0)
+++ gcc/testsuite/gcc.dg/Woverlength-strings-pedantic-c90.c	(revision 0)
@@ -0,0 +1,19 @@
+/* -Woverlength-strings complains about string constants which are too long
+   for the C standard's "minimum maximum" limits.  It is off by default,
+   but implied by -pedantic.  */
+
+/* { dg-options "-std=c90 -pedantic" } */
+
+#define TEN "xxxxxxxxxx"
+#define HUN TEN TEN TEN TEN TEN  TEN TEN TEN TEN TEN
+#define THO HUN HUN HUN HUN HUN  HUN HUN HUN HUN HUN
+
+/* C89's minimum-maximum is 509. */
+const char x510[] = HUN HUN HUN HUN HUN TEN; /* { dg-warning "greater than" } */
+
+/* C99's minimum-maximum is 4095.  */
+const char x4096[] =
+  THO THO THO THO     /* 4000 */
+  TEN TEN TEN TEN TEN /* 4050 */
+  TEN TEN TEN TEN     /* 4090 */
+  "123456";  /* { dg-warning "greater than" } */
Index: gcc/c.opt
===================================================================
--- gcc/c.opt	(revision 156927)
+++ gcc/c.opt	(working copy)
@@ -956,10 +956,14 @@ future releases of GCC.
 
 std=c89
 C ObjC
 Conform to the ISO 1990 C standard
 
+std=c90
+C ObjC
+Conform to the ISO 1990 C standard
+
 std=c99
 C ObjC
 Conform to the ISO 1999 C standard
 
 std=c9x
@@ -979,10 +983,14 @@ are experimental and may be removed in f
 
 std=gnu89
 C ObjC
 Conform to the ISO 1990 C standard with GNU extensions
 
+std=gnu90
+C ObjC
+Conform to the ISO 1990 C standard with GNU extensions
+
 std=gnu99
 C ObjC
 Conform to the ISO 1999 C standard with GNU extensions
 
 std=gnu9x
Index: gcc/c-opts.c
===================================================================
--- gcc/c-opts.c	(revision 156927)
+++ gcc/c-opts.c	(working copy)
@@ -948,17 +948,19 @@ c_common_handle_option (size_t scode, co
       if (!preprocessing_asm_p)
 	set_std_cxx0x (code == OPT_std_c__0x /* ISO */);
       break;
 
     case OPT_std_c89:
+    case OPT_std_c90:
     case OPT_std_iso9899_1990:
     case OPT_std_iso9899_199409:
       if (!preprocessing_asm_p)
 	set_std_c89 (code == OPT_std_iso9899_199409 /* c94 */, true /* ISO */);
       break;
 
     case OPT_std_gnu89:
+    case OPT_std_gnu90:
       if (!preprocessing_asm_p)
 	set_std_c89 (false /* c94 */, false /* ISO */);
       break;
 
     case OPT_std_c99:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]