I wrote:
CBFalconer wrote:
If we are agreed on that then the only thing to discuss is whether, having selected the nested/non-nested formats, the appearance of an open-comment marker in a comment should trigger a warning. It is certainly not an error. I consider the warning should always appear, but others may differ. I would call this warn on possible unclosed comments.
I think a warning could be useful, but not always on, i.e. another option. I wouldn't mind if it's on by default. Maybe even in standard modes (though this construct is standard-compliant, we do warn about other standard-compliant constructs, such as unused variables.)
I think we can neatly reuse existing options. `-Wnested-comments' and `--nested-comments' give us 4 combinations which cover just the cases anyone might prefer.
Consider the input `{ { }'.
-Wno-nested-comments --no-nested-comments
nothing, regular comment
(This is the default and standard-conformant.)
-Wnested-comments --no-nested-comments
warning: comment opener found within comment
(This is what Chuck suggests. I'm implementing this in the next release.)
-Wno-nested-comments --nested-comments
unterminated comment
(GPC extension)
-Wnested-comments --nested-comments
warning: nested comments are a GPC extension
unterminated comment
(GPC extension plus warning when it's used)
Note that `-Wnested-comments' has a slightly different meaning with and without `--nested-comments', but actually not too different since the situations where the warning appears are exactly the same in both cases, so I think it's better this way than adding another option.
Frank