public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Dvorak <johnydog@go.cz>
To: Jamie Lokier <egcs@tantalophile.demon.co.uk>
Cc: Craig Rodrigues <rodrigc@mediaone.net>, gcc@gcc.gnu.org
Subject: Re: warning: multi-line comment (why?)
Date: Tue, 19 Sep 2000 09:05:00 -0000	[thread overview]
Message-ID: <20000919180308.A7018@napalm.go.cz> (raw)
In-Reply-To: <20000918120419.C17692@pcep-jamie.cern.ch>

On Mon, Sep 18, 2000 at 12:04:19PM +0200, Jamie Lokier wrote:
> Richard Henderson wrote:
> > > What is the point of this warning?  Shouldn't the preprocessor
> > > just ignore everything between the // and the end-of-line?
> > 
> > No, backslash-newline conversion happens before comments
> > are discarded.  You really do have a multi-line comment;
> > one that would be dangerous if your next line weren't a
> > comment as well.
> 
> But the next line _is_ a comment so the warning is inappropriate here.
>
> If this were a very unlikely situation, fair enough.  But people do
> comment out multi-line macros from time to time using `//', and those
> will trigger the warning.

If you comment out macros during development, you may ignore this warning.
If you need commented macro in release, you have to comment it by /**/.

Multiline comment are dangerous, and even if next line begins with '//', it
is not the right way.

> It can't be too hard to skip whitespace and then check for `//' on the
> next line I'm sure.

I think it can be difficult. Referring to cpplex.c:

/* Skip a C++ line comment.  Handles escaped newlines.  Returns
   non-zero if a multiline comment.  The following new line, if any,
   is left in buffer->read_ahead.  */
static int
skip_line_comment (buffer)
     cpp_buffer *buffer;
{

...
      	return orig_lineno != buffer->lineno;
}

so you'll need lot of readahead and lot of work to get it working right.

Jan Dvorak <johnydog@go.cz>

  reply	other threads:[~2000-09-19  9:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-17 15:53 Craig Rodrigues
2000-09-17 16:12 ` Jan Dvorak
2000-09-17 16:26 ` Richard Henderson
2000-09-18  3:04   ` Jamie Lokier
2000-09-19  9:05     ` Jan Dvorak [this message]
2000-09-19 10:13       ` Jamie Lokier
2000-09-19 11:44         ` Jan Dvorak
     [not found]         ` <20000919214025.A30587@daikokuya.demon.co.uk>
     [not found]           ` <20000919214320.A30677@daikokuya.demon.co.uk>
2000-09-20  8:52             ` Jamie Lokier
2000-09-20  9:38               ` Neil Booth
2000-09-25 12:52                 ` Jamie Lokier
2000-09-25 14:10                   ` Neil Booth
2000-09-25 14:34                     ` Joern Rennecke
     [not found]                   ` <20000925222224.B24101@daikokuya.demon.co.uk>
     [not found]                     ` <20000926001457.A12405@daikokuya.demon.co.uk>
2000-09-26 10:15                       ` Varargs macros subtly broken Jamie Lokier
     [not found] <20000925230543.A28863@daikokuya.demon.co.uk>
2000-09-25 15:18 ` warning: multi-line comment (why?) Joern Rennecke
2000-09-25 15:53   ` Neil Booth
2000-09-25 16:39     ` Joern Rennecke
2000-09-26  3:43     ` Jamie Lokier
2000-09-26 10:13       ` Neil Booth

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=20000919180308.A7018@napalm.go.cz \
    --to=johnydog@go.cz \
    --cc=egcs@tantalophile.demon.co.uk \
    --cc=gcc@gcc.gnu.org \
    --cc=rodrigc@mediaone.net \
    /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).