Date: Thu, 8 Mar 2018 06:54:33 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> 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 Message-ID: <201803080654.w286sXTc044846@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803080654.w286sXTc044846>