[LLVMbugs] [Bug 11333] New: Some line continuations within comments cause false errors or evade warnings

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 8 02:16:55 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11333

             Bug #: 11333
           Summary: Some line continuations within comments cause false
                    errors or evade warnings
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: coknitbit at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 7591
  --> http://llvm.org/bugs/attachment.cgi?id=7591
All testcases

If there are more than one escaped newlines between the two characters in the
comment ending sequence "*/", the code does not compile. If the comment
starting sequence, "//" or "/*", has escaped newlines between the two
characters, clang does not emit a warning.

Here are a few testcases that I think should compile and cause warnings when
clang is invoked in the following manner: clang -Wcomment test.c

cppstyle{1,2,3}.c cause no warnings but should cause one warning each.

cppstyle4_both.c causes one "multi-line // comment" warning. It should cause
another warning similar to the one that should be given in the cases of
cppstyle{1,2,3}.c.

cppstyle5_both_late.c causes one "multi-line // comment" warning. Another
warning should be given like with cppstyle{1,2,3}.c.

cstyle1_end_correct.c correctly causes the warning "escaped newline between */
characters at block comment end".

cstyle2_start.c should cause a warning similar to the one for
cstyle1_end_correct.c.

cstyle3_both.c causes one warning like for cstyle1_end_correct.c but should
cause one warning for each end of the comment, in my opinion.

cstyle4_end_no-compile.c should cause one warning like for
cstyle1_end_correct.c and compile which it currently does not.

As the C language has no bound for the amount of sequential line continuations,
I think the warning should refer to the line that starts such an elongated "//"
or "/*" sequence so the user can easily locate the top of the escape tower.
That is what GCC does for "//" comments. Another option is to refer to the line
of the second character in "//" or "/*" which potentially has some easily
identifiable text.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list