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

Fix warnings about -Wrestrict and -Wformat-truncation #24810

Closed
wants to merge 2 commits into from

Conversation

@sam-github
Copy link
Member

commented Dec 3, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
sam-github added 2 commits Dec 3, 2018
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.
@sam-github

This comment has been minimized.

Copy link
Member Author

commented Dec 3, 2018

@addaleax

This comment has been minimized.

Copy link
Member

commented Dec 3, 2018

Can you explain the semver label? It’s not obvious to me :)

@@ -116,7 +116,8 @@ std::string GetHumanReadableProcessName() {
}

void GetHumanReadableProcessName(char (*name)[1024]) {
char title[1024] = "Node.js";
// Leave room after title for pid, which can be up to 20 digits for 64 bit.
char title[1000] = "Node.js";

This comment has been minimized.

Copy link
@sam-github

sam-github Dec 3, 2018

Author Member

@addaleax see ---^ I'm OK with it not being semver-major, but if there was a process-name longer than 1000 chars, it would now be slightly truncated. How paranoid should we be? I'll let someone else decide.

This comment has been minimized.

Copy link
@addaleax

addaleax Dec 3, 2018

Member

I think this is okay, given that names of that length are very unlikely, and we mostly only use this for debugging purposes?

@sam-github sam-github removed the semver-major label Dec 3, 2018

@sam-github

This comment has been minimized.

Copy link
Member Author

commented Dec 5, 2018

@sam-github

This comment has been minimized.

Copy link
Member Author

commented Dec 7, 2018

Landed in bcef949...c49d87e

@sam-github sam-github closed this Dec 7, 2018

@sam-github sam-github deleted the sam-github:fix-src-warnings branch Dec 7, 2018

sam-github added a commit that referenced this pull request Dec 7, 2018
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
sam-github added a commit that referenced this pull request Dec 7, 2018
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
MylesBorins added a commit that referenced this pull request Dec 7, 2018
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
MylesBorins added a commit that referenced this pull request Dec 7, 2018
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@BethGriggs BethGriggs referenced this pull request Dec 18, 2018
refack added a commit to refack/node that referenced this pull request Jan 14, 2019
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.

PR-URL: nodejs#24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
refack added a commit to refack/node that referenced this pull request Jan 14, 2019
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.

PR-URL: nodejs#24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
BethGriggs added a commit that referenced this pull request Feb 12, 2019
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
BethGriggs added a commit that referenced this pull request Feb 12, 2019
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@BethGriggs BethGriggs referenced this pull request Feb 12, 2019
BethGriggs added a commit that referenced this pull request Feb 20, 2019
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
BethGriggs added a commit that referenced this pull request Feb 20, 2019
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
rvagg added a commit that referenced this pull request Feb 28, 2019
src: fix warning for potential snprintf truncation
gcc 8+ recognizes that space has not been left for the pid and that the
return value of snprintf() isn't checked. Leave a little space for the
pid to prevent `-Wformat-truncation`.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
rvagg added a commit that referenced this pull request Feb 28, 2019
src: do not alias new and old signal masks
In recent gcc, -Wrestrict warns when an argument passed to a
restrict-qualified parameter aliases with another argument.

PR-URL: #24810
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.