aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2014-03-25 21:16:13 -0700
committerPaul Eggert2014-03-25 21:16:13 -0700
commitcefcfbcc1b7865dafd615c0fe42e62dbe2660ddd (patch)
tree9e0b51810e1fd2ce97f50a3af8540ecc0f47597c /lib
parentb18d7820f32694a5f386f2a334b81c2fcd9edf0a (diff)
downloademacs-cefcfbcc1b7865dafd615c0fe42e62dbe2660ddd.tar.gz
emacs-cefcfbcc1b7865dafd615c0fe42e62dbe2660ddd.zip
Merge from gnulib.
This incorporates: 2014-03-26 strftime: wrap macros in "do {...} while(0)" * lib/strftime.c, doc/misc/texinfo.tex: Update from gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/strftime.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/lib/strftime.c b/lib/strftime.c
index c1ec41422bd..857cca568b8 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -681,24 +681,44 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
681 switch (format_char) 681 switch (format_char)
682 { 682 {
683#define DO_NUMBER(d, v) \ 683#define DO_NUMBER(d, v) \
684 digits = d; \ 684 do \
685 number_value = v; goto do_number 685 { \
686 digits = d; \
687 number_value = v; \
688 goto do_number; \
689 } \
690 while (0)
686#define DO_SIGNED_NUMBER(d, negative, v) \ 691#define DO_SIGNED_NUMBER(d, negative, v) \
687 digits = d; \ 692 do \
688 negative_number = negative; \ 693 { \
689 u_number_value = v; goto do_signed_number 694 digits = d; \
695 negative_number = negative; \
696 u_number_value = v; \
697 goto do_signed_number; \
698 } \
699 while (0)
690 700
691 /* The mask is not what you might think. 701 /* The mask is not what you might think.
692 When the ordinal i'th bit is set, insert a colon 702 When the ordinal i'th bit is set, insert a colon
693 before the i'th digit of the time zone representation. */ 703 before the i'th digit of the time zone representation. */
694#define DO_TZ_OFFSET(d, negative, mask, v) \ 704#define DO_TZ_OFFSET(d, negative, mask, v) \
695 digits = d; \ 705 do \
696 negative_number = negative; \ 706 { \
697 tz_colon_mask = mask; \ 707 digits = d; \
698 u_number_value = v; goto do_tz_offset 708 negative_number = negative; \
709 tz_colon_mask = mask; \
710 u_number_value = v; \
711 goto do_tz_offset; \
712 } \
713 while (0)
699#define DO_NUMBER_SPACEPAD(d, v) \ 714#define DO_NUMBER_SPACEPAD(d, v) \
700 digits = d; \ 715 do \
701 number_value = v; goto do_number_spacepad 716 { \
717 digits = d; \
718 number_value = v; \
719 goto do_number_spacepad; \
720 } \
721 while (0)
702 722
703 case L_('%'): 723 case L_('%'):
704 if (modifier != 0) 724 if (modifier != 0)
@@ -1265,9 +1285,9 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
1265 } 1285 }
1266 if (modifier == L_('O')) 1286 if (modifier == L_('O'))
1267 goto bad_format; 1287 goto bad_format;
1268 else 1288
1269 DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE, 1289 DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE,
1270 tp->tm_year + (unsigned int) TM_YEAR_BASE); 1290 tp->tm_year + (unsigned int) TM_YEAR_BASE);
1271 1291
1272 case L_('y'): 1292 case L_('y'):
1273 if (modifier == L_('E')) 1293 if (modifier == L_('E'))