From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29783 invoked by alias); 1 Feb 2011 16:28:17 -0000 Received: (qmail 29766 invoked by uid 22791); 1 Feb 2011 16:28:15 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Feb 2011 16:28:11 +0000 Received: (qmail 8875 invoked from network); 1 Feb 2011 16:28:09 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 1 Feb 2011 16:28:09 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [doc/gdbint] Mention some formatting guidelines for casts and unary operators Date: Tue, 01 Feb 2011 16:28:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-25-generic; KDE/4.5.1; x86_64; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201102011628.32860.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00006.txt.bz2 This is a follow up to a discussion from last November , that sort of came up today again. It imports and casts to stone these recommendations (from GCC): Use... ...instead of !x ! x ~x ~ x -x (unary minus) - x (foo) x (cast) (foo)x *x (pointer dereference) * x which we have been largely following already anyway. Okay? -- Pedro Alves 2011-02-01 Pedro Alves * gdbint.texinfo (Formatting): Mention some formatting guidelines for casts and unary operators. --- gdb/doc/gdbint.texinfo | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) Index: src/gdb/doc/gdbint.texinfo =================================================================== --- src.orig/gdb/doc/gdbint.texinfo 2011-01-13 15:07:50.000000000 +0000 +++ src/gdb/doc/gdbint.texinfo 2011-02-01 16:08:47.184645005 +0000 @@ -5785,7 +5785,8 @@ compiler. @cindex source code formatting The standard GNU recommendations for formatting must be followed -strictly. +strictly. Any @value{GDBN}-specific deviation from GNU +recomendations is described below. A function declaration should not have its name in column zero. A function definition should have its name in column zero. @@ -5828,6 +5829,27 @@ void * foo; void* foo; @end smallexample +In addition, whitespace around casts and unary operators should follow +the following guidelines: + +@multitable @columnfractions .2 .2 .8 +@item Use... @tab ...instead of @tab + +@item @code{!x} +@tab @code{! x} +@item @code{~x} +@tab @code{~ x} +@item @code{-x} +@tab @code{- x} +@tab (unary minus) +@item @code{(foo) x} +@tab @code{(foo)x} +@tab (cast) +@item @code{*x} +@tab @code{* x} +@tab (pointer dereference) +@end multitable + @subsection Comments @cindex comment formatting