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
warning: unknown conversion type character `z' in format #48620
Comments
Some compilers don't understand "%zd" format specifer When building Python with such compilers, you will see a lot of "checking for %zd printf() format support" So I suppose there is a way to eliminate this warning completely. |
If you start at line 3652 in configure.in you fill find the check for |
I looked into the code and found these warnings about 'z' were |
You receive these messages because PyString_FromFormat is declared with You can safely ignore these warnings. |
Amaury, Attached patch disables this "__attribute__" I confirmed this eliminate warnings in FreeBSD 4.11 |
Technically patch is not correct : it disable __attribute__ always . The name of the macro is Py_GCC_ATTRIBUTE. It is a generic name and is It is just a warning and is not related to "compile error" (issue type). I will agree with patch that change name of attribute(as example |
Roumen, This patch disables __attribute__ when PY_FORMAT_SIZE_T isn't defined, About the name of the macro, I think you are right. |
Akira Kitada wrote:
I would like to clarify. After patch if PY_FORMAT_SIZE_T isn't defined
The current python code use Py_GCC_ATTRIBUTE only for Also I'm not sure that I would like warning to be hidden. Roumen |
Thank you again for the feedback. I think those warnings are not so useful, or even misleading, As for renaming Py_GCC_ATTRIBUTE, |
The new patch attached renamed Py_GCC_ATTRIBUTE to Py_GCC_FORMAT_ATTRIBUTE. As Roumen pointed out, "the current python code use Py_GCC_ATTRIBUTE Because a GCC attribute was/will be introduced in different version of You can find availability of a attribute at |
Tested my patch on
|
I'm opposed to applying this patch to a maintenance branch. It removes I also wonder whether it is really necessary to complicate the code just |
Martin, I think we can avoid the problem that would be introduced by the removal The patch looks not so complicated to me. It's just a renaming of a IMHO, source code should be kept warning-free, as long as the fix is So I think now the question would be whether having explicitly named I would like to leave the decision to the core developers. |
Ok. Removing 2.5.3 from the target releases until a decision is made |
My idea was not to remove Py_GCC_ATTRIBUTE but the new macro with If macro name is Py_GCC_FORMAT_ATTRIBUTE then something similar to :
#if !defined(PY_FORMAT_SIZE_T)
#define Py_GCC_FORMAT_ATTRIBUTE(type, str_idx, arg_idx)
#else
#define Py_GCC_FORMAT_ATTRIBUTE(type, str_idx, arg_idx)
Py_GCC_ATTRIBUTE((format(type, str_idx, arg_idx))
#endif and next in the code |
Attached patch just leaves Py_GCC_ATTRIBUTE as it is now. /*
* Hide GCC's format attribute from compilers if one of the following is
true:
* a) the compiler does not support it and not on RISC OS
* b) the compiler does not support "z" printf format specifier
*/
#if ((!defined(__GNUC__) || __GNUC__ < 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 3)) && \
!defined(RISCOS)) || \
!defined(PY_FORMAT_SIZE_T)
#define Py_GCC_FORMAT_ATTRIBUTE(type, str_idx, arg_idx)
/* Py_GCC_ATTRIBUTE is deprecated; use Py_GCC_FORMAT_ATTRIBUTE instead. */
#define Py_GCC_ATTRIBUTE(x)
#else
#define Py_GCC_FORMAT_ATTRIBUTE(type, str_idx, arg_idx) \
__attribute__((format(type, str_idx, arg_idx)))
/* Py_GCC_ATTRIBUTE is deprecated; use Py_GCC_FORMAT_ATTRIBUTE instead. */
#define Py_GCC_ATTRIBUTE(x) __attribute__(x)
#endif |
Martin said: I also wonder whether it is really necessary to complicate the code just so that gcc 2.95 stops producing some warnings. So I propose to close this as "won't fix". Is 2.95 still used much? If not, the above sounds good. |
According to http://gcc.gnu.org/releases.html, gcc 2.95.3 is about 9 years old, so we don't need to care about warnings. |
I agree. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: