From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Dvorak To: Jamie Lokier Cc: Craig Rodrigues , gcc@gcc.gnu.org Subject: Re: warning: multi-line comment (why?) Date: Tue, 19 Sep 2000 09:05:00 -0000 Message-id: <20000919180308.A7018@napalm.go.cz> References: <20000917185453.A14829@mediaone.net> <20000917162647.A19521@cygnus.com> <20000918120419.C17692@pcep-jamie.cern.ch> X-SW-Source: 2000-09/msg00446.html 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