From owner-freebsd-current@FreeBSD.ORG Mon Jul 14 22:59:50 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C606337B401 for ; Mon, 14 Jul 2003 22:59:50 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 840C343F85 for ; Mon, 14 Jul 2003 22:59:49 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h6F5xiv16591; Tue, 15 Jul 2003 07:59:44 +0200 (MEST) Date: Tue, 15 Jul 2003 07:59:43 +0200 (CEST) From: Harti Brandt To: Jun Kuriyama In-Reply-To: <7madbg60b1.wl@black.imgsrc.co.jp> Message-ID: <20030715075429.M34004@beagle.fokus.fraunhofer.de> References: <7madbg60b1.wl@black.imgsrc.co.jp> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Current Subject: Re: src/bin/ed/re.c: warning: declaration of `exp' shadows a global declaration X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2003 05:59:51 -0000 On Tue, 15 Jul 2003, Jun Kuriyama wrote: JK> JK>With new gcc and -Wshadow, src/bin/ed/re.c shows this warning: JK> JK>cc -Wshadow -c re.c JK>re.c: In function `get_compiled_pattern': JK>re.c:44: warning: declaration of `exp' shadows a global declaration JK>:0: warning: shadowed declaration is here JK> JK>It seems local variable exp is conflicted with exp(3) declaration. I JK>don't know what name should be used... I would call this a compiler bug. It shouldn't declare exp(3) when you don't include math.h. As I understand the standard the names in math.h are only reserved when you include math.h. I remember that an earlier version of gcc had this bug, that was fixed then. Probably they unfixed it again. What's the chance of getting this fixed? harti JK> JK> JK>Index: re.c JK>=================================================================== JK>RCS file: /home/ncvs/src/bin/ed/re.c,v JK>retrieving revision 1.19 JK>diff -u -r1.19 re.c JK>--- re.c 30 Jun 2002 05:13:53 -0000 1.19 JK>+++ re.c 14 Jul 2003 23:42:41 -0000 JK>@@ -41,7 +41,7 @@ JK> pattern_t * JK> get_compiled_pattern(void) JK> { JK>- static pattern_t *exp = NULL; JK>+ static pattern_t *expr = NULL; JK> static char error[1024]; JK> JK> char *exps; JK>@@ -52,27 +52,27 @@ JK> errmsg = "invalid pattern delimiter"; JK> return NULL; JK> } else if (delimiter == '\n' || *++ibufp == '\n' || *ibufp == delimiter) { JK>- if (!exp) JK>+ if (!expr) JK> errmsg = "no previous pattern"; JK>- return exp; JK>+ return expr; JK> } else if ((exps = extract_pattern(delimiter)) == NULL) JK> return NULL; JK> /* buffer alloc'd && not reserved */ JK>- if (exp && !patlock) JK>- regfree(exp); JK>- else if ((exp = (pattern_t *) malloc(sizeof(pattern_t))) == NULL) { JK>+ if (expr && !patlock) JK>+ regfree(expr); JK>+ else if ((expr = (pattern_t *) malloc(sizeof(pattern_t))) == NULL) { JK> fprintf(stderr, "%s\n", strerror(errno)); JK> errmsg = "out of memory"; JK> return NULL; JK> } JK> patlock = 0; JK>- if ((n = regcomp(exp, exps, 0))) { JK>- regerror(n, exp, error, sizeof error); JK>+ if ((n = regcomp(expr, exps, 0))) { JK>+ regerror(n, expr, error, sizeof error); JK> errmsg = error; JK>- free(exp); JK>- return exp = NULL; JK>+ free(expr); JK>+ return expr = NULL; JK> } JK>- return exp; JK>+ return expr; JK> } JK> JK> JK> JK> JK> -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org