bug-indent
[Top][All Lists]
Advanced

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

Bug#594851: indent: Recognizes typedefs in declarations, but not paramet


From: Santiago Vila
Subject: Bug#594851: indent: Recognizes typedefs in declarations, but not parameters or casts; fails to consistently handle "type *" (fwd)
Date: Sun, 4 Mar 2012 18:57:25 +0100 (CET)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

Hello again.

This is the last one from Josh for now.
Apologies to him for taking so long to process this.

---------- Forwarded message ----------
From: Josh Triplett <address@hidden>
To: Debian Bug Tracking System <address@hidden>
Date: Sun, 29 Aug 2010 23:45:40 -0700
Subject: indent: Recognizes typedefs in declarations,
    but not parameters or casts; fails to consistently handle "type *"

Package: indent
Version: 2.2.11-1
Severity: normal

Consider the following file:

void *f1(u32 *p1, void *p2)
{
    u32 *v1;
    void *v2;
    return (void *)v1;
}

u32 *f2(u32 *p1, void *p2)
{
    return (u32 *)v2;
}


"indent -kr -ncas" will indent this as follows:

--- u32.c.orig  2010-08-29 23:38:16.000000000 -0700
+++ u32.c       2010-08-29 23:39:38.000000000 -0700
@@ -1,11 +1,11 @@
-void *f1(u32 *p1, void *p2)
+void *f1(u32 * p1, void *p2)
 {
     u32 *v1;
     void *v2;
     return (void *)v1;
 }

-u32 *f2(u32 *p1, void *p2)
+u32 *f2(u32 * p1, void *p2)
 {
-    return (u32 *)v2;
+    return (u32 *) v2;
 }

Notice how it handled "u32 *v1" and "u32 *f2(...)" correctly and
consistently, but it mis-indented the parameter "u32 * p1" and the cast
"(u32 *) v2".

Ideally, I'd like to see indent automatically handling these types
correctly; the parameters in particular seem like they should prove as
simple as declarations.  However, if it turns out indent can't handle
this without prior knowledge of the program's types, I can live with a
solution that involves explicitly telling indent a list of names which
it should treat as types, since in this case the list would prove quite
short.

- Josh Triplett

[...]



reply via email to

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