Subject: bin/12781: indent(1) label / bit-field structure
To: None <gnats-bugs@gnats.netbsd.org>
From: None <nagae@tk.airnet.ne.jp>
List: netbsd-bugs
Date: 04/29/2001 13:17:28
>Number:         12781
>Category:       bin
>Synopsis:       indent(1) mistakes a label for a bit-field structure
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 28 21:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Nagae Hidetake
>Release:        Apr 28 2001
>Organization:
>Environment:
	
System: NetBSD johnny.nag.notwork.org 1.5T NetBSD 1.5T (GENERIC) #0: Mon Mar 26 22:30:04 JST 2001 nagae@dixie.nag.notwork.org:/usr/home/nagae/src/sys/arch/i386/compile/GENERIC i386


>Description:
	indent(1) mistakes a label before the first statement
	for a bit-field structure declaration.
	So such a label is indented as much as normal statement lines.
>How-To-Repeat:
	$ echo '
	int func(int a)
	{
	label1:
	    switch (a) {
	    case 0:	return 0;
	    default:	return 1;
	    }
	label2:
	}' | indent
	
	int
	func(int a)
	{
		label1:
		switch (a) {
			case 0:return 0;
		default:
			return 1;
		}
	label2:
	}

>Fix:
*** indent.c.orig	Sun Dec 20 02:00:08 1998
--- indent.c	Sun Apr 29 10:30:35 2001
***************
*** 709,715 ****
  				ps.want_blank = true;
  				break;
  			}
! 			if (ps.in_decl) {
  				*e_code++ = ':';
  				ps.want_blank = false;
  				break;
--- 709,715 ----
  				ps.want_blank = true;
  				break;
  			}
! 			if (ps.in_or_st) {
  				*e_code++ = ':';
  				ps.want_blank = false;
  				break;
>Release-Note:
>Audit-Trail:
>Unformatted:
 Organization:
 	<organization of PR author (multiple lines)>