public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eggert at cs dot ucla.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/98021] #warning issues redundant diagnostic lines
Date: Sat, 28 Nov 2020 18:54:00 +0000	[thread overview]
Message-ID: <bug-98021-4-KXteEpn7XX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98021-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from eggert at cs dot ucla.edu ---
(In reply to Andreas Schwab from comment #10)
> See the #line directive.

GCC already treats that case differently, and it can continue to do so.

Come to think of it, GCC works better with #line than it does without. GCC
should treat the ordinary case more like it already treats the #line case,
except that GCC shouldn't say "warning" twice of course (it sounds like an old
episode of "Lost in Space" :-).

::::::::::::::
foo.c
::::::::::::::
#include "bar.h"
::::::::::::::
bar.h
::::::::::::::
#warning "You are too close to the curb"
#line 100 "baz.h"
#warning "Tomorrow is the deadline for paying taxes"


$ gcc -S foo.c
In file included from foo.c:1:
bar.h:1:2: warning: #warning "You are too close to the curb" [-Wcpp]
    1 | #warning "You are too close to the curb"
      |  ^~~~~~~
In file included from foo.c:1:
baz.h:100:2: warning: #warning "Tomorrow is the deadline for paying taxes"
[-Wcpp]

  parent reply	other threads:[~2020-11-28 18:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 23:53 [Bug preprocessor/98021] New: " eggert at cs dot ucla.edu
2020-11-27  0:03 ` [Bug preprocessor/98021] " pinskia at gcc dot gnu.org
2020-11-27  2:14 ` eggert at cs dot ucla.edu
2020-11-27  5:34 ` egallager at gcc dot gnu.org
2020-11-27  7:36 ` rguenth at gcc dot gnu.org
2020-11-27 11:18 ` schwab@linux-m68k.org
2020-11-27 11:54 ` schwab@linux-m68k.org
2020-11-28  1:30 ` eggert at cs dot ucla.edu
2020-11-28  8:11 ` schwab@linux-m68k.org
2020-11-28 17:28 ` eggert at cs dot ucla.edu
2020-11-28 17:52 ` schwab@linux-m68k.org
2020-11-28 18:54 ` eggert at cs dot ucla.edu [this message]
2020-11-28 19:45 ` schwab@linux-m68k.org
2020-11-28 20:29 ` eggert at cs dot ucla.edu
2020-11-28 21:06 ` schwab@linux-m68k.org
2020-11-29  1:23 ` eggert at cs dot ucla.edu
2020-11-29  8:09 ` schwab@linux-m68k.org
2021-02-10 20:37 ` dmalcolm at gcc dot gnu.org

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-98021-4-KXteEpn7XX@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).