-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-112301: Add -Wformat=2 compiler option to NODIST #122474
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
c5396a1
19437ef
cba84fe
178bcc6
3bc76ca
c4b8cf9
8cff32e
95c612c
a3b0c46
fa52862
6cd1def
13e9c80
b62d155
9806f88
88fbc65
b6db214
304aed1
5afb8d8
1e664f6
1b4089b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,15 @@ void _Py_InitVersion(void) | |
#endif | ||
// The format string is defined above and is observably safe. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could it be switched to a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just pushed a change. I figure instead of going through the trouble defining a format string in the preprocessor #if/#else blocks and adding all of the diagnostic pragmas we can just put the |
||
// Ignore warnings related to non-literal format strings. | ||
#if defined(__GNUC__) && !defined(__clang__) | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wformat-nonliteral" | ||
#endif | ||
PyOS_snprintf(version, sizeof(version), buildinfo_format, | ||
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler()); | ||
#if defined(__GNUC__) && !defined(__clang__) | ||
#pragma GCC diagnostic pop | ||
#endif | ||
} | ||
|
||
const 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.
Consider using
_Py_COMP_DIAG_PUSH
/_Py_COMP_DIAG_POP
, and adding a macro like_Py_COMP_DIAG_IGNORE_DEPR_DECLS
, to make this easier to port to other compilers.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.
@encukou created macro for ignoring format nonliterals and applied it to this block