From owner-svn-src-stable@freebsd.org Thu Mar 8 06:54:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A34AF39869; Thu, 8 Mar 2018 06:54:34 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D798E69AFF; Thu, 8 Mar 2018 06:54:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D26095722; Thu, 8 Mar 2018 06:54:33 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w286sXBQ044849; Thu, 8 Mar 2018 06:54:33 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w286sXTc044846; Thu, 8 Mar 2018 06:54:33 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803080654.w286sXTc044846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Thu, 8 Mar 2018 06:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330633 - stable/11/usr.bin/indent X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/usr.bin/indent X-SVN-Commit-Revision: 330633 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Mar 2018 06:54:34 -0000 Author: eadler Date: Thu Mar 8 06:54:33 2018 New Revision: 330633 URL: https://svnweb.freebsd.org/changeset/base/330633 Log: MFC r309220: indent(1): Properly handle the wide string literal and wide char constant L. indent(1) treated the "L" in "L'a'" as if it were an identifier and forced a space character after it, breaking valid code. PR: 143090 Modified: stable/11/usr.bin/indent/indent.c stable/11/usr.bin/indent/indent_codes.h stable/11/usr.bin/indent/lexi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/indent/indent.c ============================================================================== --- stable/11/usr.bin/indent/indent.c Thu Mar 8 06:51:17 2018 (r330632) +++ stable/11/usr.bin/indent/indent.c Thu Mar 8 06:54:33 2018 (r330633) @@ -1017,6 +1017,16 @@ check_type: ps.want_blank = true; break; + case strpfx: + if (ps.want_blank) + *e_code++ = ' '; + for (t_ptr = token; *t_ptr; ++t_ptr) { + CHECK_SIZE_CODE; + *e_code++ = *t_ptr; + } + ps.want_blank = false; + break; + case period: /* treat a period kind of like a binary * operation */ *e_code++ = '.'; /* move the period into line */ Modified: stable/11/usr.bin/indent/indent_codes.h ============================================================================== --- stable/11/usr.bin/indent/indent_codes.h Thu Mar 8 06:51:17 2018 (r330632) +++ stable/11/usr.bin/indent/indent_codes.h Thu Mar 8 06:54:33 2018 (r330633) @@ -68,3 +68,4 @@ #define ifhead 30 #define elsehead 31 #define period 32 +#define strpfx 33 Modified: stable/11/usr.bin/indent/lexi.c ============================================================================== --- stable/11/usr.bin/indent/lexi.c Thu Mar 8 06:51:17 2018 (r330632) +++ stable/11/usr.bin/indent/lexi.c Thu Mar 8 06:54:33 2018 (r330633) @@ -228,6 +228,11 @@ lexi(void) fill_buffer(); } *e_token++ = '\0'; + + if (s_token[0] == 'L' && s_token[1] == '\0' && + (*buf_ptr == '"' || *buf_ptr == '\'')) + return (strpfx); + while (*buf_ptr == ' ' || *buf_ptr == '\t') { /* get rid of blanks */ if (++buf_ptr >= buf_end) fill_buffer();