[ofa-general] [PATCH resend] opensm/osm_indent:

Eitan Zahavi eitan at mellanox.co.il
Mon Jul 23 11:05:23 PDT 2007


Hi Sasha,

I read the new coding style doc after this last mail.
I thought you only defined new "indentation rules" and I am for doing
this step as it is automatic and safe.
But rewriting the code with shorter names and replacing all variables 
and functions seems a little too risky in my mind.


Eitan Zahavi
Senior Engineering Director, Software Architect
Mellanox Technologies LTD
Tel:+972-4-9097208
Fax:+972-4-9593245
P.O. Box 586 Yokneam 20692 ISRAEL

 

> -----Original Message-----
> From: Sasha Khapyorsky [mailto:sashak at voltaire.com] 
> Sent: Monday, July 23, 2007 4:09 PM
> To: Eitan Zahavi
> Cc: general at lists.openfabrics.org; Yevgeny Kliteynik
> Subject: Re: [ofa-general] [PATCH resend] opensm/osm_indent: 
> go closertoopensm-coding-style.txt
> 
> On 10:31 Mon 23 Jul     , Eitan Zahavi wrote:
> > 
> > So we will finally have a common enforced coding style!
> > When do you plan to run it on all the files?
> 
> In the "spare" time :). I'm thinking about doing this in 
> steps by subdirectories starting from header files. Also 
> would be nice to not do huge styling updates during OFED 1.3 cycle.
> 
> > Or should we just make sure every new committed file will 
> first pass 
> > this indent?
> 
> This is the good option, however would be nice to not mix 
> style fixing patches with functional ones (more or the less 
> as described in opensm/doc/opensm-coding-style.txt).
> 
> Sasha
> 
> > 
> > Thanks
> > 
> > Eitan
> > 
> > Eitan Zahavi
> > Senior Engineering Director, Software Architect Mellanox 
> Technologies 
> > LTD
> > Tel:+972-4-9097208
> > Fax:+972-4-9593245
> > P.O. Box 586 Yokneam 20692 ISRAEL
> > 
> >  
> > 
> > > -----Original Message-----
> > > From: general-bounces at lists.openfabrics.org
> > > [mailto:general-bounces at lists.openfabrics.org] On Behalf Of Sasha 
> > > Khapyorsky
> > > Sent: Monday, July 23, 2007 1:15 AM
> > > To: general at lists.openfabrics.org
> > > Cc: Yevgeny Kliteynik
> > > Subject: [ofa-general] [PATCH resend] opensm/osm_indent: 
> go closer 
> > > toopensm-coding-style.txt
> > > 
> > > 
> > > This updates the script according to recent 
> > > doc/opensm-coding-style.txt (in short K&R, tabs, etc.).
> > > 
> > > Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> > > ---
> > >  opensm/opensm/osm_indent |   57 
> > > +++------------------------------------------
> > >  1 files changed, 4 insertions(+), 53 deletions(-)
> > > 
> > > diff --git a/opensm/opensm/osm_indent b/opensm/opensm/osm_indent 
> > > index bed2ba1..621184b 100755
> > > --- a/opensm/opensm/osm_indent
> > > +++ b/opensm/opensm/osm_indent
> > > @@ -1,6 +1,6 @@
> > >  #!/bin/bash
> > >  #
> > > -# Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
> > > +# Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
> > >  # Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights 
> > > reserved.
> > >  # Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
> > >  #
> > > @@ -40,56 +40,7 @@
> > >  #  Environment:
> > >  #  	Linux User Mode
> > >  #
> > > -#  $Revision: 1.4 $
> > > -#
> > > -#
> > > -# This is the indent format used for OpenSM.
> > > -#
> > > -# format the source code according to the ACD standard
> > > -# -bad	Blank line after declarations
> > > -# -bap	Blank line after Procedures
> > > -# -bbb	Blank line before block comments
> > > -# -nbbo	Break after Boolean operator
> > > -# -bl	Break after if line
> > > -# -bli0 Indent for braces is 0
> > > -# -bls	Break after struct declarations
> > > -# -cbi0	Case break indent 0
> > > -# -ci3	Continue indent 3 spaces
> > > -# -cli0	Case label indent 0 spaces
> > > -# -ncs	No space after cast operator
> > > -# -hnl	Honor existing newlines on long lines
> > > -# -i3	Substitute indent with 3 spaces
> > > -# -npcs	No space after procedure calls
> > > -# -prs	Space after parenthesis
> > > -# -nsai	No space after if keyword - removed
> > > -# -nsaw	No space after while keyword - removed
> > > -# -sc	Put * at left of comments in a block comment style
> > > -# -nsob	Don't swallow unnecessary blank lines
> > > -# -ts3	Tab size is 3
> > > -# -psl	Type of procedure return in a separate line
> > > -# -bfda	Function declaration arguments in a separate line.
> > > -# -nut   No tabs as we allow spaces
> > > -#
> > > -#############################################################
> > > ############
> > > -
> > > -# indent the world
> > > -for sourcefile in $*; do
> > > -    if test -f "$sourcefile"; then
> > > -        # first, string DOS style linefeeds
> > > -        perl -piW -e's/\x0D//' "$sourcefile"
> > > -        echo Processing $sourcefile
> > > -        indent -bad -bap -bbb -nbbo -bl -bli0 -bls -cbi0 
> > > -ci3 -cli0 -ncs \
> > > -                -hnl -i3 -npcs -prs -sc -nsob -ts3 -psl 
> > > -bfda -nut $sourcefile
> > > -
> > > -        rm ${sourcefile}W
> > > +# This is the indent format used for OpenSM (similar to one
> > > used in #
> > > +linux/scripts/Lindent).
> > >  
> > > -        # the -bb also affect the first line in each file - 
> > > so clean it up
> > > -        if test `head -1 $sourcefile | egrep -v '^$' | wc 
> > > -l` = 0; then
> > > -            echo Cleaning up first empty line of $sourcefile
> > > -            awk '{if(n){print};n++}' $sourcefile > ${sourcefile}W
> > > -            mv -f ${sourcefile}W $sourcefile
> > > -        fi
> > > -    else
> > > -        echo Could not find file:$sourcefile
> > > -    fi
> > > -done
> > > +indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@"
> > > --
> > > 1.5.3.rc2.29.gc4640f
> > > 
> > > _______________________________________________
> > > general mailing list
> > > general at lists.openfabrics.org
> > > http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> > > 
> > > To unsubscribe, please visit
> > > http://openib.org/mailman/listinfo/openib-general
> > > 
> 



More information about the general mailing list