I noticed that indent(1) handles widecharacter literals (e.g. L'c' or L"string") incorrectly. indent(1)s parser treats the L-prefix and the quoted part as seperate tokens. The result is: L'c' -> L 'c' L"string" -> L "string" Of course this breaks any code using widecharacters. As I use indent(1) quite extensively I decided to fix this issue. As this is my first patch against the FreeBSD user land feel free to comment! The first version of this patch including examples was posted to freebsd-current@freebsd.org: http://archive.netbsd.se/?ml=freebsd-current&a=2010-01&m=12274166 How-To-Repeat: indent /usr/src/lib/libc/string/wcsxfrm.c
Created attachment 173382 [details] Fix for current Fix by Piotr Stephaniak: "The patch from bugzilla is not enough, with that as-is, indent would be able to break valid code as pointed out by Peter Jeremy in https://lists.freebsd.org/pipermail/freebsd-hackers/2008-April/024336.html "
(In reply to Pedro F. Giffuni from comment #1) Nevermind the commnet: it corresponds to another bug. The new patch should be good though.
A commit references this bug: Author: pfg Date: Sun Nov 27 20:38:15 UTC 2016 New revision: 309220 URL: https://svnweb.freebsd.org/changeset/base/309220 Log: 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 MFC after: 2 weeks Changes: head/usr.bin/indent/indent.c head/usr.bin/indent/indent_codes.h head/usr.bin/indent/lexi.c
Fixed by r309220.
A commit references this bug: Author: eadler Date: Thu Mar 8 06:54:33 UTC 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 Changes: _U stable/11/ stable/11/usr.bin/indent/indent.c stable/11/usr.bin/indent/indent_codes.h stable/11/usr.bin/indent/lexi.c