Skip to content
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

Closed

Conversation

solebox
Copy link
Contributor

@solebox solebox commented Oct 16, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passesd
  • commit message follows commit guidelines
Affected core subsystem(s)

src

Description of change

moved inline optimization to util-inl.h
Fixes: #9083

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Oct 16, 2016
@solebox solebox changed the title src: squelch unused function warnings in util.h (moved inline optimization to util-inl.h) src: squelch unused function warnings in util.h Oct 16, 2016
@bnoordhuis
Copy link
Member

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?

@solebox
Copy link
Contributor Author

solebox commented Oct 16, 2016

maybe i should merge the files into one file called utils.h ?

@solebox solebox force-pushed the src_squelch_unused_function_warnings branch from ff1c6da to 90fb363 Compare October 16, 2016 21:43
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); }
Copy link
Member

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.

Copy link
Contributor Author

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)

Copy link
Member

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.

@bnoordhuis
Copy link
Member

maybe i should merge the files into one file called utils.h ?

The idea of two separate files is to speed up compilation for files that need the declarations but not the definitions.

@solebox solebox force-pushed the src_squelch_unused_function_warnings branch from a3e751f to 00127bb Compare October 17, 2016 10:39
@solebox
Copy link
Contributor Author

solebox commented Oct 17, 2016

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.

@solebox
Copy link
Contributor Author

solebox commented Oct 17, 2016

@addaleax done

@addaleax addaleax added the lib / src Issues and PRs related to general changes in the lib or src directory. label Oct 18, 2016
Copy link
Member

@addaleax addaleax left a 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*.
Copy link
Member

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) {
Copy link
Member

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.

@rvagg rvagg force-pushed the master branch 2 times, most recently from c133999 to 83c7a88 Compare October 18, 2016 17:02
@jasnell
Copy link
Member

jasnell commented Oct 19, 2016

@solebox
Copy link
Contributor Author

solebox commented Oct 19, 2016

the build has failed but i cant access the CI URL

@jasnell
Copy link
Member

jasnell commented Oct 20, 2016

Not sure what happened there. New CI: https://ci.nodejs.org/job/node-test-pull-request/4596/

@solebox
Copy link
Contributor Author

solebox commented Oct 25, 2016

@jasnell is it done? it has been runing for 5 days now...

@jasnell
Copy link
Member

jasnell commented Oct 25, 2016

@bnoordhuis ... does this LGTY?

@solebox
Copy link
Contributor Author

solebox commented Nov 2, 2016

@addaleax @jasnell @bnoordhuis guys?

Copy link
Member

@bnoordhuis bnoordhuis left a 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.

@solebox
Copy link
Contributor Author

solebox commented Nov 3, 2016

@jasnell can you help us out, please?

@jasnell
Copy link
Member

jasnell commented Nov 3, 2016

@jasnell
Copy link
Member

jasnell commented Nov 3, 2016

Started another CI run. Will land after.

@jasnell jasnell self-assigned this Nov 3, 2016
@solebox
Copy link
Contributor Author

solebox commented Nov 4, 2016

@Jansell looks like all the failing tests are simply timeouts
(and the flaky one)

@jasnell
Copy link
Member

jasnell commented Nov 6, 2016

+1 ... will land this on Monday. Sorry for the delay, ended up getting side tracked on another item after starting the CI

@solebox
Copy link
Contributor Author

solebox commented Nov 8, 2016

@jasnell poke poke :)

@jasnell
Copy link
Member

jasnell commented Nov 10, 2016

Sigh.. sorry, ended up completely buried all week. Lemme see if I can get this landed now

@jasnell
Copy link
Member

jasnell commented Nov 10, 2016

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.

@jasnell
Copy link
Member

jasnell commented Nov 10, 2016

@soleboxy ... can I ask you to please squash the commits down into a single commit, rebase and force push back?

@solebox
Copy link
Contributor Author

solebox commented Nov 10, 2016

@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
@solebox solebox force-pushed the src_squelch_unused_function_warnings branch from 2cf933b to 57a762f Compare November 10, 2016 13:29
@solebox
Copy link
Contributor Author

solebox commented Nov 14, 2016

@jasnell pong

@bnoordhuis
Copy link
Member

jasnell pushed a commit that referenced this pull request Nov 18, 2016
Fixes: #9083

PR-URL: #9115
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@jasnell
Copy link
Member

jasnell commented Nov 18, 2016

Landed in 35d48d3! (finally ;-) ...) Sorry for the delay!

@jasnell jasnell closed this Nov 18, 2016
addaleax pushed a commit that referenced this pull request Nov 22, 2016
Fixes: #9083

PR-URL: #9115
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorins
Copy link
Contributor

should this be backported?

@bnoordhuis
Copy link
Member

Only if it applies cleanly. It's a cosmetic change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

src: squelch unused function warnings in util.h
6 participants