From patchwork Sat Jul 25 15:02:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 499976 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0A4F71402AD for ; Sun, 26 Jul 2015 01:02:47 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=SZDQzsE7; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type; q=dns; s=default; b=LvUZPIgkjfZoZ7lpG0Nm2kisg4Rae XGbuKV5VbUjiuoqPxClh8QVCCBn8oH1tcL+PeVomxcqveCmFsAAkahy61LlEVOUY 7b6ygz0xWFRZas5BLATVwVlNoOSEbBKpkh8tE6N7HeNDmUU3mBWeqvuZ6uhsNSMK KCuzuqzp6/L8O0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type; s=default; bh=SnkF4X7GPZHIyP15yQkxPqSbbiQ=; b=SZD QzsE7QHWSthnLIXtGZsr6oyU3osAgwrYIgzrlzW743kJmyKECRNvR1cL/syCQq0z gOnJ16c7E8AhEp2+DH7TM6IqFsiXiltdVBn1aQQSf+MS9dY6flaPGqT74J/o2qjK 3AKPi7ynMbbnzoFC0YOnBnNDpCe05ajTnx4+czns= Received: (qmail 96608 invoked by alias); 25 Jul 2015 15:02:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 96598 invoked by uid 89); 25 Jul 2015 15:02:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=mVKLC+tEhKuqzuoso1kOxR6thdurIP8qlYe7NHhgHFU=; b=O6AvZ1nepRPrPb63vVLuj0FgoBPJ0MJVBPqY0oRZQHgO8cFYO1SHaeoApn0AmWI2s5 cvUCecn7kU9k3IOOJJdo0UP5Pl4kPaNpET6WtWTHY2l/FTxChwVkTo8AKG9r+24tfskv dgpPMtCntk6WTSoG4BIrDUl8QLf3yb8RYe6osXL7bSvYVzPlXxzxWB1SP1K6IGAwcMt2 awDBVq7wE1xUa1PWCDoj4HR8XSq6AwLYVnoauBh45OcraTiRHtaWYnwdU/iBopinjrym cAdN6oBCrOha7m/7Dao+prFSIbXoizCbVGEgvFCNPuv5qJeIPOQjDkLuiAYwXvCL3inN +9iw== X-Received: by 10.55.27.13 with SMTP id b13mr28111971qkb.93.1437836558192; Sat, 25 Jul 2015 08:02:38 -0700 (PDT) Message-ID: <55B3A509.8090803@panix.com> Date: Sat, 25 Jul 2015 11:02:33 -0400 From: Zack Weinberg User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: libc-alpha@sourceware.org Subject: [PATCH v3] Deprecate regexp.h For 2.22. Revised per discussion at https://sourceware.org/ml/libc-alpha/2015-07/msg00862.html and https://sourceware.org/ml/libc-alpha/2015-07/msg00871.html . * regexp.h: Add unconditional #warning stating that this header will be removed soon. Revise banner comment to match. (compile): Consistently use ERROR instead of RETURN to report errors (partial fix for bz#18681). * regexp.c: Don't include regexp.h. Remove some unnecessary declarations. --- NEWS | 8 ++++++++ misc/regexp.c | 8 ++++---- misc/regexp.h | 31 +++++++++++++++++-------------- 3 files changed, 29 insertions(+), 18 deletions(-) #include #include @@ -182,19 +185,19 @@ compile (char *__restrict instring, char *__restrict expbuf, case REG_ERPAREN: default: /* There is no matching error code. */ - RETURN (36); + ERROR (36); case REG_ESUBREG: - RETURN (25); + ERROR (25); case REG_EBRACK: - RETURN (49); + ERROR (49); case REG_EPAREN: - RETURN (42); + ERROR (42); case REG_EBRACE: - RETURN (44); + ERROR (44); case REG_BADBR: - RETURN (46); + ERROR (46); case REG_ERANGE: - RETURN (11); + ERROR (11); case REG_ESPACE: case REG_ESIZE: ERROR (50); diff --git a/NEWS b/NEWS index 65b2172..a0bd93b 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,14 @@ Version 2.22 * Port to Native Client running on ARMv7-A (--host=arm-nacl). Contributed by Roland McGrath (Google). + +* The header is deprecated, and will be removed in a future + release. Use of this header will trigger a deprecation warning. + Application developers should update their code to use instead. + + This header was formerly part of SUSv2, but was deprecated in 1997 and + removed from the standard in 2001. Also, the glibc implementation + leaks memory. See BZ#18681 for more details. Version 2.21 diff --git a/misc/regexp.c b/misc/regexp.c index 3b83203..ee7d572 100644 --- a/misc/regexp.c +++ b/misc/regexp.c @@ -17,8 +17,10 @@ License along with the GNU C Library; if not, see . */ -#define __DO_NOT_DEFINE_COMPILE -#include +/* We don't include regexp.h here because of the macros it requires, and + because it now contains an unconditional #warning. */ + +#include /* Define the variables used for the interface. */ char *loc1; @@ -32,7 +34,6 @@ char *locs; found in the buffer starting at EXPBUF. `loc1' will return the first character matched and `loc2' points to the next unmatched character. */ -extern int __step (const char *string, const char *expbuf); int __step (const char *string, const char *expbuf) { @@ -55,7 +56,6 @@ weak_alias (__step, step) /* Match the beginning of STRING with the compiled regular expression in EXPBUF. If the match is successful `loc2' will contain the position of the first unmatched character. */ -extern int __advance (const char *string, const char *expbuf); int __advance (const char *string, const char *expbuf) { diff --git a/misc/regexp.h b/misc/regexp.h index 3fc0bc5..3460989 100644 --- a/misc/regexp.h +++ b/misc/regexp.h @@ -19,14 +19,17 @@ #ifndef _REGEXP_H #define _REGEXP_H 1 -/* The contents of this header file was first standardized in X/Open - System Interface and Headers Issue 2, originally coming from SysV. - In issue 4, version 2, it is marked as TO BE WITDRAWN, and it has - been withdrawn in SUSv3. +/* The contents of this header file were standardized in the + Single Unix Specification, Version 2 (1997) but marked as + LEGACY; new applications were already being encouraged to + use instead. POSIX.1-2001 removed this header. - This code shouldn't be used in any newly written code. It is - included only for compatibility reasons. Use the POSIX definition - in for portable applications and a reasonable interface. */ + This header is provided only for backward compatibility. + It will be removed in the next release of the GNU C Library. + New code should use instead. */ + +#warning " will be removed in the next release of the GNU C Library." +#warning "Please update your code to use instead (no trailing 'p')."