From owner-svn-src-all@freebsd.org Thu Jul 6 18:21:32 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24E4CD8CB2E; Thu, 6 Jul 2017 18:21:32 +0000 (UTC) (envelope-from kevans@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 mx1.freebsd.org (Postfix) with ESMTPS id E7D5779CD0; Thu, 6 Jul 2017 18:21:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v66ILUjr034541; Thu, 6 Jul 2017 18:21:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v66ILUbG034540; Thu, 6 Jul 2017 18:21:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201707061821.v66ILUbG034540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Jul 2017 18:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320750 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 320750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2017 18:21:32 -0000 Author: kevans Date: Thu Jul 6 18:21:30 2017 New Revision: 320750 URL: https://svnweb.freebsd.org/changeset/base/320750 Log: Fix sparc64 libc build after r320742. p_branch_empty was declared but never used due to an oversight. Use it as designed, further comment on its return value. Reported by: Jenkins (head-sparc64) Reviewed by: emaste Approved by: emaste (mentor) MFC with: r320742 Differential Revision: https://reviews.freebsd.org/D11506 Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Thu Jul 6 18:08:38 2017 (r320749) +++ head/lib/libc/regex/regcomp.c Thu Jul 6 18:21:30 2017 (r320750) @@ -114,7 +114,7 @@ static void p_str(struct parse *p); static int p_branch_eat_delim(struct parse *p, struct branchc *bc); static void p_branch_ins_offset(struct parse *p, struct branchc *bc); static void p_branch_fix_tail(struct parse *p, struct branchc *bc); -static void p_branch_empty(struct parse *p, struct branchc *bc); +static bool p_branch_empty(struct parse *p, struct branchc *bc); static bool p_branch_do(struct parse *p, struct branchc *bc); static void p_bre_pre_parse(struct parse *p, struct branchc *bc); static void p_bre_post_parse(struct parse *p, struct branchc *bc); @@ -578,13 +578,15 @@ p_branch_fix_tail(struct parse *p, struct branchc *bc) /* * Signal to the parser that an empty branch has been encountered; this will, * in the future, be used to allow for more permissive behavior with empty - * branches. + * branches. The return value should indicate whether parsing may continue + * or not. */ -static void +static bool p_branch_empty(struct parse *p, struct branchc *bc) { SETERROR(REG_EMPTY); + return (false); } /* @@ -600,7 +602,13 @@ p_branch_do(struct parse *p, struct branchc *bc) ate = p_branch_eat_delim(p, bc); if (ate == 0) return (false); - (void)REQUIRE(ate == 1 && (!bc->outer || MORE()), REG_EMPTY); + else if ((ate > 1 || (bc->outer && !MORE())) && !p_branch_empty(p, bc)) + /* + * Halt parsing only if we have an empty branch and p_branch_empty + * indicates that we must not continue. In the future, this will not + * necessarily be an error. + */ + return (false); p_branch_ins_offset(p, bc); return (true);