Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-format breaks C syntax when breaking a C comment before a forward slash #21270

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR21271
Status NEW
Importance P normal
Reported by weiehpcc@gmail.com
Reported on 2014-10-14 07:39:20 -0700
Last modified on 2015-07-15 05:25:13 -0700
Version 3.6
Hardware PC Windows NT
CC djasper@google.com, klimek@google.com, malcolm.parsons@gmail.com
Fixed by commit(s)
Attachments regrCCommentSlash.h (291 bytes, text/plain)
commentslash.h (95 bytes, text/x-chdr)
Blocks
Blocked by
See also
Created attachment 13200
Example source file for reproducing the problem

Again (as in bug 21259 and bug 21261), in sequences of C comments, clang-format
gets confused.

In this case, a single "/" inside the second comment leads clang-format to
ending the comment inside the original one, which itself produces syntax
errors. See attachement for an example.

Again, the configuration used can be found in attachment 13195.
Quuxplusone commented 10 years ago

Attached regrCCommentSlash.h (291 bytes, text/plain): Example source file for reproducing the problem

Quuxplusone commented 9 years ago
This happens without a sequence of C comments directly following each other:

$ cat commentslash.h

/* Blah blah blah blah blah blah blah blah blah blah process the file
/foo/bar/baz/quux
 **/

$ clang-format-3.6 --style=LLVM commentslash.h

/* Blah blah blah blah blah blah blah blah blah blah process the file
 */foo/bar/baz/quux
 **/

Expected:

/* Blah blah blah blah blah blah blah blah blah blah process the file
 * /foo/bar/baz/quux
 **/
Quuxplusone commented 9 years ago

Attached commentslash.h (95 bytes, text/x-chdr): commentslash.h