Package: indent
Version: 2.2.9-6

Hello,

Debian Bug System CCed as I use Debian, but I can reproduce the Problem on
cygwin, too.

see the Following problem:
saturn:~$ indent  --version
GNU indent: 2.2.9
saturn:~$ cat test.cpp
#include <iostream>
#include <string>
#include "test.hpp"


const int &
     test::test () const
     {
     }
saturn:~$ indent -o /dev/stdout test.cpp
#include <iostream>
#include <string>
#include "test.hpp"


const int &
test::test () const const
{
}


Notice the double const after test in the Output.
After applying the Attached Patch the Output looks Sytactically correct --
but the formation is still not as expected -- but can be easily fixed by
the editor:

saturn:~/indent-2.2.9/src$ ./indent  -o /dev/stdout  ../../test.cpp
#include <iostream>
#include <string>
#include "test.hpp"


const int &
test::test ()
     const
     {
     }


I have include a little bit more environment to include the comment -- is
it still correct? I have run the regression TEST with this change and no
difference, perhaps you can include my example Program into this Testsuite
Perhaps include some other Programs to further test this part of the code?

Best Regards,
  Thorsten Wilmer


diff -r -U12 indent-2.2.9-org/src/indent.c indent-2.2.9/src/indent.c
--- indent-2.2.9-org/src/indent.c       2002-10-28 21:00:56.000000000 +0100
+++ indent-2.2.9/src/indent.c   2006-01-20 20:36:32.000000000 +0100
@@ -1426,25 +1427,25 @@
     exit_values_ty * file_exit_value)
 {
     /* handle C++ const function declarations like
      * const MediaDomainList PVR::get_itsMediaDomainList() const
      * {
      * return itsMediaDomainList;
      * }
      * by ignoring "const" just after a parameter list */

     if ((parser_state_tos->last_token == rparen) &&
         parser_state_tos->in_parameter_declaration &&
         parser_state_tos->saw_double_colon &&
-        !strncmp (token, "const", 5))
+        ! (strncmp (token, "const", 5)==0))
     {
         char           * t_ptr;
         set_buf_break (bb_const_qualifier, paren_target);
         *e_code++ = ' ';

         for (t_ptr = token; t_ptr < token_end; ++t_ptr)
         {
             check_code_size();
             *e_code++ = *t_ptr;
         }

         *e_code = '\0';     /* null terminate code sect */





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to