uninclude: Add lib/gcc/<anything>/include as an possible include dir

Message ID 20250917011624.1671897-1-andrew.pinski@oss.qualcomm.com
State Committed
Commit 2664206495418ab5d09d9f00a0cc9af94f29b871
Headers
Series uninclude: Add lib/gcc/<anything>/include as an possible include dir |

Commit Message

Andrew Pinski Sept. 17, 2025, 1:16 a.m. UTC
  While running uninclude on PR99912's preprocessed source uninclude
didn't uninclude some of the x86_64 target headers. This was because
`lib/gcc/<anything>/include` was not noticed as an possible system
include dir. It supported `gcc-lib/<anything>/include` though.

contrib/ChangeLog:

	* uninclude: Add `lib/gcc/<anything>/include`.
---
 contrib/uninclude | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Richard Biener Sept. 17, 2025, 6:45 a.m. UTC | #1
On Wed, Sep 17, 2025 at 3:18 AM Andrew Pinski
<andrew.pinski@oss.qualcomm.com> wrote:
>
> While running uninclude on PR99912's preprocessed source uninclude
> didn't uninclude some of the x86_64 target headers. This was because
> `lib/gcc/<anything>/include` was not noticed as an possible system
> include dir. It supported `gcc-lib/<anything>/include` though.

OK, but I'll note that sometimes this can break things given new
intrinsics can be added in later compilers only.

> contrib/ChangeLog:
>
>         * uninclude: Add `lib/gcc/<anything>/include`.
> ---
>  contrib/uninclude | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/uninclude b/contrib/uninclude
> index 5612e655a98..f445bfeeb05 100755
> --- a/contrib/uninclude
> +++ b/contrib/uninclude
> @@ -27,13 +27,14 @@
>
>  # Header files whose pathnames contain any of the following patterns
>  # are considered as standard headers: usr/include, g++-include,
> -# include/g++, include/c++/<version>, gcc-lib/<anything>/include.
> +# include/g++, include/c++/<version>, gcc-lib/<anything>/include,
> +# lib/gcc/<anything>/include.
>
>  gawk ${EXCLUDEPATT+-vexclude="$EXCLUDEPATT"} \
>       ${INCLUDEPATT+-vinclude="$INCLUDEPATT"} '
>  BEGIN {
>    skipping = 0;
> -  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
> +  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|lib/gcc/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
>  }
>  !skipping && $0 ~ cppline &&
>  (exclude == "" || $3 !~ exclude) && (include == "" || $3 ~ include) {
> --
> 2.43.0
>
  
Andrew Pinski Sept. 17, 2025, 7:42 p.m. UTC | #2
On Tue, Sep 16, 2025 at 11:45 PM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Wed, Sep 17, 2025 at 3:18 AM Andrew Pinski
> <andrew.pinski@oss.qualcomm.com> wrote:
> >
> > While running uninclude on PR99912's preprocessed source uninclude
> > didn't uninclude some of the x86_64 target headers. This was because
> > `lib/gcc/<anything>/include` was not noticed as an possible system
> > include dir. It supported `gcc-lib/<anything>/include` though.
>
> OK, but I'll note that sometimes this can break things given new
> intrinsics can be added in later compilers only.

Understood, though in the case of PR99912, the uninclude is needed due
to the removal of Xeon Phi ISA support in GCC 15. The AVX10_256
support was also removed in GCC 15 which will have a similar effect on
other preprocessed sources too.
I am not saying uninclude is perfect here though but it definitely
helped to get a compilable testcase for PR  99912 again.

Thanks,
Andrew

>
> > contrib/ChangeLog:
> >
> >         * uninclude: Add `lib/gcc/<anything>/include`.
> > ---
> >  contrib/uninclude | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/contrib/uninclude b/contrib/uninclude
> > index 5612e655a98..f445bfeeb05 100755
> > --- a/contrib/uninclude
> > +++ b/contrib/uninclude
> > @@ -27,13 +27,14 @@
> >
> >  # Header files whose pathnames contain any of the following patterns
> >  # are considered as standard headers: usr/include, g++-include,
> > -# include/g++, include/c++/<version>, gcc-lib/<anything>/include.
> > +# include/g++, include/c++/<version>, gcc-lib/<anything>/include,
> > +# lib/gcc/<anything>/include.
> >
> >  gawk ${EXCLUDEPATT+-vexclude="$EXCLUDEPATT"} \
> >       ${INCLUDEPATT+-vinclude="$INCLUDEPATT"} '
> >  BEGIN {
> >    skipping = 0;
> > -  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
> > +  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|lib/gcc/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
> >  }
> >  !skipping && $0 ~ cppline &&
> >  (exclude == "" || $3 !~ exclude) && (include == "" || $3 ~ include) {
> > --
> > 2.43.0
> >
  

Patch

diff --git a/contrib/uninclude b/contrib/uninclude
index 5612e655a98..f445bfeeb05 100755
--- a/contrib/uninclude
+++ b/contrib/uninclude
@@ -27,13 +27,14 @@ 
 
 # Header files whose pathnames contain any of the following patterns
 # are considered as standard headers: usr/include, g++-include,
-# include/g++, include/c++/<version>, gcc-lib/<anything>/include.
+# include/g++, include/c++/<version>, gcc-lib/<anything>/include,
+# lib/gcc/<anything>/include.
 
 gawk ${EXCLUDEPATT+-vexclude="$EXCLUDEPATT"} \
      ${INCLUDEPATT+-vinclude="$INCLUDEPATT"} '
 BEGIN { 
   skipping = 0; 
-  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
+  cppline = "^# [0-9]+ \"[^\"]*/(usr/include|g\\+\\+-include|include/g\\+\\+|include/c\\+\\+/[^/]+|gcc-lib/[^\"]+/include|lib/gcc/[^\"]+/include|gcc/include)/([^\"]+)\"( [1-4])*$"
 }
 !skipping && $0 ~ cppline && 
 (exclude == "" || $3 !~ exclude) && (include == "" || $3 ~ include) {