-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url: build warning fixes #10141
url: build warning fixes #10141
Conversation
This is to resolve an unused result warning in node_url.cc.
Resolve macro redefinition warning on Windows
NOTE: This was originally a part of PR #10139. |
@@ -62,7 +62,7 @@ using v8::Value; | |||
url.flags |= URL_FLAGS_TERMINATED; \ | |||
goto done; \ | |||
} | |||
#define FAILED() \ | |||
#define URL_FAILED() \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just an #undef FAILED
? It would decrease churn in the code below.
In src/node_url.cc:
> @@ -62,7 +62,7 @@ using v8::Value; url.flags |= URL_FLAGS_TERMINATED; \
goto done; \ } -#define FAILED() \ +#define URL_FAILED() \
How about just an #undef FAILED? It would decrease churn in the code
below.
Thanks @addaleax and @sam-github for the feedback!
+1 for touching less code.
In general: I don't really like undefining and redefining macros since the
meaning changes depending on what part of the code it is in. I think this
is an ugly solution for an ugly problem. -1
I would personally favor reducing the ugliness here by using something like
URL_FAILED.
I would like to leave this open for any other comments and would like to
follow a majority opinion from Node.js owners here. Hoping to avoid excess
bikeshedding.
|
OK, I'm fine with the macro rename. LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks guys! |
I realized the following change in #10145 should have been part of this PR to resolve a conversion warning on the Windows build: diff --git a/src/node_url.cc b/src/node_url.cc
index 7502461..b048449 100644
--- a/src/node_url.cc
+++ b/src/node_url.cc
@@ -341,7 +341,8 @@ namespace url {
val = numbers[parts - 1];
for (int n = 0; n < parts - 1; n++) {
double b = 3-n;
- val += numbers[n] * pow(256, b);
+ // TBD POSSIBLE DATA LOSS:
+ val += static_cast<uint32_t>(numbers[n] * pow(256, b));
}
}
I would be happy to take one of the following actions:
@sam-github @addaleax @mhdawson please let me know which action I should take. Thanks! |
I don’t think there’s any semantic relation to any of the commits in this PR, so feel free to open a new one |
This is to resolve an unused result warning in node_url.cc. Resolve macro redefinition warning on Windows PR-URL: #10141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Landed in 595b22a |
This is to resolve an unused result warning in node_url.cc. Resolve macro redefinition warning on Windows PR-URL: #10141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This is to resolve an unused result warning in node_url.cc. Resolve macro redefinition warning on Windows PR-URL: #10141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport |
Checklist
make -j8 test
(UNIX [macOS]; Linux i386 & amd64) andvcbuild test nosign
(.\vcbuild.bat nosign
then.\vcbuild.bat test nosign nobuild
as Administrator on Windows) PASS OKAdditional item
Affected core subsystem(s)
url
Description of change