bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug+Patch] double const after C++ Function declaration (fwd)


From: Santiago Vila
Subject: [Bug+Patch] double const after C++ Function declaration (fwd)
Date: Wed, 3 Jan 2007 15:52:06 +0100 (CET)

Hello.

I received this report from the debian bug system.
[Sorry for the delay in processing it, I believed the To:address@hidden
would work, but being a moderate list it's possible that it didn't ].

BTW: Kind indent maintainers, if you have time and motivation, it would be
wonderful if you could also take a look at the other pending debian reports
about indent:

http://bugs.debian.org/indent

Thanks.

---------- Forwarded message ----------
From: address@hidden
To: address@hidden
Cc: address@hidden
Date: Fri, 20 Jan 2006 21:11:24 +0100 (MET)
Subject: [Bug+Patch] double const after C++ Function declaration

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 */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]