fixincludes applies a bad change to <bits/statx.h> from glibc 2.30. @@ -26,7 +35,7 @@ /* Use "" to work around incorrect macro expansion of the __has_include argument (GCC PR 80005). */ -#if __glibc_has_include ("linux/stat.h") +#if __glibc_has_include ("__linux__/stat.h") # include "linux/stat.h" # ifdef STATX_TYPE # define __statx_timestamp_defined 1
Hrm, may want to fix this for 9.2?
IMHO not needed for 9.2, glibc will just behave as it used to be ever before with this header. I'd say let's fix it in on the trunk, let's fix PR80005 and then we can talk about backporting.
Is this still an issue?
Yes, nothing has changed.
Well, at least PR80005 has been fixed...
PR80005 is not relevant here.
Current glibc uses #ifdef __has_include # if __has_include ("linux/stat.h") # include "linux/stat.h" # ifdef STATX_TYPE # define __statx_timestamp_defined 1 # define __statx_defined 1 # endif # endif #endif instead, is that also broken by fixincludes?
I am having this issue as well, any updates on this bug?
This bug is still happening on gcc 9.2.1.
I'll put it on my to-do list, but I might be participating in a fire evacuation tonight or tomorrow and I haven't built GCC in several years now. I'm going to guess that you have to not do the substitution when the line contains something like: #[ \t]*if[ \t]+__glibc_has
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573676.html
Reworking fixfixes.c seems pretty heavy duty. I'm downloading the GCC sources now. I'll take a peek tomorrow.
Obviously, "print_quote()" was needed early on (1999) and then saved for prosperity :). Your patch is inadequate because it will have to not expand 'linux' in a line such as: #if __has_include(<linux/foo.h>) In other words, it will have to skip over three flavors of quote. Or just two, if you omit apostrophe quotes. In any event, the '<' character will have to be matched with '>', which is a tiny change to the logic. Don't forget to add tests in the final result.
(In reply to Bruce Korb from comment #15) > Obviously, "print_quote()" was needed early on (1999) and then saved for > prosperity :). Your patch is inadequate because it will have to not expand > 'linux' in a line such as: > > #if __has_include(<linux/foo.h>) > > In other words, it will have to skip over three flavors of quote. Or just > two, if you omit apostrophe quotes. In any event, the '<' character will > have to be matched with '>', which is a tiny change to the logic. > > Don't forget to add tests in the final result. Simply skipping <...> can be problematic for something like: #if A < B && i386 && C > D #define USE_I386_WORKAROUND #endif
Revised patch, matching __has_include(...): https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573789.html
The master branch has been updated by Xi Ruoyao <xry111@gcc.gnu.org>: https://gcc.gnu.org/g:6bf383c37e6131a8e247e8a0997d55d65c830b6d commit r12-1924-g6bf383c37e6131a8e247e8a0997d55d65c830b6d Author: Xi Ruoyao <xry111@mengyan1223.wang> Date: Mon Jun 28 13:54:58 2021 +0800 fixinc: don't "fix" machine names in __has_include(...) [PR91085] fixincludes/ PR other/91085 * fixfixes.c (check_has_inc): New static function. (machine_name_fix): Don't replace header names in __has_include(...). * inclhack.def (machine_name): Adjust test. * tests/base/testing.h: Update.