* vc/vc.el (vc-diff-build-argument-list-internal): If the file is
not locked, use last revision and current source as
defaults.  (Bug#15569)
MS-Windows follow-up to revision 114603: support giflib 5.x.

 src/image.c (GIFLIB_MAJOR): Define to 4 if undefined.
 (GIFLIB_MINOR, GIFLIB_RELEASE): Define to zero if undefined.
 (GifErrorString) [GIFLIB_MAJOR >= 5]: Define a function pointer.
 (gif_load): For giflib v5.x and later, display the error message
 produced by giflib when its functions fail.
 (syms_of_image) <Qlibgif_version> [HAVE_NTGUI]: New DEFSYM.

 lisp/term/w32-win.el (dynamic-library-alist): Define separate lists
 of GIF DLLs for versions before and after 5.0.0 of giflib.
* image.c: Pacify --enable-gcc-warnings.

(GIFLIB_MAJOR, GIFLIB_MINOR, GIFLIB_RELEASE, fn_GifErrorString):
#define only if used.
Attempt to fix crashes per bug #15575.

 src/xdisp.c (deep_copy_glyph_row): Assert that the 'used' counts of
 FROM and TO are identical.  Copy only the glyphs of TEXT_AREA.
 src/term.c (save_and_enable_current_matrix): Don't allocate and
 don't save margin areas.
 (restore_desired_matrix): Don't restore margin areas.
 (free_saved_screen): Don't free margin areas.
* src/fileio.c (Fsubstitute_in_file_name): Use substitute-env-in-file-name.
(Qsubstitute_env_in_file_name): New var.
(syms_of_fileio): Define it.
* lisp/env.el (substitute-env-in-file-name): New function.
(substitute-env-vars): Extend the meaning of the optional arg.
* test/automated/ruby-mode-tests.el (ruby-with-temp-buffer): Move before
first use.
(ruby-should-indent): Use indent-according-to-mode.
(ruby-deftest-move-to-block): Use `declare'.
* lisp/emacs-lisp/smie.el (smie--matching-block-data): Invalidate the
cache also after commands that modify the buffer but don't move
point.
merge trunk
* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Split the
cases of ? and =.
(ruby-smie-rules): Simplify the "do" rule.  The cases when the
predicate would return nil are almost non-existent.
(ruby-smie--redundant-do-p): Include "until" and "for" statements.
* lisp/progmodes/sh-script.el: Provide simpl(e|istic) completion.
(explicit-shell-file-name): Declare.
(sh--vars-before-point, sh--cmd-completion-table): New functions.
(sh-completion-at-point-function): New function.
(sh-mode): Use it.
(sh-smie--keyword-p): Remove unused argument.
(sh-smie-sh-backward-token, sh-smie-rc-backward-token): Remove unused
vars.
(sh-set-shell): Always setup SMIE, even if we use the
old indentation code.
* xdisp.c (deep_copy_glyph_row): Remove unused locals.
* lisp.h (eassume): New macro.

Also, include <verify.h>, for 'assume'.
* alloc.c (bool_vector_payload_bytes, Fmake_bool_vector)
(vroundup, vector_nbytes):
* data.c (bool_vector_spare_mask, bool_vector_binop_driver)
(Fbool_vector_not, Fbool_vector_count_matches)
(Fbool_vector_count_matches_at):
Use eassume, not eassert.
* casetab.c (set_identity, shuffle):
* composite.c (composition_gstring_put_cache):
* dispnew.c (update_frame_1):
* ftfont.c (ftfont_shape_by_flt):
* image.c (gif_load):
* intervals.c (offset_intervals):
* macfont.m (macfont_shape):
Remove calls to 'assume' that are no longer needed, because
--enable-gcc-warnings no longer generates bogus warnings
when these calls are removed.
Fix bug #15575 with crashes in TTY menus.

 src/xdisp.c (display_tty_menu_item): Make sure we never write beyond
 the end of the frame's glyph matrix.
 src/term.c (tty_menu_display): Don't move cursor while overwriting
 frame's glyphs with menu items.  Limit the number of items
 displayed to what can be shown on the available screen lines,
 excluding the echo area.
 (tty_menu_activate): Limit the Y coordinate allowed by
 read_menu_input to the last screen line used for menu display.
* dispnew.c (redraw_frame): Remove useless #ifdef because
FRAME_MSDOS_P is a compile-time zero everywhere except MS-DOS.
Also, move TTY fflush to...
* term.c (tty_update_end): ...this function.
Support GnuTLS v3 and set up its audit logging properly.

* configure.ac: Define HAVE_GNUTLS3 if GnuTLS v3 is found.

* src/gnutls.c (gnutls_audit_log_function): Add function for GnuTLS
audit logging (only used with GnuTLS 3.x) and enable it.
Menu item selection on TTYs is now cyclical.

 src/term.c (read_menu_input): Make selection of menu items
 cyclical.  Suggested by Dmitry Antipov <dmantipov@yandex.ru>.
 (tty_menu_activate): Fix off-by-one error when computing max_y.
merge trunk
* term.c (tty_menu_show): Never return with unbalanced
specpdl.  Use eassert for debugging check.  Adjust style.
Support frame dimension changes while TTY menus are displayed.

 src/xdisp.c (deep_copy_glyph_row): Handle the case that FROM and TO
 have different dimensions.
 src/dispnew.c (fill_up_frame_row_with_spaces): Now has external
 visibility.
 src/dispextern.h (fill_up_frame_row_with_spaces): Add prototype.
Make the same key that opens TTY menus also exit the menu.

 lisp/menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit.