From 6e0c49305e003d69cb6418a0cb8a9b1744035afe Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 24 Sep 2021 12:55:17 -0500 Subject: [PATCH] Use ISO C and C++ conformant name: _fdopen on windows Fixes ``` warning: In file included from src\lib.c:12: warning: src/./parser.c:1781:28: warning: 'fdopen' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _fdopen. See online help for details. [-Wdeprecated-declarations] warning: self->dot_graph_file = fdopen(fd, "a"); warning: ^ warning: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\stdio.h:2431:28: note: 'fdopen' has been explicitly marked deprecated here warning: _Check_return_ _CRT_NONSTDC_DEPRECATE(_fdopen) _ACRTIMP FILE* __cdecl fdopen(_In_ int _FileHandle, _In_z_ char const* _Format); warning: ^ warning: C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt\corecrt.h:414:50: note: expanded from macro '_CRT_NONSTDC_DEPRECATE' warning: #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT( \ warning: ^ warning: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.29.30133\include\vcruntime.h:310:47: note: expanded from macro '_CRT_DEPRECATE_TEXT' warning: #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text)) ``` --- lib/src/parser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/parser.c b/lib/src/parser.c index 7db1aceb..ebeb4b37 100644 --- a/lib/src/parser.c +++ b/lib/src/parser.c @@ -1776,7 +1776,11 @@ void ts_parser_print_dot_graphs(TSParser *self, int fd) { } if (fd >= 0) { + #ifdef _WIN32 + self->dot_graph_file = _fdopen(fd, "a"); + #else self->dot_graph_file = fdopen(fd, "a"); + #endif } else { self->dot_graph_file = NULL; }