GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix some clang-cl warnings regarding unused parameters by lemire · Pull Request #8 · targos/node Conversation
|
| 'conditions': [ | ||
| ['target_arch in "ia32 x64" and OS!="ios"', { | ||
| 'defines': [ 'ADLER32_SIMD_SSSE3' ], | ||
| 'cflags': [ '-mssse3' ], |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@anonrig Would you happen to know why these variables (cflags, cflags_cpp) don't take hold here even though we are building under Windows with x64.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it's a GYP issue. It was never meant to support Clang on Windows AFAIK and cflags are passed differently for it. See c1d1878
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'include_dirs': [ 'base64/include', 'base64/lib' ], | ||
| 'sources': [ 'base64/lib/arch/ssse3/codec.c' ], | ||
| 'defines': [ 'BASE64_STATIC_DEFINE', 'HAVE_SSSE3=1' ], | ||
| 'cflags_cpp': [], |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do these work? What are the fixed warnings?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Without these, you are passing-std=c++17 to clang-cl when compiling C code. The better solution would be for the build engine to recognize that it is compiling C code, and not pass the C++ flags.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that it works because I don't see any occurence of cflags_cpp in the code base (including the source code of GYP)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You are correct. It should be cflags_cc.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I think this comes from common.gypi: https://github.com/nodejs/node/blob/3f4ea7ad7f4a1cb058bdc5363311607d1793928e/common.gypi#L284-L289 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes. And that flag looks fine to me. The issue is that it gets applied when clang-cl builds C code. Node has several C dependencies and they are the ones that appear most broken right now. Short of making the build engine smarter, I propose to clear the C++ flags when within a C dependency. It does not quite work perfectly because, as we have observed, some flags do not get applied under clang-cl when it seems they should. This issue leads to breakage having to do with SIMD instructions. The better solution would be to fix the build engine so that it actually supports clang-cl as a first class compiler. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Basically this PR gets you closer to building under clang-cl without warnings and errors because it manually removes the unnecessary C++ flags within C projects. I think that you pretty much need to do this if fixing GYP is not an option. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I understand what you're trying to do but what I understand of GYP is that it ignores |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Checkout my PR and run it. It will take you a minute. It works! It drastically reduces the volume of warnings. It is a verifiable statement, you can check. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
To put it another way, GYP does not ignore all of these changes, just a couple. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
First warning I see (clean clone with this patch applied): Then a lot more in uvwasi and zlib |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
With a fresh build? That's intriguing. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please see nodejs#35433 (comment) I think that there is a fundamental problem that should be solved and that what I am proposing here is wrong. Closing. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@targos Note that the approach illustrated by this PR does work. You do get rid of the warnings when setting It is a hack, however. I don't recommend it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This function call can fail with `Z_VERSION_ERROR` if the compiled
library vs loaded library mismatched in version number or in
stream structure size.
In those cases, zlib doesn't initialize the `strm_.msg` field to
null. Therefore, when a `CompressionError` object is created via
`ErrorForMessage()`, it can read a stale or uninitialized `strm_.msg`
pointer that will cause a crash.
Example ASAN report:
```
AddressSanitizer: SEGV on unknown address
#0 __strlen_avx2
string/../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1 strlen (/work/node/out/Debug/node+0x1a42ab7)
#2 v8::(anonymous namespace)::StringLength(char const*)
/work/node/out/../deps/v8/src/api/api.cc:7581:16
#3 v8::(anonymous namespace)::StringLength(unsigned char const*)
/work/node/out/../deps/v8/src/api/api.cc:7587:10
#4 v8::String::NewFromOneByte(v8::Isolate*,
unsigned char const*, v8::NewStringType, int)
/work/node/out/../deps/v8/src/api/api.cc:7677:3
#5 node::OneByteString(v8::Isolate*,
char const*, int, v8::NewStringType)
/work/node/out/../src/util-inl.h:166:10
#6 node::(anonymous namespace)::CompressionStream<
node::(anonymous namespace)::ZlibContext>
::EmitError(node::(anonymous namespace)
::CompressionError const&)
/work/node/out/../src/node_zlib.cc:565:7
#7 node::(anonymous namespace)::CompressionStream<
node::(anonymous namespace)::ZlibContext>
::CheckError()
/work/node/out/../src/node_zlib.cc:519:5
#8 node::(anonymous namespace)::CompressionStream<
node::(anonymous namespace)::ZlibContext>
::AfterThreadPoolWork(int)
/work/node/out/../src/node_zlib.cc:543:10
#9 node::ThreadPoolWork::ScheduleWork()
::'lambda'(uv_work_s*, int)
::operator()(uv_work_s*, int) const
/work/node/out/../src/threadpoolwork-inl.h:57:15
#10 node::ThreadPoolWork::ScheduleWork()
::'lambda'(uv_work_s*, int)
::__invoke(uv_work_s*, int)
/work/node/out/../src/threadpoolwork-inl.h:48:7
#11 uv__work_done /work/libuv-1.51.0/src/threadpool.c:330:5
#12 uv__async_io.part.0
/work/libuv-1.51.0/src/unix/async.c:208:5
```
Signed-off-by: ndossche <[email protected]>
PR-URL: nodejs#63476
Reviewed-By: Anna Henningsen <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.