bug-indent
[Top][All Lists]
Advanced

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

RE: [Bug-indent] No space before `*' in declarations


From: David
Subject: RE: [Bug-indent] No space before `*' in declarations
Date: Sat, 7 Dec 2002 10:01:55 -0000

Pavel,
Thank you for your update. It will be handled when I reach it in the
backlog that has unfortunately built up. Some remarks:

1) Your previous patch has not been ignored - I just have not had time
to check it yet.
2) Your patch will just cause another flurry of complaints because
others do not want indent to change its output the way you do. To have
this style supported will need a switch to set it on for those who do
want it and leave things the way they are for the rest.
3) Have you read-up and tried the -T option to tell indent that
"foo_t"is a type that should be treated the same as char and the like?


David.

-----Oorspronkelijk bericht-----
Van: address@hidden [mailto:address@hidden Namens
Pavel Roskin
Verzonden: 07 December 2002 02:18
Aan: address@hidden
Onderwerp: [Bug-indent] No space before `*' in declarations

Hello!

My previous patch was ignored:
http://mail.gnu.org/pipermail/bug-indent/2002-September/000493.html

Let me try one more time.  This patch is different because it fixes the
space not only in function definitions, but also in function
declarations.
Also it only applies to "*".  Other binary operators are still followed
by
space, although I don't think you can find them in declarations and
definitions.

=========================
--- src/indent.c
+++ src/indent.c
@@ -1039,7 +1039,11 @@ static exit_values_ty indent (
                     }
                 }

-                parser_state_tos->want_blank = true;
+                /* no space after * in declarations and definitions */
+
+                parser_state_tos->want_blank = !(token[0] == '*'
+                                                 && parser_state_tos->
+                                                    procname[0] !=
'\0');
                 break;

             case postop:                /* got a trailing ++ or -- */
=========================

Test file:
=========================
int f (foo_t *a, char *b);
int
f (foo_t *a, char *b)
{
    char *c;
    foo_t *d;
    return 1 * 2;
}
=========================

I also tested patched indent on large C files, and the difference from
indent 2.2.8 is only what I expect it to be.

There is an alternative solution that can be considered by those who
know
the code better.  I believe that lexi() should return decl for "foo_t
*a",
just like it would do for "struct foo_t *a"

If you look for "The following hack" in lexi.c, it doesn't check if the
parser is working with function arguments.  I don't feel save about
changing that huge condition without having the testsuite.

-- 
Regards,
Pavel Roskin


_______________________________________________
Bug-indent mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-indent




reply via email to

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