indent(1): don't indent typedef declarations as object declarations

This commit is contained in:
Piotr Pawel Stefaniak 2018-06-01 09:41:15 +00:00
parent 5f35ea69af
commit 3bbaa755f3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334478
5 changed files with 12 additions and 2 deletions

View File

@ -937,6 +937,7 @@ main(int argc, char **argv)
}
goto copy_id; /* move the token into line */
case type_def:
case storage:
prefix_blankline_requested = 0;
goto copy_id;
@ -955,7 +956,7 @@ main(int argc, char **argv)
}
ps.in_or_st = true; /* this might be a structure or initialization
* declaration */
ps.in_decl = ps.decl_on_line = true;
ps.in_decl = ps.decl_on_line = ps.last_token != type_def;
if ( /* !ps.in_or_st && */ ps.dec_nest <= 0)
ps.just_saw_decl = 2;
prefix_blankline_requested = 0;

View File

@ -73,3 +73,5 @@
#define strpfx 33
#define storage 34
#define funcname 35
#define type_def 36

View File

@ -100,7 +100,7 @@ struct templ specials[] =
{"static", 10},
{"struct", 3},
{"switch", 7},
{"typedef", 10},
{"typedef", 11},
{"union", 3},
{"unsigned", 4},
{"void", 4},
@ -350,6 +350,9 @@ lexi(void)
case 10: /* storage class specifier */
return (storage);
case 11: /* typedef */
return (type_def);
default: /* all others are treated like any other
* identifier */
return (ident);

View File

@ -1,6 +1,8 @@
/* $FreeBSD$ */
/* See r303570 */
typedef void (*voidptr) (int *);
static const struct
{
double x;

View File

@ -1,6 +1,8 @@
/* $FreeBSD$ */
/* See r303570 */
typedef void (*voidptr) (int *);
static const struct {
double x;
double y, z;