This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] [doc patch] gdbint: braces for two lines in code [Re: [patch] Fix for PR gdb/9538 (loading of separate debuginfo and symlinks).]
On Fri, 13 Jan 2012 13:39:14 +0100, Eli Zaretskii wrote:
> > > Any two or more lines in code should be wrapped in braces, even if
> > > they are comments, as they look as separate statements:
> > ^^ like ?
>
> Fine with me, FWIW.
Checked in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2012-01/msg00125.html
--- src/gdb/doc/ChangeLog 2012/01/11 10:34:21 1.1263
+++ src/gdb/doc/ChangeLog 2012/01/13 14:31:55 1.1264
@@ -1,3 +1,9 @@
+2012-01-13 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Eli Zaretskii <eliz@gnu.org>
+
+ * gdbint.texinfo (Coding Standards): Require braces for two lines of
+ code.
+
2012-01-11 Paul Hilfinger <hilfingr@adacore.com>
* gdb.texinfo (Variables): Document use of :: for non-static
--- src/gdb/doc/gdbint.texinfo 2012/01/05 09:41:03 1.334
+++ src/gdb/doc/gdbint.texinfo 2012/01/13 14:31:55 1.335
@@ -5849,6 +5849,26 @@
@tab (pointer dereference)
@end multitable
+Any two or more lines in code should be wrapped in braces, even if
+they are comments, as they look like separate statements:
+
+@smallexample
+if (i)
+ @{
+ /* Return success. */
+ return 0;
+ @}
+@end smallexample
+
+@noindent
+and not:
+
+@smallexample
+if (i)
+ /* Return success. */
+ return 0;
+@end smallexample
+
@subsection Comments
@cindex comment formatting