public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109988] New: -iwithprefix doesn't add folder to end of search list
@ 2023-05-26 12:42 ivan.lazaric.gcc at gmail dot com
  2023-05-26 13:22 ` [Bug c++/109988] " ivan.lazaric.gcc at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ivan.lazaric.gcc at gmail dot com @ 2023-05-26 12:42 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/109988] -iwithprefix doesn't add folder to end of search list
  2023-05-26 12:42 [Bug c++/109988] New: -iwithprefix doesn't add folder to end of search list ivan.lazaric.gcc at gmail dot com
@ 2023-05-26 13:22 ` ivan.lazaric.gcc at gmail dot com
  2023-05-26 17:42 ` [Bug preprocessor/109988] " pinskia at gcc dot gnu.org
  2023-05-27  0:42 ` ivan.lazaric.gcc at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ivan.lazaric.gcc at gmail dot com @ 2023-05-26 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ivan Lazaric <ivan.lazaric.gcc at gmail dot com> ---
In `gcc/c-family/c-opts.cc`:
```
    case OPT_iwithprefix:
      add_prefixed_path (arg, INC_SYSTEM);
      break;
```

Should `INC_SYSTEM` actually be `INC_AFTER` ?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/109988] -iwithprefix doesn't add folder to end of search list
  2023-05-26 12:42 [Bug c++/109988] New: -iwithprefix doesn't add folder to end of search list ivan.lazaric.gcc at gmail dot com
  2023-05-26 13:22 ` [Bug c++/109988] " ivan.lazaric.gcc at gmail dot com
@ 2023-05-26 17:42 ` pinskia at gcc dot gnu.org
  2023-05-27  0:42 ` ivan.lazaric.gcc at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-05-26
           Keywords|                            |documentation
          Component|c++                         |preprocessor
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It has been the same as -isystem since at least r0-21114-g0b22d65c9a10ce (March
1999).
The documentation was changed (added to) at r0-35796-gf3c9b8530c78ce (June
2001) to specify the same as -idirafter even though the implementation was
something different ....

I don't know what the correct thing to do really since it has been almost 22
years of having the documentation not match the implementation ...
Maybe just update the documentation ....

Confirmed either way.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug preprocessor/109988] -iwithprefix doesn't add folder to end of search list
  2023-05-26 12:42 [Bug c++/109988] New: -iwithprefix doesn't add folder to end of search list ivan.lazaric.gcc at gmail dot com
  2023-05-26 13:22 ` [Bug c++/109988] " ivan.lazaric.gcc at gmail dot com
  2023-05-26 17:42 ` [Bug preprocessor/109988] " pinskia at gcc dot gnu.org
@ 2023-05-27  0:42 ` ivan.lazaric.gcc at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ivan.lazaric.gcc at gmail dot com @ 2023-05-27  0:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Ivan Lazaric <ivan.lazaric.gcc at gmail dot com> ---
Note that clang has the same flags and behaves according to the documentation,
might be some value in matching it.

If it's considered too breaking of a change, I would recommend introducing a
-iwithprefixafter flag that would add the directory to the end of the include
search list.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-27  0:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 12:42 [Bug c++/109988] New: -iwithprefix doesn't add folder to end of search list ivan.lazaric.gcc at gmail dot com
2023-05-26 13:22 ` [Bug c++/109988] " ivan.lazaric.gcc at gmail dot com
2023-05-26 17:42 ` [Bug preprocessor/109988] " pinskia at gcc dot gnu.org
2023-05-27  0:42 ` ivan.lazaric.gcc at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).