c-common.c (print_char_table): Use the unpromoted type for lengths "h" and "hh" with...
authorJoseph Myers <jsm28@cam.ac.uk>
Thu, 12 Oct 2000 07:26:20 +0000 (08:26 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Thu, 12 Oct 2000 07:26:20 +0000 (08:26 +0100)
* c-common.c (print_char_table): Use the unpromoted type for
lengths "h" and "hh" with conversions dioxXu.
(check_format_types): Apply the default argument promotions where
the wanted type is not a pointer target.

From-SVN: r36841

gcc/ChangeLog
gcc/c-common.c

index 2d4e90b29165e5e1184d4bd5bc9cf6ac96ee7b7b..9f7f5a005b487ff9cefc827f5dc4f77ae0306b8a 100644 (file)
@@ -1,3 +1,10 @@
+2000-10-12  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * c-common.c (print_char_table): Use the unpromoted type for
+       lengths "h" and "hh" with conversions dioxXu.
+       (check_format_types): Apply the default argument promotions where
+       the wanted type is not a pointer target.
+
 2000-10-11  Michael Meeks  <mmeeks@gnu.org>
             Joseph S. Myers  <jsm28@cam.ac.uk>
 
index 7efca93fea0021dcfb883d1ebe13844aa3a65f39..0e77cdd4e9f5e71da6f22248a207c907a4b1e096 100644 (file)
@@ -1603,9 +1603,9 @@ static const format_flag_pair strftime_flag_pairs[] =
 static const format_char_info print_char_table[] =
 {
   /* C89 conversion specifiers.  */
-  { "di",  0, STD_C89, { T89_I,   T99_I,   T89_I,   T89_L,   T99_LL,  TEX_LL,  T99_SST, T99_PD,  T99_IM  }, "-wp0 +'I", "i" },
-  { "oxX", 0, STD_C89, { T89_UI,  T99_UI,  T89_UI,  T89_UL,  T99_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0#",    "i" },
-  { "u",   0, STD_C89, { T89_UI,  T99_UI,  T89_UI,  T89_UL,  T99_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0'I",   "i" },
+  { "di",  0, STD_C89, { T89_I,   T99_SC,  T89_S,   T89_L,   T99_LL,  TEX_LL,  T99_SST, T99_PD,  T99_IM  }, "-wp0 +'I", "i" },
+  { "oxX", 0, STD_C89, { T89_UI,  T99_UC,  T89_US,  T89_UL,  T99_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0#",    "i" },
+  { "u",   0, STD_C89, { T89_UI,  T99_UC,  T89_US,  T89_UL,  T99_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0'I",   "i" },
   { "fgG", 0, STD_C89, { T89_D,   BADLEN,  BADLEN,  T99_D,   BADLEN,  T89_LD,  BADLEN,  BADLEN,  BADLEN  }, "-wp0 +#'", ""  },
   { "eE",  0, STD_C89, { T89_D,   BADLEN,  BADLEN,  T99_D,   BADLEN,  T89_LD,  BADLEN,  BADLEN,  BADLEN  }, "-wp0 +#",  ""  },
   { "c",   0, STD_C89, { T89_I,   BADLEN,  BADLEN,  T94_WI,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-w",       ""  },
@@ -2864,6 +2864,7 @@ check_format_types (status, types)
       tree cur_type;
       tree orig_cur_type;
       tree wanted_type;
+      tree promoted_type;
       int arg_num;
       int i;
       int char_type_flag;
@@ -2881,6 +2882,13 @@ check_format_types (status, types)
       if (wanted_type == void_type_node && types->pointer_count == 0)
        abort ();
 
+      if (types->pointer_count == 0)
+       {
+         promoted_type = simple_type_promotes_to (wanted_type);
+         if (promoted_type != NULL_TREE)
+           wanted_type = promoted_type;
+       }
+
       STRIP_NOPS (cur_param);
 
       /* Check the types of any additional pointer arguments