From owner-svn-src-stable@FreeBSD.ORG Wed Feb 6 00:42:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C6D6D5E8; Wed, 6 Feb 2013 00:42:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A47C619A; Wed, 6 Feb 2013 00:42:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r160gOaI003271; Wed, 6 Feb 2013 00:42:24 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r160gN3x003262; Wed, 6 Feb 2013 00:42:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201302060042.r160gN3x003262@svn.freebsd.org> From: Xin LI Date: Wed, 6 Feb 2013 00:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r246373 - stable/9/contrib/one-true-awk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 00:42:24 -0000 Author: delphij Date: Wed Feb 6 00:42:23 2013 New Revision: 246373 URL: http://svnweb.freebsd.org/changeset/base/246373 Log: MFC: one-true-awk 20121220. Modified: stable/9/contrib/one-true-awk/FIXES stable/9/contrib/one-true-awk/main.c stable/9/contrib/one-true-awk/makefile stable/9/contrib/one-true-awk/proto.h stable/9/contrib/one-true-awk/run.c stable/9/contrib/one-true-awk/tran.c Directory Properties: stable/9/contrib/one-true-awk/ (props changed) Modified: stable/9/contrib/one-true-awk/FIXES ============================================================================== --- stable/9/contrib/one-true-awk/FIXES Wed Feb 6 00:01:28 2013 (r246372) +++ stable/9/contrib/one-true-awk/FIXES Wed Feb 6 00:42:23 2013 (r246373) @@ -25,6 +25,22 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Dec 20, 2012: + fiddled makefile to get correct yacc and bison flags. pick yacc + (linux) or bison (mac) as necessary. + + added __attribute__((__noreturn__)) to a couple of lines in + proto.h, to silence someone's enthusiastic checker. + + fixed obscure call by value bug in split(a[1],a) reported on + 9fans. the management of temporary values is just a mess; i + took a shortcut by making an extra string copy. thanks + to paul patience and arnold robbins for passing it on and for + proposed patches. + + tiny fiddle in setfval to eliminate -0 results in T.expr, which + has irritated me for 20+ years. + Aug 10, 2011: another fix to avoid core dump with delete(ARGV); again, many thanks to ruslan ermilov. Modified: stable/9/contrib/one-true-awk/main.c ============================================================================== --- stable/9/contrib/one-true-awk/main.c Wed Feb 6 00:01:28 2013 (r246372) +++ stable/9/contrib/one-true-awk/main.c Wed Feb 6 00:42:23 2013 (r246373) @@ -25,7 +25,7 @@ THIS SOFTWARE. #include __FBSDID("$FreeBSD$"); -const char *version = "version 20110810 (FreeBSD)"; +const char *version = "version 20121220 (FreeBSD)"; #define DEBUG #include Modified: stable/9/contrib/one-true-awk/makefile ============================================================================== --- stable/9/contrib/one-true-awk/makefile Wed Feb 6 00:01:28 2013 (r246372) +++ stable/9/contrib/one-true-awk/makefile Wed Feb 6 00:42:23 2013 (r246373) @@ -26,15 +26,15 @@ CFLAGS = -g CFLAGS = -O2 CFLAGS = -CC = gcc -Wall -g -CC = cc CC = gcc -Wall -g -Wwrite-strings CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov +CC = gcc -g -Wall -pedantic CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing -YACC = bison -y -YACC = yacc -YFLAGS = -d +YACC = bison -d -y +YACC = yacc -d -S +#YFLAGS = -d -S + # -S uses sprintf in yacc parser instead of sprint OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o Modified: stable/9/contrib/one-true-awk/proto.h ============================================================================== --- stable/9/contrib/one-true-awk/proto.h Wed Feb 6 00:01:28 2013 (r246372) +++ stable/9/contrib/one-true-awk/proto.h Wed Feb 6 00:42:23 2013 (r246373) @@ -46,7 +46,7 @@ extern void freetr(Node *); extern int hexstr(uschar **); extern int quoted(uschar **); extern char *cclenter(const char *); -extern void overflo(const char *); +extern void overflo(const char *) __attribute__((__noreturn__)); extern void cfoll(fa *, Node *); extern int first(Node *); extern void follow(Node *); @@ -132,7 +132,7 @@ extern void fpecatch(int); extern void bracecheck(void); extern void bcheck2(int, int, int); extern void SYNTAX(const char *, ...); -extern void FATAL(const char *, ...); +extern void FATAL(const char *, ...) __attribute__((__noreturn__)); extern void WARNING(const char *, ...); extern void error(void); extern void eprint(void); Modified: stable/9/contrib/one-true-awk/run.c ============================================================================== --- stable/9/contrib/one-true-awk/run.c Wed Feb 6 00:01:28 2013 (r246372) +++ stable/9/contrib/one-true-awk/run.c Wed Feb 6 00:42:23 2013 (r246373) @@ -1213,13 +1213,13 @@ Cell *dopa2(Node **a, int n) /* a[0], a[ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ { Cell *x = 0, *y, *ap; - char *s; + char *s, *origs; int sep; char *t, temp, num[50], *fs = 0; int n, tempstat, arg3type; y = execute(a[0]); /* source string */ - s = getsval(y); + origs = s = strdup(getsval(y)); arg3type = ptoi(a[3]); if (a[2] == 0) /* fs string */ fs = *FS; @@ -1339,6 +1339,7 @@ Cell *split(Node **a, int nnn) /* split( } tempfree(ap); tempfree(y); + free(origs); if (a[2] != 0 && arg3type == STRING) { tempfree(x); } Modified: stable/9/contrib/one-true-awk/tran.c ============================================================================== --- stable/9/contrib/one-true-awk/tran.c Wed Feb 6 00:01:28 2013 (r246372) +++ stable/9/contrib/one-true-awk/tran.c Wed Feb 6 00:42:23 2013 (r246373) @@ -298,6 +298,8 @@ Awkfloat setfval(Cell *vp, Awkfloat f) / xfree(vp->sval); /* free any previous string */ vp->tval &= ~STR; /* mark string invalid */ vp->tval |= NUM; /* mark number ok */ + if (f == -0) /* who would have thought this possible? */ + f = 0; dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); return vp->fval = f; }