c-common.c (time_char_table): Allow %#b and %#h.
authorJoseph Myers <jsm28@cam.ac.uk>
Thu, 7 Sep 2000 17:20:04 +0000 (18:20 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Thu, 7 Sep 2000 17:20:04 +0000 (18:20 +0100)
* c-common.c (time_char_table): Allow %#b and %#h.

testsuite:
* gcc.dg/format-ext-3.c: Test %#b and %#h as formats that should
be accepted.

From-SVN: r36241

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/format-ext-3.c

index 0cbe307..20a9fff 100644 (file)
@@ -1,3 +1,7 @@
+2000-09-07  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * c-common.c (time_char_table): Allow %#b and %#h.
+
 2000-09-07 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
 
        * reorg.c (find_end_label): If the basic block reorder pass moves the
index fc8476a..c53ee1a 100644 (file)
@@ -1420,8 +1420,7 @@ static const format_char_info scan_char_table[] =
 static format_char_info time_char_table[] =
 {
   /* C89 conversion specifiers.  */
-  { "ABZa",            0, STD_C89, NOLENGTHS, "^#" },
-  { "b",               0, STD_C89, NOLENGTHS, "^" },
+  { "ABZab",           0, STD_C89, NOLENGTHS, "^#" },
   { "cx",              0, STD_C89, NOLENGTHS, "3E" },
   { "HIMSUWdmw",       0, STD_C89, NOLENGTHS, "-_0Ow" },
   { "j",               0, STD_C89, NOLENGTHS, "-_0Oow" },
@@ -1437,7 +1436,7 @@ static format_char_info time_char_table[] =
   { "FRTnrt",          0, STD_C99, NOLENGTHS, "" },
   { "g",               0, STD_C99, NOLENGTHS, "2Oo-_0w" },
   { "G",               0, STD_C99, NOLENGTHS, "-_0Oow" },
-  { "h",               0, STD_C99, NOLENGTHS, "^" },
+  { "h",               0, STD_C99, NOLENGTHS, "^#" },
   { "z",               0, STD_C99, NOLENGTHS, "Oo" },
   /* GNU conversion specifiers.  */
   { "kls",             0, STD_EXT, NOLENGTHS, "-_0Ow" },
index 2758c17..ff26a52 100644 (file)
@@ -1,3 +1,8 @@
+2000-09-07  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * gcc.dg/format-ext-3.c: Test %#b and %#h as formats that should
+       be accepted.
+
 2000-09-07  Catherine Moore  <clm@redhat.com>
 
         * gcc.c-torture/execute/unroll-1.c: New test.
index 54ae6f3..27f2f7e 100644 (file)
@@ -121,12 +121,10 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%0P", tp); /* { dg-warning "flag" "bad %P" } */
   /* The "^" and "#" flags control the case of the output.
      ^ (uppercase) makes sense on aAbBhZ; # (change case) makes sense
-     on the same (though glibc ignores it on bh for some reason; for now our
-     implementation in GCC follows glibc) and on p.
+     on the same and on p.
   */
-  strftime (s, m, "%^a%#a%^A%#A%^b%^B%#B%^h%^Z%#Z%#p", tp);
+  strftime (s, m, "%^a%#a%^A%#A%^b%#b%^B%#B%^h%#h%^Z%#Z%#p", tp);
   /* Bad usages.  */
-  strftime (s, m, "%#b", tp); /* { dg-warning "flag" "bad %b" } */
   strftime (s, m, "%^C", tp); /* { dg-warning "flag" "bad %C" } */
   strftime (s, m, "%#C", tp); /* { dg-warning "flag" "bad %C" } */
   strftime (s, m, "%^d", tp); /* { dg-warning "flag" "bad %d" } */
@@ -137,7 +135,6 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%#F", tp); /* { dg-warning "flag" "bad %F" } */
   strftime (s, m, "%^G", tp); /* { dg-warning "flag" "bad %G" } */
   strftime (s, m, "%#G", tp); /* { dg-warning "flag" "bad %G" } */
-  strftime (s, m, "%#h", tp); /* { dg-warning "flag" "bad %h" } */
   strftime (s, m, "%^H", tp); /* { dg-warning "flag" "bad %H" } */
   strftime (s, m, "%#H", tp); /* { dg-warning "flag" "bad %H" } */
   strftime (s, m, "%^I", tp); /* { dg-warning "flag" "bad %I" } */
@@ -196,6 +193,9 @@ foo (char *s, size_t m, const struct tm *tp)
   strftime (s, m, "%#x", tp); /* { dg-warning "flag" "bad %x" } */
   strftime (s, m, "%^y", tp); /* { dg-warning "flag" "bad %y" } */
   strftime (s, m, "%#y", tp); /* { dg-warning "flag" "bad %y" } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 186 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 187 } */
+  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 188 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 189 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 190 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 191 } */
@@ -203,9 +203,6 @@ foo (char *s, size_t m, const struct tm *tp)
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 193 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 194 } */
   /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 195 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 196 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 197 } */
-  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 198 } */
   /* GCC also accepts the glibc format extensions %P, %k, %l, %s.  */
   strftime (s, m, "%P%k%l%s", tp);
   /* GCC also accepts the glibc extension of the "O" modifier on some