public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "freezer at posteo dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug driver/99608] New: gcc doesn't print diagnostics carets when file is passed through stdin
Date: Mon, 15 Mar 2021 21:36:31 +0000	[thread overview]
Message-ID: <bug-99608-4@http.gcc.gnu.org/bugzilla/> (raw)

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)
      |                    ~~~~~~~^~~~

             reply	other threads:[~2021-03-15 21:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 21:36 freezer at posteo dot de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99608-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).