From d1e3a19375c44f7062e2acc0b74e960a7040fc8f Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Tue, 13 Jul 2021 10:59:14 +0000 Subject: pdftexdir, chktex: Avoid MSVC compiler error C2059 for regex/regexec.c git-svn-id: svn://tug.org/texlive/trunk@59914 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/chktex/ChangeLog | 9 +++++++++ Build/source/texk/chktex/regex/regexec.c | 4 ++++ Build/source/texk/web2c/pdftexdir/ChangeLog | 9 +++++++++ Build/source/texk/web2c/pdftexdir/regex/regexec.c | 4 ++++ 4 files changed, 26 insertions(+) (limited to 'Build') diff --git a/Build/source/texk/chktex/ChangeLog b/Build/source/texk/chktex/ChangeLog index 46cb3e45174..2424c024905 100644 --- a/Build/source/texk/chktex/ChangeLog +++ b/Build/source/texk/chktex/ChangeLog @@ -1,3 +1,12 @@ +2021-07-13 Hironobu Yamashita + + * regex/regexec.c: Avoid MSVC compiler error. + -> error C2059: syntax error: ':' + MSVC does not allow empty expression for ternary + conditional operator (?:) which is a GNU C extension. + https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html + https://stackoverflow.com/questions/3319075/ + 2021-07-13 Hironobu Yamashita * regex/regex_internal.h: sync with pdftexdir/regex 2017-02-16. diff --git a/Build/source/texk/chktex/regex/regexec.c b/Build/source/texk/chktex/regex/regexec.c index a37da21f306..919c4dea96e 100644 --- a/Build/source/texk/chktex/regex/regexec.c +++ b/Build/source/texk/chktex/regex/regexec.c @@ -2866,7 +2866,11 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node, sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); } +#ifdef _MSC_VER + str_idx = path->next_idx ? path->next_idx : top_str; +#else str_idx = path->next_idx ?: top_str; +#endif /* Temporary modify MCTX. */ backup_state_log = mctx->state_log; diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index 2a7f3d400d0..2f19c8ecfe7 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,12 @@ +2021-07-13 Hironobu Yamashita + + * regex/regexec.c: Avoid MSVC compiler error. + -> error C2059: syntax error: ':' + MSVC does not allow empty expression for ternary + conditional operator (?:) which is a GNU C extension. + https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html + https://stackoverflow.com/questions/3319075/ + 2021-02-17 Karl Berry * NEWS, diff --git a/Build/source/texk/web2c/pdftexdir/regex/regexec.c b/Build/source/texk/web2c/pdftexdir/regex/regexec.c index a37da21f306..919c4dea96e 100644 --- a/Build/source/texk/web2c/pdftexdir/regex/regexec.c +++ b/Build/source/texk/web2c/pdftexdir/regex/regexec.c @@ -2866,7 +2866,11 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node, sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); } +#ifdef _MSC_VER + str_idx = path->next_idx ? path->next_idx : top_str; +#else str_idx = path->next_idx ?: top_str; +#endif /* Temporary modify MCTX. */ backup_state_log = mctx->state_log; -- cgit v1.2.3