To: vim_dev@googlegroups.com Subject: Patch 7.4.2080 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2080 Problem: When using PERROR() on some systems assert_fails() does not see the error. Solution: Make PERROR() always report the error. Files: src/vim.h, src/message.c, src/proto/message.pro *** ../vim-7.4.2079/src/vim.h 2016-07-19 23:12:18.716611687 +0200 --- src/vim.h 2016-07-20 00:05:01.275820207 +0200 *************** *** 1652,1658 **** #ifdef HAVE_STRERROR # define PERROR(msg) (void)emsg3((char_u *)"%s: %s", (char_u *)msg, (char_u *)strerror(errno)) #else ! # define PERROR(msg) perror(msg) #endif typedef long linenr_T; /* line number type */ --- 1652,1658 ---- #ifdef HAVE_STRERROR # define PERROR(msg) (void)emsg3((char_u *)"%s: %s", (char_u *)msg, (char_u *)strerror(errno)) #else ! # define PERROR(msg) do_perror(msg) #endif typedef long linenr_T; /* line number type */ *** ../vim-7.4.2079/src/message.c 2016-07-19 12:33:39.938005838 +0200 --- src/message.c 2016-07-20 00:09:03.417301133 +0200 *************** *** 521,526 **** --- 521,541 ---- return FALSE; } + #if !defined(HAVE_STRERROR) || defined(PROTO) + /* + * Replacement for perror() that behaves more or less like emsg() was called. + * v:errmsg will be set and called_emsg will be set. + */ + void + do_perror(char *msg) + { + perror(msg); + ++emsg_silent; + emsg((char_u *)msg); + --emsg_silent; + } + #endif + /* * emsg() - display an error message * *** ../vim-7.4.2079/src/proto/message.pro 2016-01-19 13:21:55.841334333 +0100 --- src/proto/message.pro 2016-07-20 00:09:07.533258324 +0200 *************** *** 8,13 **** --- 8,14 ---- void reset_last_sourcing(void); void msg_source(int attr); int emsg_not_now(void); + void do_perror(char *msg); int emsg(char_u *s); int emsg2(char_u *s, char_u *a1); void emsg_invreg(int name); *** ../vim-7.4.2079/src/version.c 2016-07-20 00:03:14.212934385 +0200 --- src/version.c 2016-07-20 00:05:26.887553706 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 2080, /**/ -- ARTHUR: I am your king! WOMAN: Well, I didn't vote for you. ARTHUR: You don't vote for kings. WOMAN: Well, 'ow did you become king then? The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///