synctex_parser: fix vasprintf() not exists in non-GNU environment
The vasprintf() is a GNU extension function which is not visible without GNU_SOURCE in non-GNU environments (tested on Gentoo Linux clang/musl).
The compilation error without the patch:
/var/tmp/portage/kde-apps/okular-9999/work/okular-9999/core/synctex/synctex_parser.c:8059:13: error: call to undeclared function 'vasprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declarat>
if (vasprintf(&buffer, format, va) < 0) {
^
/var/tmp/portage/kde-apps/okular-9999/work/okular-9999/core/synctex/synctex_parser.c:8059:13: note: did you mean 'vsprintf'?
/usr/include/stdio.h:116:5: note: 'vsprintf' declared here
int vsprintf(char *__restrict, const char *__restrict, __isoc_va_list);
^
2 warnings and 1 error generated.
_MSC_VER
is replaced by HAVE_VASPRINTF
define.
Also see related PR https://github.com/vedang/pdf-tools/pull/134
Edit: In the 2023-api-3
branch of the synctex repository GNU_SOURCE
is defined which would also solve the issue.
Edited by Linuxuser Gd