-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix warnings about -Wrestrict and -Wformat-truncation #24810
Conversation
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`.
In recent gcc, -Wrestrict warns when an argument passed to a restrict-qualified parameter aliases with another argument.
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"; |
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.
@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.
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 this is okay, given that names of that length are very unlikely, and we mostly only use this for debugging purposes?
Landed in bcef949...c49d87e |
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes