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: remove ' printf modifier #13447

Merged
merged 1 commit into from
Jun 6, 2017
Merged

src: remove ' printf modifier #13447

merged 1 commit into from
Jun 6, 2017

Conversation

refack
Copy link
Contributor

@refack refack commented Jun 4, 2017

It is not supported on Windows so it emits:

warning C4476: 'fprintf' : unknown type field character ''' in format specifier
warning C4474: 'fprintf' : too many arguments passed for format string

Fixes: #13463

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

src

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jun 4, 2017
@refack refack added the lib / src Issues and PRs related to general changes in the lib or src directory. label Jun 4, 2017
@refack refack self-assigned this Jun 4, 2017
@refack
Copy link
Contributor Author

refack commented Jun 4, 2017

@refack refack changed the title src: remove ' print modifier src: remove ' printf modifier Jun 4, 2017
@mscdex mscdex added the async_hooks Issues and PRs related to the async hooks subsystem. label Jun 4, 2017
src/env-inl.h Outdated
@@ -146,7 +146,7 @@ inline bool Environment::AsyncHooks::pop_ids(double async_id) {
if (uid_fields_[kCurrentAsyncId] != async_id) {
fprintf(stderr,
"Error: async hook stack has become corrupted ("
"actual: %'.f, expected: %'.f)\n",
"actual: %f, expected: %f)\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The . should not be removed. Otherwise we get ${id}.000000.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S. why is it a double?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it a double?

So that it isn’t limited by 2^32 in its range, but still representable in JS. If you prefer, casting to uint64_t should be safe here.

Copy link
Contributor Author

@refack refack Jun 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer, casting to uint64_t should be safe here.

I'll read a bit about fprintf on windows and think about it.
IMHO for this PR %.f works

@gibfahn
Copy link
Member

gibfahn commented Jun 5, 2017

Worth adding a

Fixes: https://github.com/nodejs/node/issues/13463

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

It is not supported on Windows so it emits:
warning C4476: 'fprintf' :
  unknown type field character ''' in format specifier
warning C4474: 'fprintf' :
  too many arguments passed for format string

PR-URL: nodejs#13447
Fixes: nodejs#13463
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Andreas Madsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@refack refack merged commit f06c05c into nodejs:master Jun 6, 2017
@refack
Copy link
Contributor Author

refack commented Jun 6, 2017

landed in f06c05c

@refack refack deleted the simpler-printf branch June 6, 2017 18:42
jasnell pushed a commit that referenced this pull request Jun 7, 2017
It is not supported on Windows so it emits:
warning C4476: 'fprintf' :
  unknown type field character ''' in format specifier
warning C4474: 'fprintf' :
  too many arguments passed for format string

PR-URL: #13447
Fixes: #13463
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Andreas Madsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@refack refack removed their assignment Jun 12, 2017
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
async_hooks Issues and PRs related to the async hooks subsystem. 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.

Node 8: Compiler warning about invalid format passed to fprintf when building in VS 2015
10 participants