c-decl.c (finish_declspecs): When _Sat is used without _Fract or _Accum, set the...
authorNigel Stephens <nigel@mips.com>
Fri, 21 Sep 2007 00:50:37 +0000 (00:50 +0000)
committerChao-ying Fu <chaoyingfu@gcc.gnu.org>
Fri, 21 Sep 2007 00:50:37 +0000 (00:50 +0000)
* c-decl.c (finish_declspecs): When _Sat is used without
_Fract or _Accum, set the default type to cts_fract.
This avoids a warning of "type defaults to int".

Co-Authored-By: Chao-ying Fu <fu@mips.com>
From-SVN: r128642

gcc/ChangeLog
gcc/c-decl.c

index 99d77b157144917187d2b67f26e0a94b2160711a..1c05e3451590f09082857c92fad628245581385d 100644 (file)
@@ -1,3 +1,10 @@
+2007-09-20  Nigel Stephens  <nigel@mips.com>
+           Chao-ying Fu  <fu@mips.com>
+
+       * c-decl.c (finish_declspecs): When _Sat is used without
+       _Fract or _Accum, set the default type to cts_fract.
+       This avoids a warning of "type defaults to int".
+
 2007-09-20  Joseph Myers  <joseph@codesourcery.com>
 
        * c-decl.c (check_bitfield_type_and_width): Don't allow _Bool
index 493a57ed714c6fea2d9b59f955d7dd842cbc703b..1152253e2e2d0fbc0679ec0d181a596cf03174ea 100644 (file)
@@ -7767,9 +7767,12 @@ finish_declspecs (struct c_declspecs *specs)
   if (specs->typespec_word == cts_none)
     {
       if (specs->saturating_p)
-       error ("%<_Sat%> is used without %<_Fract%> or %<_Accum%>");
-      if (specs->long_p || specs->short_p
-         || specs->signed_p || specs->unsigned_p)
+       {
+         error ("%<_Sat%> is used without %<_Fract%> or %<_Accum%>");
+         specs->typespec_word = cts_fract;
+       }
+      else if (specs->long_p || specs->short_p
+              || specs->signed_p || specs->unsigned_p)
        {
          specs->typespec_word = cts_int;
        }