-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Disable GCC warnings/errors about wrong self casts in final function calls #6039
Conversation
I plan to test this today in Fedora with lxml, scikit-learn and jnius. |
lxml works. jnius 1.6.1 passed with the gentoo patch but fails with this one:
|
scikit-learn says:
But compiles :) |
I suppose scikit-learn has both C and C++ sources and the -Wincompatible-pointer-types thing only makes it fail on C sources. Perhaps we should only add the pragma if it is C. |
git clean -xdf tar zcvf ../python-cython_3.0.8.orig.tar.gz --exclude=.git . debuild -uc -us cp python-cython.spec ../python-cython_3.0.8-1.spec cp ../python*-cython*3.0.8*.{gz,xz,spec,dsc} /osc/home\:alvistack/cython-cython-3.0.8/ rm -rf ../python*-cython*3.0.8*.* ../cython3*3.0.8*.* See cython#6039 Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
To me the error in jnius looks like it's in their code rather than in Cython. (I could be wrong though.) |
Yes, the jnius error seems different. What about the C++ thing? I was looking at the code trying to figure out if we are in C++ file, but I think the function does not know that. |
Perhaps |
Thanks. Retrying. |
lxml good, scikit-learn good, jnius the same. Looking good! |
Hmm .. but why those warnings are swiped under the carpet? 🤔 |
Hmm .. but why those warnings are swiped under the carpet? 🤔
Because they don't help anyone and now turn into errors in recent gcc versions, which is even more unhelpful.
|
@scoder There are serious issues with this fix
While (1) would be trivial to fix with just one added line, (2) requires a refactor. Given that this issue is for a a new GCC version, you can conditionally define two begin/end macros using C99 |
There is no push needed before ignore. Pop restores the default. |
@hroncok What pull are you talking about? |
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
I think we all agree this is only a temporary solution though |
I think this was just a typo for |
Suppose a user includes external C code with a line #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" because she wants to ignore the warning for whatever reason. Afterwards, Cython generates code with #pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
...
#pragma GCC diagnostic pop Therefore, without an |
Apologies, when I said "pull" I meant "pop". |
I think this is going to be really rare. It's much easier to pass the argument globally via CFLAGS than to try to apply it locally with a C code include. |
If this is a temporary workaround as @da-woods said, then I'll not make a big deal out of it and we can all forget about my original complaint. However, if it is going to be a permanent thing, then the implementation has to improve. Let's not second-guess users and/or find excuses for bad/sloppy code, even more when the fix is as trivial as generating an extra line with |
I would also like to point out that prior code (in |
There's going to be a new 3.0.x release at some point – stop fighting and send me a PR already. :) |
See #2747