From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19671 invoked by alias); 6 Jan 2016 11:39:32 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37512 Received: (qmail 3750 invoked from network); 6 Jan 2016 11:39:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_HDRS_LCASE, T_MANY_HDRS_LCASE autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f5-f79b16d000005389-b4-568cfceef5b8 Date: Wed, 06 Jan 2016 11:39:23 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Parameter scope nuisance with strftime Message-id: <20160106113923.27f97b7a@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOLMWRmVeSWpSXmKPExsVy+t/xq7rv//SEGRxsZ7Q42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGd92fWMp2MRb8XDzHOYGxqlcXYycHBICJhIfb3exQthiEhfu rWfrYuTiEBJYyijxf1sHK4Qzg0ni/cEnUM5pRom9J96wQzhnGCUuXNrBDNLPIqAqMb9pIROI zSZgKDF102zGLkYODhEBbYn2j2IgYWEBfYk9/c9ZQcK8AvYS19ZagoT5gcJX/35igrjCXmLm lTOMIDavgKDEj8n3WEBsZgEtic3bmlghbHmJzWvegm0VElCXuHF3N/sERsFZSFpmIWmZhaRl ASPzKkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQ4Py6g3HpMatDjAIcjEo8vAIyPWFCrIll xZW5hxglOJiVRHhDioFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeWfueh8iJJCeWJKanZpakFoE k2Xi4JRqYJS0Co6zfnTz3cXHsb3u1Vs3nPdY/DW5uEqz/OrEG2fT98X1lOao1z1ry9gr0nmm xv1Pm7wx0+amd+XbLnns1vFSlnk+3/z77gpPqxWrjx7a7X8qpsor5NK+GdM6q31UQ2rUXOqO /Hc4etZm8kJOjcUlny+m/S5dckdEqNPIuWub8y35Syt7FZVYijMSDbWYi4oTAeJa0U5KAgAA This: Author: Barton E. Schaefer Date: Sat Apr 25 10:57:44 2015 -0700 34961: $TZ is implicitly local in builtin strftime (originally workers/34602 from workers/34596) causes us to start parameter scope (as if creating parameters in a function) for the strftime builtin in zsh/datetime. This produces a bogus WARNCREATEGLOBAL warning at the command line: % strftime -s date %Y%m%d%H%M $EPOCHSECONDS ./zsh:4: scalar parameter date created globally in function However, the warning code is sort of working correctly: we are indeed creating a global parameter from a local scope. What we don't have is a function on the funcstack --- possibly the warning is redundant in this case. I may have been unnecessarily conservative about this when I created check_warn_create(). pws diff --git a/Src/params.c b/Src/params.c index 054fb1f..b2e8897 100644 --- a/Src/params.c +++ b/Src/params.c @@ -2705,30 +2705,18 @@ static void check_warn_create(Param pm, const char *pmtype) { Funcstack i; - const char *name; if (pm->level != 0 || (pm->node.flags & PM_SPECIAL)) return; - name = NULL; for (i = funcstack; i; i = i->prev) { if (i->tp == FS_FUNC) { DPUTS(!i->name, "funcstack entry with no name"); - name = i->name; + zwarn("%s parameter %s created globally in function %s", + pmtype, pm->node.nam, i->name); break; } } - - if (name) - { - zwarn("%s parameter %s created globally in function %s", - pmtype, pm->node.nam, name); - } - else - { - zwarn("%s parameter %s created globally in function", - pmtype, pm->node.nam); - } } /**/