-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
src: squelch unused function warnings in util.h #9115
src: squelch unused function warnings in util.h #9115
Conversation
Thanks for the pull request. Looking at this, I think it may be better to move the definitions (i.e. the function bodies) of the non-template instances to util-inl.h and just leave declarations in util.h. WDYT? |
maybe i should merge the files into one file called utils.h ? |
ff1c6da
to
90fb363
Compare
inline char* Malloc(size_t n) { return Malloc<char>(n); } | ||
inline char* Calloc(size_t n) { return Calloc<char>(n); } | ||
inline char* UncheckedMalloc(size_t n) { return UncheckedMalloc<char>(n); } | ||
inline char* UncheckedCalloc(size_t n) { return UncheckedCalloc<char>(n); } |
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.
You should leave declarations: inline char* Malloc(size_t);
, etc.
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.
changed declarations back to be inline as requested. (hope thats what you meant because here you referred to some definitions under the debated declarations by mistake so i got a little confused)
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.
I think what @bnoordhuis would like to see is declarations like inline char* Malloc(size_t);
in the util.h
header, as that’s where people look to see what the actual internal APIs are.
The idea of two separate files is to speed up compilation for files that need the declarations but not the definitions. |
a3e751f
to
00127bb
Compare
added some commits, if you like the last commit (1 before last) and want me to squash it all into it then force push , tell me. |
@addaleax done |
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
(edit: with CI of course, I’d start one now but the interface doesn’t load…)
T* ret = UncheckedCalloc<T>(n); | ||
if (n > 0) CHECK_NE(ret, nullptr); | ||
return ret; | ||
} | ||
// Shortcuts for char*. |
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.
nit: Could you leave a blank line before this comment?
@@ -336,7 +336,7 @@ inline size_t MultiplyWithOverflowCheck(size_t a, size_t b) { | |||
// nullptr for zero-sized allocation requests. Normalize by always using | |||
// a nullptr. | |||
template <typename T> | |||
T* UncheckedRealloc(T* pointer, size_t n) { | |||
inline T* UncheckedRealloc(T* pointer, size_t n) { |
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.
Does this change affect the warnings? This function doesn’t seem to be a particularly good candidate for inlining.
c133999
to
83c7a88
Compare
the build has failed but i cant access the CI URL |
Not sure what happened there. New CI: https://ci.nodejs.org/job/node-test-pull-request/4596/ |
@jasnell is it done? it has been runing for 5 days now... |
@bnoordhuis ... does this LGTY? |
@addaleax @jasnell @bnoordhuis guys? |
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.
I'm afraid I can't start a test run, the CI is timing out again.
@jasnell can you help us out, please? |
Started another CI run. Will land after. |
@Jansell looks like all the failing tests are simply timeouts |
+1 ... will land this on Monday. Sorry for the delay, ended up getting side tracked on another item after starting the CI |
@jasnell poke poke :) |
Sigh.. sorry, ended up completely buried all week. Lemme see if I can get this landed now |
Hmm... for some reason I am not able to land this even tho it says here that there are no conflicts. Git am is failing. Will investigate. |
@soleboxy ... can I ask you to please squash the commits down into a single commit, rebase and force push back? |
@jasnell sure thing 👍 |
Fixes: nodejs#9083 moved function bodies back src: squelch unused function warnings in util.h. Fixes: nodejs#9083 moved back to previouse commit lets hope this is the correct answer src: squelch unused function warnings in util.h. Fixes: nodejs#9083 src: squelch unused function warnings in util.h. Fixes: nodejs#9083 src: squelch unused function warnings in util.h. Fixes: nodejs#9083 src: squelch unused function warnings in util.h. Fixes: nodejs#9083 src: squelch unused function warnings in util.h. Fixes: nodejs#9083
2cf933b
to
57a762f
Compare
@jasnell pong |
Landed in 35d48d3! (finally ;-) ...) Sorry for the delay! |
should this be backported? |
Only if it applies cleanly. It's a cosmetic change. |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesdAffected core subsystem(s)
src
Description of change
moved inline optimization to util-inl.h
Fixes: #9083