https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109988

            Bug ID: 109988
           Summary: -iwithprefix doesn't add folder to end of search list
           Product: gcc
           Version: 11.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ivan.lazaric.gcc at gmail dot com
  Target Milestone: ---

```
echo | g++ -iprefix "./" -iwithprefix "."  -E -v -
```

Snippet of output:
```
#include <...> search starts here:
 ./.
 /usr/lib/gcc/x86_64-linux-gnu/11/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
```

Issue is that "./." is at the front of the list, should be at bottom.

Snippet of `man g++`:
```
-iprefix prefix
           Specify prefix as the prefix for subsequent -iwithprefix options. 
If the prefix
           represents a directory, you should include the final /.

       -iwithprefix dir
       -iwithprefixbefore dir
           Append dir to the prefix specified previously with -iprefix, and add
the
           resulting directory to the include search path.  -iwithprefixbefore
puts it in
           the same place -I would; -iwithprefix puts it where -idirafter
would.
```

^ implying `-iwithprefix` should behave like `-idirafter`

`echo | g++ -idirafter "./." -E -v -`:
```
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/11/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
 ./.
End of search list.
```

Related to: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34502

Reply via email to