tree-sitter / tree-sitter-cpp

C++ grammar for tree-sitter
MIT License
262 stars 85 forks source link

bug: treesitter doesn't compile on Windows 11 #270

Closed Rumi152 closed 1 month ago

Rumi152 commented 4 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263)

Describe the bug

When I try to build it throws this error:

src/parser.c:8:9: warning: '#pragma optimize' is not supported [-Wignored-pragma-optimize] 
#pragma optimize("", off) 
1 warning generated. 
src/scanner.c:126:5: error: expected expression 
static_assert(MAX_DELIMITER_LENGTH * sizeof(wchar_t) < TREE_SITTER_SERIALIZATION_BUFFER_SIZE, 
1 error generated.  

It was fixed (and the same steps still work and fix the error) in commit 2c93b82af7674e82e862d03133fd7abe6bd23cf0. Sadly this change was canceled in commit ef61cb57bd10838e90957672e6b4c129fcbe3a25 with no apparent reason. If there is no important reason for this revert, and this was just a mistake, please commit this change again.

Steps To Reproduce/Bad Parse Tree

  1. Cloned fresh tree-sitter-cpp
  2. Installed dependencies using npm
  3. Build it using tree-sitter

Expected Behavior/Parse Tree

tree-sitter-cpp should build without errors

Repro

No response

ObserverOfTime commented 4 months ago

Compile with -std=c11 (or /std:c11), if compiling manually. Or post the version of your compiler.

Rumi152 commented 4 months ago

Thanks, it works. Although if there are no side effects this change could still be done (Just a suggestion, I am kind of new to this stuff)

amaanq commented 1 month ago

C11 is a requirement for tree-sitter.