diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/c-ctype.h | 20 | ||||
| -rw-r--r-- | lib/strftime.c | 12 | ||||
| -rw-r--r-- | lib/time-internal.h | 4 | ||||
| -rw-r--r-- | lib/verify.h | 7 |
4 files changed, 24 insertions, 19 deletions
diff --git a/lib/c-ctype.h b/lib/c-ctype.h index faf21581ca0..bcdba6b9962 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h | |||
| @@ -115,16 +115,16 @@ extern "C" { | |||
| 115 | 115 | ||
| 116 | /* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ | 116 | /* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ |
| 117 | 117 | ||
| 118 | #define _C_CTYPE_LOWER_A_THRU_F_N(n) \ | 118 | #define _C_CTYPE_LOWER_A_THRU_F_N(N) \ |
| 119 | case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ | 119 | case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \ |
| 120 | case 'e' + (n): case 'f' + (n) | 120 | case 'e' + (N): case 'f' + (N) |
| 121 | #define _C_CTYPE_LOWER_N(n) \ | 121 | #define _C_CTYPE_LOWER_N(N) \ |
| 122 | _C_CTYPE_LOWER_A_THRU_F_N(n): \ | 122 | _C_CTYPE_LOWER_A_THRU_F_N(N): \ |
| 123 | case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \ | 123 | case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \ |
| 124 | case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \ | 124 | case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \ |
| 125 | case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \ | 125 | case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \ |
| 126 | case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \ | 126 | case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \ |
| 127 | case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n) | 127 | case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N) |
| 128 | 128 | ||
| 129 | /* Cases for hex letters, digits, lower, punct, and upper. */ | 129 | /* Cases for hex letters, digits, lower, punct, and upper. */ |
| 130 | 130 | ||
diff --git a/lib/strftime.c b/lib/strftime.c index 9aabcc6748c..e4d78ef7011 100644 --- a/lib/strftime.c +++ b/lib/strftime.c | |||
| @@ -739,11 +739,10 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 739 | /* The mask is not what you might think. | 739 | /* The mask is not what you might think. |
| 740 | When the ordinal i'th bit is set, insert a colon | 740 | When the ordinal i'th bit is set, insert a colon |
| 741 | before the i'th digit of the time zone representation. */ | 741 | before the i'th digit of the time zone representation. */ |
| 742 | #define DO_TZ_OFFSET(d, negative, mask, v) \ | 742 | #define DO_TZ_OFFSET(d, mask, v) \ |
| 743 | do \ | 743 | do \ |
| 744 | { \ | 744 | { \ |
| 745 | digits = d; \ | 745 | digits = d; \ |
| 746 | negative_number = negative; \ | ||
| 747 | tz_colon_mask = mask; \ | 746 | tz_colon_mask = mask; \ |
| 748 | u_number_value = v; \ | 747 | u_number_value = v; \ |
| 749 | goto do_tz_offset; \ | 748 | goto do_tz_offset; \ |
| @@ -1444,6 +1443,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1444 | } | 1443 | } |
| 1445 | #endif | 1444 | #endif |
| 1446 | 1445 | ||
| 1446 | negative_number = diff < 0 || (diff == 0 && *zone == '-'); | ||
| 1447 | hour_diff = diff / 60 / 60; | 1447 | hour_diff = diff / 60 / 60; |
| 1448 | min_diff = diff / 60 % 60; | 1448 | min_diff = diff / 60 % 60; |
| 1449 | sec_diff = diff % 60; | 1449 | sec_diff = diff % 60; |
| @@ -1451,13 +1451,13 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1451 | switch (colons) | 1451 | switch (colons) |
| 1452 | { | 1452 | { |
| 1453 | case 0: /* +hhmm */ | 1453 | case 0: /* +hhmm */ |
| 1454 | DO_TZ_OFFSET (5, diff < 0, 0, hour_diff * 100 + min_diff); | 1454 | DO_TZ_OFFSET (5, 0, hour_diff * 100 + min_diff); |
| 1455 | 1455 | ||
| 1456 | case 1: tz_hh_mm: /* +hh:mm */ | 1456 | case 1: tz_hh_mm: /* +hh:mm */ |
| 1457 | DO_TZ_OFFSET (6, diff < 0, 04, hour_diff * 100 + min_diff); | 1457 | DO_TZ_OFFSET (6, 04, hour_diff * 100 + min_diff); |
| 1458 | 1458 | ||
| 1459 | case 2: tz_hh_mm_ss: /* +hh:mm:ss */ | 1459 | case 2: tz_hh_mm_ss: /* +hh:mm:ss */ |
| 1460 | DO_TZ_OFFSET (9, diff < 0, 024, | 1460 | DO_TZ_OFFSET (9, 024, |
| 1461 | hour_diff * 10000 + min_diff * 100 + sec_diff); | 1461 | hour_diff * 10000 + min_diff * 100 + sec_diff); |
| 1462 | 1462 | ||
| 1463 | case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */ | 1463 | case 3: /* +hh if possible, else +hh:mm, else +hh:mm:ss */ |
| @@ -1465,7 +1465,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) | |||
| 1465 | goto tz_hh_mm_ss; | 1465 | goto tz_hh_mm_ss; |
| 1466 | if (min_diff != 0) | 1466 | if (min_diff != 0) |
| 1467 | goto tz_hh_mm; | 1467 | goto tz_hh_mm; |
| 1468 | DO_TZ_OFFSET (3, diff < 0, 0, hour_diff); | 1468 | DO_TZ_OFFSET (3, 0, hour_diff); |
| 1469 | 1469 | ||
| 1470 | default: | 1470 | default: |
| 1471 | goto bad_format; | 1471 | goto bad_format; |
diff --git a/lib/time-internal.h b/lib/time-internal.h index 79cb5621991..bf22834b2e1 100644 --- a/lib/time-internal.h +++ b/lib/time-internal.h | |||
| @@ -38,8 +38,8 @@ struct tm_zone | |||
| 38 | /* A sequence of null-terminated strings packed next to each other. | 38 | /* A sequence of null-terminated strings packed next to each other. |
| 39 | The strings are followed by an extra null byte. If TZ_IS_SET, | 39 | The strings are followed by an extra null byte. If TZ_IS_SET, |
| 40 | there must be at least one string and the first string (which is | 40 | there must be at least one string and the first string (which is |
| 41 | actually a TZ environment value value) may be empty. Otherwise | 41 | actually a TZ environment value) may be empty. Otherwise all |
| 42 | all strings must be nonempty. | 42 | strings must be nonempty. |
| 43 | 43 | ||
| 44 | Abbreviations are stored here because otherwise the values of | 44 | Abbreviations are stored here because otherwise the values of |
| 45 | tm_zone and/or tzname would be dead after changing TZ and calling | 45 | tm_zone and/or tzname would be dead after changing TZ and calling |
diff --git a/lib/verify.h b/lib/verify.h index dcaf7cab938..dcba9c8cb0a 100644 --- a/lib/verify.h +++ b/lib/verify.h | |||
| @@ -248,7 +248,12 @@ template <int w> | |||
| 248 | /* Verify requirement R at compile-time, as a declaration without a | 248 | /* Verify requirement R at compile-time, as a declaration without a |
| 249 | trailing ';'. */ | 249 | trailing ';'. */ |
| 250 | 250 | ||
| 251 | #define verify(R) _GL_VERIFY (R, "verify (" #R ")") | 251 | #ifdef __GNUC__ |
| 252 | # define verify(R) _GL_VERIFY (R, "verify (" #R ")") | ||
| 253 | #else | ||
| 254 | /* PGI barfs if R is long. Play it safe. */ | ||
| 255 | # define verify(R) _GL_VERIFY (R, "verify (...)") | ||
| 256 | #endif | ||
| 252 | 257 | ||
| 253 | #ifndef __has_builtin | 258 | #ifndef __has_builtin |
| 254 | # define __has_builtin(x) 0 | 259 | # define __has_builtin(x) 0 |