commit 713eece307bf48717b868f21789eed8160ada5ba (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sat Feb 2 13:23:04 2019 -0800 Support (locale-info 'paper) on GNU platforms * configure.ac (HAVE_LANGINFO__NL_PAPER_WIDTH): New macro. * src/fns.c (Flocale_info) [HAVE_LANGINFO__NL_PAPER_WIDTH]: Get paper width and height from locale. diff --git a/configure.ac b/configure.ac index 0259c82258..58579008f3 100644 --- a/configure.ac +++ b/configure.ac @@ -4492,15 +4492,27 @@ fi AC_SUBST(XGSELOBJ) dnl Adapted from Haible's version. -AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset, +AC_CACHE_CHECK([for nl_langinfo and CODESET], [emacs_cv_langinfo_codeset], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[char* cs = nl_langinfo(CODESET);]])], - emacs_cv_langinfo_codeset=yes, - emacs_cv_langinfo_codeset=no) + [[char *cs = nl_langinfo(CODESET);]])], + [emacs_cv_langinfo_codeset=yes], + [emacs_cv_langinfo_codeset=no]) ]) -if test $emacs_cv_langinfo_codeset = yes; then - AC_DEFINE(HAVE_LANGINFO_CODESET, 1, - [Define if you have and nl_langinfo(CODESET).]) +if test "$emacs_cv_langinfo_codeset" = yes; then + AC_DEFINE([HAVE_LANGINFO_CODESET], 1, + [Define if you have and nl_langinfo (CODESET).]) + + AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH], + [emacs_cv_langinfo__nl_paper_width], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])], + [emacs_cv_langinfo__nl_paper_width=yes], + [emacs_cv_langinfo__nl_paper_width=no]) + ]) + if test "$emacs_cv_langinfo__nl_paper_width" = yes; then + AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], 1, + [Define if you have and nl_langinfo (_NL_PAPER_WIDTH).]) + fi fi AC_TYPE_MBSTATE_T diff --git a/etc/NEWS b/etc/NEWS index 2bbc38769e..cac379fe7e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1527,6 +1527,9 @@ systems, the XRender extension to X11 is required for this to be available; the configure script will test for it and, if found, enable scaling.) ++++ +** (locale-info 'paper) now returns the paper size on GNUish hosts. + The new function 'image-scaling-p' can be used to test whether any given frame supports resizing. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index f91b3ea6ce..fdcd606035 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2727,7 +2727,6 @@ See also `locale-charset-language-names', `locale-language-names', (let ((paper (locale-info 'paper)) locale) (if paper - ;; This will always be null at the time of writing. (cond ((equal paper '(216 279)) (setq ps-paper-type 'letter)) diff --git a/src/fns.c b/src/fns.c index 345211418c..a7279b1355 100644 --- a/src/fns.c +++ b/src/fns.c @@ -3118,8 +3118,8 @@ The data read from the system are decoded using `locale-coding-system'. */) str = nl_langinfo (CODESET); return build_string (str); } -#ifdef DAY_1 - else if (EQ (item, Qdays)) /* e.g. for calendar-day-name-array */ +# ifdef DAY_1 + if (EQ (item, Qdays)) /* E.g., for calendar-day-name-array. */ { Lisp_Object v = make_nil_vector (7); const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7}; @@ -3136,9 +3136,9 @@ The data read from the system are decoded using `locale-coding-system'. */) } return v; } -#endif /* DAY_1 */ -#ifdef MON_1 - else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */ +# endif +# ifdef MON_1 + if (EQ (item, Qmonths)) /* E.g., for calendar-month-name-array. */ { Lisp_Object v = make_nil_vector (12); const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, @@ -3153,13 +3153,12 @@ The data read from the system are decoded using `locale-coding-system'. */) } return v; } -#endif /* MON_1 */ -/* LC_PAPER stuff isn't defined as accessible in glibc as of 2.3.1, - but is in the locale files. This could be used by ps-print. */ -#ifdef PAPER_WIDTH - else if (EQ (item, Qpaper)) - return list2i (nl_langinfo (PAPER_WIDTH), nl_langinfo (PAPER_HEIGHT)); -#endif /* PAPER_WIDTH */ +# endif +# ifdef HAVE_LANGINFO__NL_PAPER_WIDTH + if (EQ (item, Qpaper)) + return list2i ((intptr_t) nl_langinfo (_NL_PAPER_WIDTH), + (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT)); +# endif #endif /* HAVE_LANGINFO_CODESET*/ return Qnil; } commit 42c8399059bb311c8cfaf9428f0a29032d71011d Author: Juri Linkov Date: Sat Feb 2 23:23:16 2019 +0200 * test/lisp/vc/diff-mode-tests.el (diff-mode-test-font-lock): New test. (diff-mode-test-font-lock-syntax-one-line): New test for one line. * test/data/vc/diff-mode/hello_world.c: * test/data/vc/diff-mode/hello_world_1.c: * test/data/vc/diff-mode/hello_emacs.c: * test/data/vc/diff-mode/hello_emacs_1.c: New fixtures. * lisp/vc/diff-mode.el (diff-syntax-fontify): Move remove-overlays from diff-syntax-fontify-hunk. (Bug#33567) (diff-syntax-fontify-hunk): Remove VISIT arg from insert-file-contents. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 158489c97f..607c7b583e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2391,6 +2391,7 @@ and the position in MAX." (defun diff-syntax-fontify (beg end) "Highlight source language syntax in diff hunk between BEG and END." + (remove-overlays beg end 'diff-mode 'syntax) (save-excursion (diff-syntax-fontify-hunk beg end t) (diff-syntax-fontify-hunk beg end nil))) @@ -2402,9 +2403,10 @@ and the position in MAX." (defun diff-syntax-fontify-hunk (beg end old) "Highlight source language syntax in diff hunk between BEG and END. When OLD is non-nil, highlight the hunk from the old source." - (remove-overlays beg end 'diff-mode 'syntax) (goto-char beg) (let* ((hunk (buffer-substring-no-properties beg end)) + ;; Trim a trailing newline to find hunk in diff-syntax-fontify-props + ;; in diffs that have no newline at end of diff file. (text (string-trim-right (or (ignore-errors (diff-hunk-text hunk (not old) nil)) ""))) (line (if (looking-at "\\(?:\\*\\{15\\}.*\n\\)?[-@* ]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?") (if old (match-string 1) @@ -2431,7 +2433,7 @@ When OLD is non-nil, highlight the hunk from the old source." (setq props (diff-syntax-fontify-props nil text line-nb t))) ;; Get properties from the file (with-temp-buffer - (insert-file-contents file t) + (insert-file-contents file) (setq props (diff-syntax-fontify-props file text line-nb))))) ;; Get properties from a cached revision (let* ((buffer-name (format " *diff-syntax:%s.~%s~*" @@ -2459,7 +2461,7 @@ When OLD is non-nil, highlight the hunk from the old source." (if (and file (file-exists-p file) (file-regular-p file)) ;; Try to get full text from the file (with-temp-buffer - (insert-file-contents file t) + (insert-file-contents file) (setq props (diff-syntax-fontify-props file text line-nb))) ;; Otherwise, get properties from the hunk alone (with-temp-buffer diff --git a/test/data/vc/diff-mode/hello_emacs.c b/test/data/vc/diff-mode/hello_emacs.c new file mode 100644 index 0000000000..c7ed7538c3 --- /dev/null +++ b/test/data/vc/diff-mode/hello_emacs.c @@ -0,0 +1,6 @@ +#include +int main() +{ + printf("Hello, Emacs!\n"); + return 0; +} diff --git a/test/data/vc/diff-mode/hello_emacs_1.c b/test/data/vc/diff-mode/hello_emacs_1.c new file mode 100644 index 0000000000..62145a6b44 --- /dev/null +++ b/test/data/vc/diff-mode/hello_emacs_1.c @@ -0,0 +1 @@ +int main() { printf("Hello, Emacs!\n"); return 0; } \ No newline at end of file diff --git a/test/data/vc/diff-mode/hello_world.c b/test/data/vc/diff-mode/hello_world.c new file mode 100644 index 0000000000..dcbe06c601 --- /dev/null +++ b/test/data/vc/diff-mode/hello_world.c @@ -0,0 +1,6 @@ +#include +int main() +{ + printf("Hello, World!\n"); + return 0; +} diff --git a/test/data/vc/diff-mode/hello_world_1.c b/test/data/vc/diff-mode/hello_world_1.c new file mode 100644 index 0000000000..606afb371c --- /dev/null +++ b/test/data/vc/diff-mode/hello_world_1.c @@ -0,0 +1 @@ +int main() { printf("Hello, World!\n"); return 0; } \ No newline at end of file diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el index 4276974c2a..8e690548f0 100644 --- a/test/lisp/vc/diff-mode-tests.el +++ b/test/lisp/vc/diff-mode-tests.el @@ -21,7 +21,10 @@ ;;; Code: (require 'diff-mode) +(require 'diff) +(defconst diff-mode-tests--datadir + (expand-file-name "test/data/vc/diff-mode" source-directory)) (ert-deftest diff-mode-test-ignore-trailing-dashes () "Check to make sure we successfully ignore trailing -- made by @@ -199,5 +202,114 @@ youthfulness (kill-buffer buf2) (delete-directory temp-dir 'recursive)))))) +(ert-deftest diff-mode-test-font-lock () + "Check font-locking of diff hunks." + (let ((default-directory diff-mode-tests--datadir) + (old "hello_world.c") + (new "hello_emacs.c") + (diff-buffer (get-buffer-create "*Diff*")) + (diff-font-lock-refine t) + (diff-font-lock-syntax t) + diff-beg) + (diff-no-select old new '("-u") 'no-async diff-buffer) + (with-current-buffer diff-buffer + (font-lock-ensure) + (narrow-to-region (progn (diff-hunk-next) + (setq diff-beg (diff-beginning-of-hunk))) + (diff-end-of-hunk)) + + (should (equal-including-properties + (buffer-string) + #("@@ -1,6 +1,6 @@ + #include + int main() + { +- printf(\"Hello, World!\\n\"); ++ printf(\"Hello, Emacs!\\n\"); + return 0; + } +" + 0 15 (face diff-hunk-header) + 16 36 (face diff-context) + 36 48 (face diff-context) + 48 51 (face diff-context) + 51 52 (face diff-indicator-removed) + 52 81 (face diff-removed) + 81 82 (face diff-indicator-added) + 82 111 (face diff-added) + 111 124 (face diff-context) + 124 127 (face diff-context)))) + + (should (equal (mapcar (lambda (o) + (list (- (overlay-start o) diff-beg) + (- (overlay-end o) diff-beg) + (append (and (overlay-get o 'diff-mode) + `(diff-mode ,(overlay-get o 'diff-mode))) + (and (overlay-get o 'face) + `(face ,(overlay-get o 'face)))))) + (sort (overlays-in (point-min) (point-max)) + (lambda (a b) (< (overlay-start a) (overlay-start b))))) + '((0 127 (diff-mode fine)) + (0 127 (diff-mode syntax)) + (17 25 (diff-mode syntax face font-lock-preprocessor-face)) + (26 35 (diff-mode syntax face font-lock-string-face)) + (37 40 (diff-mode syntax face font-lock-type-face)) + (41 45 (diff-mode syntax face font-lock-function-name-face)) + (61 78 (diff-mode syntax face font-lock-string-face)) + (69 74 (diff-mode fine face diff-refine-removed)) + (91 108 (diff-mode syntax face font-lock-string-face)) + (99 104 (diff-mode fine face diff-refine-added)) + (114 120 (diff-mode syntax face font-lock-keyword-face)))))))) + +(ert-deftest diff-mode-test-font-lock-syntax-one-line () + "Check diff syntax highlighting for one line with no newline at end." + (let ((default-directory diff-mode-tests--datadir) + (old "hello_world_1.c") + (new "hello_emacs_1.c") + (diff-buffer (get-buffer-create "*Diff*")) + (diff-font-lock-refine nil) + (diff-font-lock-syntax t) + diff-beg) + (diff-no-select old new '("-u") 'no-async diff-buffer) + (with-current-buffer diff-buffer + (font-lock-ensure) + (narrow-to-region (progn (diff-hunk-next) + (setq diff-beg (diff-beginning-of-hunk))) + (diff-end-of-hunk)) + + (should (equal-including-properties + (buffer-string) + #("@@ -1 +1 @@ +-int main() { printf(\"Hello, World!\\n\"); return 0; } +\\ No newline at end of file ++int main() { printf(\"Hello, Emacs!\\n\"); return 0; } +\\ No newline at end of file +" + 0 11 (face diff-hunk-header) + 12 13 (face diff-indicator-removed) + 13 65 (face diff-removed) + 65 93 (face diff-context) + 93 94 (face diff-indicator-added) + 94 146 (face diff-added) + 146 174 (face diff-context)))) + + (should (equal (mapcar (lambda (o) + (list (- (overlay-start o) diff-beg) + (- (overlay-end o) diff-beg) + (append (and (overlay-get o 'diff-mode) + `(diff-mode ,(overlay-get o 'diff-mode))) + (and (overlay-get o 'face) + `(face ,(overlay-get o 'face)))))) + (sort (overlays-in (point-min) (point-max)) + (lambda (a b) (< (overlay-start a) (overlay-start b))))) + '((0 174 (diff-mode syntax)) + (13 16 (diff-mode syntax face font-lock-type-face)) + (17 21 (diff-mode syntax face font-lock-function-name-face)) + (33 50 (diff-mode syntax face font-lock-string-face)) + (53 59 (diff-mode syntax face font-lock-keyword-face)) + (94 97 (diff-mode syntax face font-lock-type-face)) + (98 102 (diff-mode syntax face font-lock-function-name-face)) + (114 131 (diff-mode syntax face font-lock-string-face)) + (134 140 (diff-mode syntax face font-lock-keyword-face)))))))) (provide 'diff-mode-tests) commit adc31c6bdcdb52c2bc0240982d3e8ce870af1fab Author: Paul Eggert Date: Sat Feb 2 13:13:45 2019 -0800 Update from Gnulib This incorporates: 2019-02-02 dtoastr, ftoastr, ldtoastr: port to c-strtod changes 2019-02-01 c-strtod, c-strtold: use the bug fixes 2019-01-30 strtold: New module * doc/misc/texinfo.tex, lib/ftoastr.c, lib/regexec.c, lib/stdlib.in.h: * m4/stdlib_h.m4: Copy from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * m4/c-strtod.m4: Remove. diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index 0e75b4d7dd..ea99d50094 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -104,7 +104,6 @@ HAVE_ALLOCA_H HAVE_ALSA HAVE_BDFFONT HAVE_BOXES -HAVE_C99_STRTOLD HAVE_CFMAKERAW HAVE_CFSETSPEED HAVE_CLOCK_GETTIME diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 48d532bc62..71667f03ab 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,10 +3,10 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-01-03-15} +\def\texinfoversion{2019-02-01.12} % -% Copyright 1985, 1986, 1988, 1990-2018 Free Software Foundation, Inc. +% Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -7515,7 +7515,7 @@ \nonfillstart \tt % easiest (and conventionally used) font for verbatim % The \leavevmode here is for blank lines. Otherwise, we would - % never \starttabox and the \egroup would end verbatim mode. + % never \starttabbox and the \egroup would end verbatim mode. \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand \setupmarkupstyle{verbatim}% @@ -7578,9 +7578,12 @@ {% \makevalueexpandable \setupverbatim - \indexnofonts % Allow `@@' and other weird things in file names. - \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% - \input #1 + {% + \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% + \edef\tmp{\noexpand\input #1 } + \expandafter + }\tmp \afterenvbreak }% } diff --git a/lib/ftoastr.c b/lib/ftoastr.c index 6c0ce261dc..55f1e02e80 100644 --- a/lib/ftoastr.c +++ b/lib/ftoastr.c @@ -40,9 +40,7 @@ # define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND # define FTOASTR ldtoastr # define PROMOTED_FLOAT long double -# if HAVE_C99_STRTOLD -# define STRTOF strtold -# endif +# define STRTOF strtold #elif LENGTH == 2 # define FLOAT double # define FLOAT_DIG DBL_DIG @@ -63,7 +61,7 @@ # endif #endif -/* On pre-C99 hosts, approximate strtof and strtold with strtod. This +/* On pre-C99 hosts, approximate strtof with strtod. This may generate one or two extra digits, but that's better than not working at all. */ #ifndef STRTOF diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index fdf45d61c4..d8e51ad403 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -176,7 +176,6 @@ BUILD_DETAILS = @BUILD_DETAILS@ BYTESWAP_H = @BYTESWAP_H@ CAIRO_CFLAGS = @CAIRO_CFLAGS@ CAIRO_LIBS = @CAIRO_LIBS@ -CANNOT_DUMP = @CANNOT_DUMP@ CC = @CC@ CFLAGS = @CFLAGS@ CFLAGS_SOUND = @CFLAGS_SOUND@ @@ -432,6 +431,7 @@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOD = @GNULIB_STRTOD@ GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ +GNULIB_STRTOLD = @GNULIB_STRTOLD@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ @@ -634,6 +634,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRSEP = @HAVE_STRSEP@ HAVE_STRTOD = @HAVE_STRTOD@ +HAVE_STRTOLD = @HAVE_STRTOLD@ HAVE_STRTOLL = @HAVE_STRTOLL@ HAVE_STRTOULL = @HAVE_STRTOULL@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ @@ -934,6 +935,7 @@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_STRTOLD = @REPLACE_STRTOLD@ REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ @@ -959,6 +961,7 @@ REPLACE_WRITE = @REPLACE_WRITE@ RSVG_CFLAGS = @RSVG_CFLAGS@ RSVG_LIBS = @RSVG_LIBS@ SEPCHAR = @SEPCHAR@ +SETFATTR = @SETFATTR@ SETTINGS_CFLAGS = @SETTINGS_CFLAGS@ SETTINGS_LIBS = @SETTINGS_LIBS@ SHELL = @SHELL@ @@ -2546,6 +2549,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \ -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \ -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ @@ -2582,6 +2586,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \ -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ + -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ @@ -2605,6 +2610,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ + -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ diff --git a/lib/regexec.c b/lib/regexec.c index 2f7cb5dcb1..7fcd1a509a 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -1293,8 +1293,10 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs, else if (naccepted) { char *buf = (char *) re_string_get_buffer (&mctx->input); - if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, - naccepted) != 0) + if (mctx->input.valid_len - *pidx < naccepted + || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, + naccepted) + != 0)) return -1; } } diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index be8ab3b86c..f829525c10 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -929,6 +929,7 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strtod rpl_strtod # endif +# define GNULIB_defined_strtod_function 1 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); @@ -948,6 +949,32 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " # endif #endif +#if @GNULIB_STRTOLD@ + /* Parse a 'long double' from STRING, updating ENDP if appropriate. */ +# if @REPLACE_STRTOLD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strtold rpl_strtold +# endif +# define GNULIB_defined_strtold_function 1 +_GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); +# else +# if !@HAVE_STRTOLD@ +_GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); +# endif +_GL_CXXALIASWARN (strtold); +#elif defined GNULIB_POSIXCHECK +# undef strtold +# if HAVE_RAW_DECL_STRTOLD +_GL_WARN_ON_USE (strtold, "strtold is unportable - " + "use gnulib module strtold for portability"); +# endif +#endif + #if @GNULIB_STRTOLL@ /* Parse a signed integer whose textual representation starts at STRING. The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, diff --git a/m4/c-strtod.m4 b/m4/c-strtod.m4 deleted file mode 100644 index 1694a2396c..0000000000 --- a/m4/c-strtod.m4 +++ /dev/null @@ -1,76 +0,0 @@ -# c-strtod.m4 serial 16 - -# Copyright (C) 2004-2006, 2009-2019 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Written by Paul Eggert. - -AC_DEFUN([gl_C99_STRTOLD], -[ - AC_CACHE_CHECK([whether strtold conforms to C99], - [gl_cv_func_c99_strtold], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[/* On HP-UX before 11.23, strtold returns a struct instead of - long double. Reject implementations like that, by requiring - compatibility with the C99 prototype. */ - #include - static long double (*p) (char const *, char **) = strtold; - static long double - test (char const *nptr, char **endptr) - { - long double r; - r = strtold (nptr, endptr); - return r; - }]], - [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])], - [gl_cv_func_c99_strtold=yes], - [gl_cv_func_c99_strtold=no])]) - if test $gl_cv_func_c99_strtold = yes; then - AC_DEFINE([HAVE_C99_STRTOLD], [1], [Define to 1 if strtold conforms to C99.]) - fi -]) - -dnl Prerequisites of lib/c-strtod.c. -AC_DEFUN([gl_C_STRTOD], -[ - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - AC_CHECK_HEADERS_ONCE([xlocale.h]) - dnl We can't use AC_CHECK_FUNC here, because strtod_l() is defined as a - dnl static inline function when compiling for Android 7.1 or older. - AC_CACHE_CHECK([for strtod_l], [gl_cv_func_strtod_l], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include - #include - #if HAVE_XLOCALE_H - # include - #endif - locale_t loc; - ]], - [[char *end; - return strtod_l("0",&end,loc) < 0.0; - ]]) - ], - [gl_cv_func_strtod_l=yes], - [gl_cv_func_strtod_l=no]) - ]) - if test $gl_cv_func_strtod_l = yes; then - HAVE_STRTOD_L=1 - else - HAVE_STRTOD_L=0 - fi - AC_DEFINE_UNQUOTED([HAVE_STRTOD_L], [$HAVE_STRTOD_L], - [Define to 1 if the system has the 'strtod_l' function.]) -]) - -dnl Prerequisites of lib/c-strtold.c. -AC_DEFUN([gl_C_STRTOLD], -[ - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_C99_STRTOLD]) - AC_CHECK_FUNCS([strtold_l]) -]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index a432cc8e54..f25a0e4081 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -209,7 +209,6 @@ AC_DEFUN([gl_INIT], gl_SHA512 gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE gl_DIRENT_H - AC_REQUIRE([gl_C99_STRTOLD]) gl_FUNC_DUP2 if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then AC_LIBOBJ([dup2]) @@ -999,7 +998,6 @@ AC_DEFUN([gl_FILE_LIST], [ m4/alloca.m4 m4/builtin-expect.m4 m4/byteswap.m4 - m4/c-strtod.m4 m4/clock_time.m4 m4/close-stream.m4 m4/count-leading-zeros.m4 diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index c5db804e4d..6121602aea 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 47 +# stdlib_h.m4 serial 48 dnl Copyright (C) 2007-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,7 +26,7 @@ AC_DEFUN([gl_STDLIB_H], initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray realpath rpmatch secure_getenv setenv setstate setstate_r srandom - srandom_r strtod strtoll strtoull unlockpt unsetenv]) + srandom_r strtod strtold strtoll strtoull unlockpt unsetenv]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], @@ -68,6 +68,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) + GNULIB_STRTOLD=0; AC_SUBST([GNULIB_STRTOLD]) GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) @@ -105,6 +106,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) @@ -128,6 +130,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) commit 6f52478e0c42f02cba940c21b18242f05e1ea2a1 Author: Paul Eggert Date: Sat Feb 2 10:23:48 2019 -0800 Fix unlikely user-full-name integer overflow * src/editfns.c (Fuser_full_name): Don’t assume uid fits into fixnum. diff --git a/src/editfns.c b/src/editfns.c index 360cdbe02e..a9ac263daf 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1260,7 +1260,7 @@ name, or nil if there is no such user. */) /* Substitute the login name for the &, upcasing the first character. */ if (q) { - Lisp_Object login = Fuser_login_name (make_fixnum (pw->pw_uid)); + Lisp_Object login = Fuser_login_name (INT_TO_INTEGER (pw->pw_uid)); USE_SAFE_ALLOCA; char *r = SAFE_ALLOCA (strlen (p) + SBYTES (login) + 1); memcpy (r, p, q - p); commit c73d18ac423c5f96a3250e0a6dc983c17d9bd66c Author: Eli Zaretskii Date: Sat Feb 2 17:12:13 2019 +0200 Prevent segfault in bootstrap-emacs on MinGW * src/emacs.c (main) [WINDOWSNT]: Fix logic of determining by argv[0] whether to use the static heap. (Bug#34277) diff --git a/src/emacs.c b/src/emacs.c index ff814a149b..869b5307f2 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -914,7 +914,9 @@ main (int argc, char **argv) happens. This relies on the static heap being needed only in temacs and only if we are going to dump with unexec. */ bool use_dynamic_heap = false; - if (strstr (argv[0], "temacs") != NULL) + char *temacs_str = strstr (argv[0], "temacs"); + if (temacs_str != NULL + && (temacs_str == argv[0] || IS_DIRECTORY_SEP (temacs_str[-1]))) { eassert (temacs); /* Note that gflags are set at this point only if we have been commit 2f55b971b42d13188157331a1e514949f20ced4f Author: Felicián Németh Date: Sat Feb 2 13:22:53 2019 +0100 Fix Bug#34221 * lisp/progmodes/project.el (project--files-in-directory): Support remote files. (Bug#34221) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 3603e751fe..815cc7cd3d 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -189,9 +189,11 @@ to find the list of ignores for each directory." (defun project--files-in-directory (dir ignores &optional files) (require 'find-dired) (defvar find-name-arg) - (let ((command (format "%s %s %s -type f %s -print0" + (let ((default-directory dir) + (remote-id (file-remote-p dir)) + (command (format "%s %s %s -type f %s -print0" find-program - dir + (file-local-name dir) (xref--find-ignores-arguments ignores (expand-file-name dir)) @@ -205,7 +207,8 @@ to find the list of ignores for each directory." " " (shell-quote-argument ")"))"") ))) - (split-string (shell-command-to-string command) "\0" t))) + (mapcar (lambda (file) (concat remote-id file)) + (split-string (shell-command-to-string command) "\0" t)))) (defgroup project-vc nil "Project implementation using the VC package."