Received: from eggs.gnu.org ([2001:4830:134:3::10]:33374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpKQI-0006p9-0j for qemu-devel@nongnu.org; Mon, 04 May 2015 13:44:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpKQE-0004bb-1d for qemu-devel@nongnu.org; Mon, 04 May 2015 13:44:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpKQD-0004bQ-NQ for qemu-devel@nongnu.org; Mon, 04 May 2015 13:44:49 -0400 From: Markus Armbruster References: <1430751937-17523-1-git-send-email-eblake@redhat.com> <1430751937-17523-26-git-send-email-eblake@redhat.com> Date: Mon, 04 May 2015 19:43:41 +0200 In-Reply-To: <1430751937-17523-26-git-send-email-eblake@redhat.com> (Eric Blake's message of "Mon, 4 May 2015 09:05:22 -0600") Message-ID: <87wq0o44s2.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v8 25/40] qapi: Require valid names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org Eric Blake writes: > Previous commits demonstrated that the generator overlooked various > bad naming situations: > - types, commands, and events need a valid name > - enum members must be valid names, when combined with prefix > - union and alternate branches cannot be marked optional > > Valid upstream names match [a-zA-Z][a-zA-Z0-9_-]*; valid downstream > names match __[a-zA-Z][a-zA-Z0-9._-]*. Enumerations match the > weaker [a-zA-Z0-9._-]+ (in part thanks to QKeyCode picking an enum > that starts with a digit, which we can't change now due to > backwards compatibility). Rather than call out three separate > regex, this patch just uses a broader combination that allows both > upstream and downstream names, as well as a small hack that > realizes that any enum name is merely a suffix to an already valid > name prefix (that is, any enum name is valid if prepending _ fits > the normal rules). > > We could reject new enumeration names beginning with a digit by > whitelisting existing exceptions. We could also be stricter > about the distinction between upstream names (no leading > underscore, no use of dot) and downstream (mandatory leading > double underscore), but it is probably not worth the bother. > > Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster