public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/99608] New: gcc doesn't print diagnostics carets when file is passed through stdin
@ 2021-03-15 21:36 freezer at posteo dot de
2021-03-15 21:47 ` [Bug middle-end/99608] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: freezer at posteo dot de @ 2021-03-15 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99608
Bug ID: 99608
Summary: gcc doesn't print diagnostics carets when file is
passed through stdin
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: freezer at posteo dot de
Target Milestone: ---
When a file is passed to gcc through stdin, gcc won't print any diagnostics
carets for the passed file.
Example:
// test.c
int main(int argc, char **argv)
{
return 0;
}
When test.c is passed to gcc through stdin, the following is printed:
$ cat test.c | gcc -Wall -Wextra -xc -
<stdin>: In function ‘main’:
<stdin>:1:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
<stdin>:1:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
(Note that forcing the -fdiagnostics-show-caret option doesn't change anything)
I would have expected the same output as when the file is passed to gcc as an
argument:
$ gcc -Wall -Wextra test.c
test.c: In function ‘main’:
test.c:1:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
1 | int main(int argc, char **argv)
| ~~~~^~~~
test.c:1:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
1 | int main(int argc, char **argv)
| ~~~~~~~^~~~
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/99608] gcc doesn't print diagnostics carets when file is passed through stdin
2021-03-15 21:36 [Bug driver/99608] New: gcc doesn't print diagnostics carets when file is passed through stdin freezer at posteo dot de
@ 2021-03-15 21:47 ` pinskia at gcc dot gnu.org
2021-03-15 22:13 ` freezer at posteo dot de
2021-03-15 22:18 ` freezer at posteo dot de
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-03-15 21:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99608
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Component|driver |middle-end
Resolution|--- |WONTFIX
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is done on purpose. It is based on the original file, rather than the
preprocessed source or otherwise. With stdin, there is no original file being
referenced.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/99608] gcc doesn't print diagnostics carets when file is passed through stdin
2021-03-15 21:36 [Bug driver/99608] New: gcc doesn't print diagnostics carets when file is passed through stdin freezer at posteo dot de
2021-03-15 21:47 ` [Bug middle-end/99608] " pinskia at gcc dot gnu.org
@ 2021-03-15 22:13 ` freezer at posteo dot de
2021-03-15 22:18 ` freezer at posteo dot de
2 siblings, 0 replies; 4+ messages in thread
From: freezer at posteo dot de @ 2021-03-15 22:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99608
--- Comment #2 from freezer at posteo dot de ---
That's too bad. For my use case it would be more efficient if I passed the file
directly to gcc through stdin. There is really no way to change this, maybe
through an option?
With clang this works as expected. The same diagnostics are printed independent
of whether the file was passed through stdin or as a command-line argument.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/99608] gcc doesn't print diagnostics carets when file is passed through stdin
2021-03-15 21:36 [Bug driver/99608] New: gcc doesn't print diagnostics carets when file is passed through stdin freezer at posteo dot de
2021-03-15 21:47 ` [Bug middle-end/99608] " pinskia at gcc dot gnu.org
2021-03-15 22:13 ` freezer at posteo dot de
@ 2021-03-15 22:18 ` freezer at posteo dot de
2 siblings, 0 replies; 4+ messages in thread
From: freezer at posteo dot de @ 2021-03-15 22:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99608
--- Comment #3 from freezer at posteo dot de ---
In my opinion the current behavior is somehow inconsistent since the carets are
displayed for included files.
Example:
// test.cpp
#include <coroutine>
int main(int argc, char **argv)
{
return 0;
}
$ cat test.cpp | g++ -Wall -Wextra -xc++ -
In file included from <stdin>:1:
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/g++-v10/coroutine:295:2: error:
#error "the coroutine header requires -fcoroutines"
295 | #error "the coroutine header requires -fcoroutines"
| ^~~~~
<stdin>: In function ‘int main(int, char**)’:
<stdin>:3:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
<stdin>:3:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-15 22:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 21:36 [Bug driver/99608] New: gcc doesn't print diagnostics carets when file is passed through stdin freezer at posteo dot de
2021-03-15 21:47 ` [Bug middle-end/99608] " pinskia at gcc dot gnu.org
2021-03-15 22:13 ` freezer at posteo dot de
2021-03-15 22:18 ` freezer at posteo dot de
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).