summaryrefslogtreecommitdiff
path: root/lib/nstrftime.c
Commit message (Collapse)AuthorAgeFilesLines
* nstrftime, time_rz: Avoid using an obsolete Autoconf macro.Bruno Haible2021-01-041-3/+3
| | | | | | | | | | | Reported by Mike Gran <spk121@yahoo.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00067.html>. * lib/time-internal.h: Test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE. * lib/time_rz.c: Likewise. * lib/nstrftime.c: Set and test HAVE_STRUCT_TM_TM_ZONE, not HAVE_TM_ZONE. * m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Update comments.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* nstrftime: Guide inlining also on clang.Bruno Haible2020-08-161-1/+1
| | | | * lib/nstrftime.c (iso_week_days): Inline also on clang.
* nstrftime: be more predictable about errnoPaul Eggert2020-08-151-1/+13
| | | | | | | | | | | | This aligns nstrftime better with draft POSIX 202x strftime. * lib/nstrftime.c: Include errno.h. (width_add, __strftime_internal): Set errno on failure, and preserve it on success. Check for mktime_z failure. * modules/nstrftime (Depends-on): Add errno. * modules/nstrftime-tests (Depends-on): Add atoll, intprops. * tests/test-nstrftime.c: Include intprops.h, limits.h. (errno_test): New test function. (main): Call it.
* nstrftime: Assume tzset exists.Bruno Haible2020-08-141-4/+2
| | | | | | * lib/nstrftime.c (HAVE_TZSET): Remove macro. (__strftime_internal): Test my_strftime, not HAVE_TZSET. * m4/nstrftime.m4 (gl_FUNC_GNU_STRFTIME): Don't test for tzset.
* tzset: Remove workaround for Solaris 2.6.Bruno Haible2020-07-261-9/+0
| | | | | | | | | | | | | | * m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Remove macro. (gl_FUNC_TZSET): Don't invoke it. Don't define TZSET_CLOBBERS_LOCALTIME. Don't require gl_LOCALTIME_BUFFER_DEFAULTS. * lib/localtime-buffer.h: Don't test TZSET_CLOBBERS_LOCALTIME. * lib/localtime-buffer.c: Likewise. * lib/localtime.c: Likewise. * lib/tzset.c: Don't include localtime-buffer.h. (tzset): Don't test TZSET_CLOBBERS_LOCALTIME. * lib/nstrftime.c (__strftime_internal): Assume HAVE_RUN_TZSET_TEST is 1. * modules/tzset (Depends-on): Remove localtime-buffer.
* attribute: minor fixupsPaul Eggert2020-05-031-1/+1
| | | | | Suggested by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2020-05/msg00049.html
* attribute: new modulePaul Eggert2020-05-031-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies use of GCC and C2X attributes like ‘deprecated’. * MODULES.html.sh: Add attribute. * doc/attribute.texi, lib/attribute.h, modules/attribute: New files. * doc/gnulib.texi (Particular Modules): Add Attributes. * lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c: * lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c: * lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c: * lib/vasnprintf.c: Include attribute.h, and let it define FALLTHROUGH. * lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro. * lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X. * lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY. This is a copy since Gawk doesn’t use Gnulib. * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that is incompatible with gl_COMMON_BODY’s. All uses changed. * lib/fts.c: Include attribte.h, for FALLTHROUGH. Keep the existing FALLTHROUGH definition since Glibc might use it, and it does no harm to Gnulib’s FALLTHROUGH. * lib/fts_.h, lib/inttostr.h: (__GNUC_PREREQ): Remove; no longer needed. (__attribute_warn_unused_result__): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h: * lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed __attribute__ ((__warn_unused_result__)), for forward compatibility to C2X. * lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. (_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it. * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses replaced by gl_COMMON_BODY’s implementation, which has a slightly different signature. * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/unused-parameter.h (_GL_UNUSED_PARAMETER): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED. No doubt all uses should be replaced, at some point. * m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro. (_Noreturn): Use it. (_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE) (_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL) (_GL_ATTRIBUTE_COLD) (_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR) (_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE) (_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT) (_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS) (_GL_ATTRIBUTE_MAYBE_UNUSED) (_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE) (_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING) (_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE) (_GL_ATTRIBUTE_SENTINEL): New macros. * modules/backup-rename, modules/backupfile, modules/c-vasnprintf: * modules/fnmatch, modules/freopen-safer, modules/fts: * modules/mbrtoc32, modules/mbrtowc, modules/nstrftime: * modules/quotearg, modules/savewd: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf: * modules/unistdio/ulc-vasnprintf: * modules/unistr/u8-uctomb, modules/vasnprintf: (Depends-on:): Add attribute module.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* nstrftime: tweak division performancePaul Eggert2019-12-231-6/+8
| | | | | * lib/nstrftime.c (SHR, tm_diff, __strftime_internal): Redo with neither ‘%’ nor conditional branches.
* nstrftime: avoid a shadowing warningJim Meyering2019-12-191-2/+2
| | | | | * lib/nstrftime.c (libc_hidden_def): Rename inner "i" to "j", to avoid shadowing an "i" declared hundreds of lines above.
* nstrftime: better width support for %N, %zPaul Eggert2019-12-061-79/+59
| | | | | | | | | | | | | | * lib/nstrftime.c (width_add, width_add1, width_cpy): New macros, which generalize ‘add’, ‘add1’, ‘cpy’ by adding a new WIDTH parameter. (add, add1, cpy): Use these macros. (width_add): Do not treat digits == 0 as a special case, do not pad if padding is ‘-’, and do not use a negative width. (__strftime_internal): Redo formatting of nanoseconds and numeric timezones to avoid buffer misuse in unusual cases, and so that widths make more sense. Add support for widths greater than 9 to the %N format; they are zero filled on the right. * tests/test-nstrftime.c (posixtm_test): Add a %12N test.
* nstrftime: speed up integer overflow checkingPaul Eggert2019-10-231-15/+4
| | | | | | | | * lib/nstrftime.c: Include intprops.h. (INT_STRLEN_BOUND): Remove, as we can use intprops.h’s defn. (__strftime_internal): Use INT_MULTIPLY_WRAPV and INT_ADD_WRAPV instead of doing it by hand. * modules/nstrftime (Depends-on): Add intprops.
* nstrftime: support the ‘+’ flagPaul Eggert2019-02-241-28/+56
| | | | | | | * lib/nstrftime.c (add, __strftime_internal): Add support for the ‘+’ flag introduced in POSIX.1-2017. (__strftime_internal): New arg ‘width’. All uses changed. (DO_YEARISH, DO_MAYBE_SIGNED_NUMBER): New macros.
* nstrftime: tweak arg orderPaul Eggert2019-02-231-9/+9
| | | | | | * lib/nstrftime.c (__strftime_internal): Interchange arg order. All callers changed. Suggested by TAMUKI Shoichi in: https://lists.gnu.org/r/bug-gnulib/2019-02/msg00052.html
* nstrftime: merge glibc strftime changesPaul Eggert2019-02-211-11/+16
| | | | | | | | | | | This incorporates: 2019-02-11 Fix a few whitespace arrangement inconsistencies 2019-01-24 strftime: Pass flags from "%EY" to "%Ey" [BZ #24096] 2019-01-24 Set the default width of "%Ey" to 2 [BZ #23758] 2019-01-11 strftime: use the "L_" macro with character literals * lib/nstrftime.c (__strftime_internal): New arg yr_spec. All callers changed. Default width of %Ey is now 2. This is needed for proper handling of Japanese dates starting on 2019-05-01.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* nstrftime: simplify test for mktime failurePaul Eggert2018-11-031-20/+2
| | | | * lib/nstrftime.c (__strftime_internal): Simplify.
* Merge strftime.c changes from glibcPaul Eggert2018-01-231-5/+19
| | | | | | | | | | | | This incorporates: 2017-11-14 [BZ #10871] Implement alternative month names 2017-11-14 [BZ #10871] Abbreviated alternative month names (%Ob) 2017-06-20 Use locale_t, not __locale_t, throughout glibc * lib/nstrftime.c (ABALTMON_1) [!COMPILE_WIDE]: New macro. (LOCALE_PARAM) [_LIBC && USE_IN_EXTENDED_LOCALE_MODEL]: Use locale_t, not __locale_t. (a_altmonth, f_altmonth, aam_len) [_NL_CURRENT]: New macros. (__strftime_internal): Add support for alternate months.
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* Rename module 'strftime' to 'nstrftime'.Bruno Haible2017-07-241-0/+1506
* m4/nstrftime.m4: Renamed from m4/strftime.m4. * lib/nstrftime.c: Renamed from lib/strftime.c. * modules/nstrftime: Renamed from modules/strftime. (Files, Makefile.am): Update. * tests/test-nstrftime.c: Renamed from tests/test-strftime.c. Fix comment. * modules/nstrftime-tests: Renamed from modules/strftime-tests. (Files, Makefile.am): Update. * modules/strftime: New file, an obsolete indirection. * doc/posix-functions/strftime.texi: Update reference. * config/srclist.txt: Update info.