Re: a simple formatter

From: Amos Jeffries <squid3@dont-contact.us>
Date: Sat, 09 Feb 2008 01:23:00 +1300

Tsantilas Christos wrote:
>> On Fri, 2008-02-08 at 16:10 +1300, Amos Jeffries wrote:
>>
>> The "same()" operations used in those tests may be different from a
>> "same_MD5s()" operation.
>>
>> Try inserting an empty line in a middle of a function and recompile. You
>> will get a different MD5. Stripping the executable does not help in my
>> tests......................
>
> Yes this is true. I tried exactly the same tests to evaluate the
> formatter, but they did not work. I believed that striping the code will
> solve the problem but nothing...
> In general I was not able to find a safe way to test it. I am just looking
> the diffs searching for bad formated code ...
> (Also I must note here that the bazaar repository was very-very helpful
> here, branches/revert/diff etc on local repositories are really fast, but
> OK it is an other story :-) )
>
>> ................... Stripping empty lines fron sources does not help if
> the formatter
>> moves brackets and such, changing the number of lines. Does our
>> formatter do that?
>>
> Yes it does. For example the code:
> void some_function(){
> }
> convert to:
> void some_function()
> {
> }

that would be desired behaviour though, yes?

While I am away, the attached file is the set of test cases I have seen
enough in the Squid-3 source to note as having bad syntax somehow
(probably astyle previously). Along with a few I threw in just because
the developer doc page described the syntax specially.

If anyone has other please speak up and we'll get the lot testing properly.

Amos

-- 
Please use Squid 2.6STABLE17+ or 3.0STABLE1+
There are serious security advisories out on all earlier releases.

/*
  A code-formating tool is wanted fro squid3

  However teh squid sources use a number of syntax constructs which it must be capable of handling.

  This file is a dead-code file containing demos of those syntax which are known to be formatted badly at times

  It is to be used as the desired control to test formattign output against.
*/

/// structures with bit-fields
struct t1 {
    unsigned int a:1;
    unsigned int b:1;
    unsigned int c:1;
};

/// code-blocks inside definition protection
#if SOMETHING
{
    ;
}
#endif

/// regular function declarations
void
main(int argc, char *argv[])
{
    ;
}

/// template class explicit Instantiation for some compilers
template class ACLStrategised<HttpHeader*>;

/// global template Instances with macro definition
template cbdata_type List<int>::CBDATA_List;
Received on Fri Feb 08 2008 - 05:22:51 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:09 MST