On 19/05/13 22:08, Bram Moolenaar wrote:
Tony Mechelynck wtote:
On 19/05/13 19:44, Bram Moolenaar wrote:
I wrote:
Patch 7.3.970
All the tests I could do with the new engine pass. However, it is
noticeable slower than the old engine. If this bothers you, set the
'regexpengine' option to one.
If you spot a mistake in regexp pattern matching, please send a
reproducible example, so that we can add it to the tests.
Compiling on linux_x86_64:
[...]
Can you try changing EMSG2() to EMSGN()?
In file included from /usr/include/string.h:642:0,
from os_unix.h:522,
from vim.h:268,
from regexp.c:47:
In function ‘strcpy’,
inlined from ‘nfa_recognize_char_class.constprop.24’ at
regexp_nfa.c:379:5:
/usr/include/bits/string3.h:105:3: warning: call to
__builtin___strcpy_chk will always overflow destination buffer [enabled
by default]
Yep, buffer should be 10 characters.
The above is with "tiny" features but "huge" features give me the same
(with a much longer gcc command line).
No messages and no crash with the attached patch. -- Thanks Bram.
Best regards,
Tony.
--
Computers will not be perfected until they can compute how much more
than the estimate the job will cost.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
# HG changeset patch
# Parent 2ee87f60819c78f966102de24d8dd145f40ee40c
# User Bram Moolenaar <[email protected]>
Fix compile errors in regexp engine
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -268,17 +268,17 @@ nfa_recognize_char_class(start, end, ext
char_u *p;
#define NCONFIGS 16
int classid[NCONFIGS] = {
NFA_DIGIT, NFA_NDIGIT, NFA_HEX, NFA_NHEX,
NFA_OCTAL, NFA_NOCTAL, NFA_WORD, NFA_NWORD,
NFA_HEAD, NFA_NHEAD, NFA_ALPHA, NFA_NALPHA,
NFA_LOWER, NFA_NLOWER, NFA_UPPER, NFA_NUPPER
};
- char_u myconfig[9];
+ char_u myconfig[10];
char_u config[NCONFIGS][9] = {
"000000100", /* digit */
"100000100", /* non digit */
"011000100", /* hex-digit */
"111000100", /* non hex-digit */
"000001000", /* octal-digit */
"100001000", /* [^0-7] */
"000110110", /* [0-9A-Za-z_] */
@@ -754,28 +754,28 @@ nfa_regatom()
case NUL:
syntax_error = TRUE;
EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
case Magic('|'):
case Magic('&'):
case Magic(')'):
syntax_error = TRUE;
- EMSG2(_(e_misplaced), no_Magic(c));
+ EMSGN(_(e_misplaced), no_Magic(c));
return FAIL;
case Magic('='):
case Magic('?'):
case Magic('+'):
case Magic('@'):
case Magic('*'):
case Magic('{'):
/* these should follow an atom, not form an atom */
syntax_error = TRUE;
- EMSG2(_(e_misplaced), no_Magic(c));
+ EMSGN(_(e_misplaced), no_Magic(c));
return FAIL;
case Magic('~'): /* previous substitute pattern */
/* Not supported yet */
return FAIL;
case Magic('1'):
case Magic('2'):
@@ -811,17 +811,17 @@ nfa_regatom()
case '7':
case '8':
case '9':
case '(':
/* \z1...\z9 and \z( not yet supported */
return FAIL;
default:
syntax_error = TRUE;
- EMSG2(_("E867: (NFA) Unknown operator '\\z%c'"),
+ EMSGN(_("E867: (NFA) Unknown operator '\\z%c'"),
no_Magic(c));
return FAIL;
}
break;
case Magic('%'):
c = no_Magic(getchr());
switch (c)
@@ -1358,17 +1358,17 @@ nfa_regpiece()
break;
case '!':
case '<':
case '>':
/* Not supported yet */
return FAIL;
default:
syntax_error = TRUE;
- EMSG2(_("E869: (NFA) Unknown operator '\\@%c'"), op);
+ EMSGN(_("E869: (NFA) Unknown operator '\\@%c'"), op);
return FAIL;
}
break;
case Magic('?'):
case Magic('='):
EMIT(NFA_QUEST);
break;