From 6e0c49305e003d69cb6418a0cb8a9b1744035afe Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 24 Sep 2021 12:55:17 -0500 Subject: [PATCH 1/2] 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; } From 94ffcdadf3abc3890e4f1e7d4c8ec9cdc8543668 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 24 Sep 2021 15:20:34 -0500 Subject: [PATCH 2/2] Mark stack__iter as static Fixes ``` warning: In file included from src\lib.c:14: warning: src/./stack.c:311:9: warning: static function 'ts_stack__add_slice' is used in an inline function with external linkage [-Wstatic-in-inline] warning: ts_stack__add_slice( warning: ^ warning: src/./stack.c:274:1: note: use 'static' to give inline function 'stack__iter' internal linkage warning: inline StackSliceArray stack__iter(Stack *self, StackVersion version, warning: ^ warning: static warning: src/./stack.c:15:16: note: expanded from macro 'inline' warning: #define inline __forceinline warning: ^ warning: src/./stack.c:258:13: note: 'ts_stack__add_slice' declared here warning: static void ts_stack__add_slice(Stack *self, StackVersion original_version, warning: ^ warning: 1 warning generated. Finished dev [unoptimized + debuginfo] target(s) in 2.01s ``` --- lib/src/stack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/stack.c b/lib/src/stack.c index 1dc6895f..e49289cf 100644 --- a/lib/src/stack.c +++ b/lib/src/stack.c @@ -302,7 +302,7 @@ static void ts_stack__add_slice( array_push(&self->slices, slice); } -inline StackSliceArray stack__iter( +static StackSliceArray stack__iter( Stack *self, StackVersion version, StackCallback callback,