From 93897ef9a4907b5969a5496501c07ecb537dbbc8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 1 Jul 2016 06:32:09 +0300 Subject: Minor fixes for stftmt uses. --- ChangeLog | 8 ++++++++ array.c | 2 +- mpfr.c | 2 +- node.c | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 990b4b74..1e761e38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2016-07-01 Arnold D. Robbins + + * array.c (value_info): Print something reasonable when stfmt + is -1. + * mpfr.c (mpg_format_val): Don't cast index to char. + * node.c (r_format_val): Ditto. + Thanks to Andrew Schorr for pointing these out. + 2016-06-26 Arnold D. Robbins Repair change of 2015-08-25 to handling of MAYBE_NUM. diff --git a/array.c b/array.c index 85570e88..8c9cc72e 100644 --- a/array.c +++ b/array.c @@ -704,7 +704,7 @@ value_info(NODE *n) if ((n->flags & (STRING|STRCUR)) == STRCUR) { fprintf(output_fp, "]["); fprintf(output_fp, "stfmt=%d, ", n->stfmt); - fprintf(output_fp, "CONVFMT=\"%s\"", n->stfmt <= -1 ? "%ld" + fprintf(output_fp, "CONVFMT=\"%s\"", n->stfmt <= -1 ? "" : fmt_list[n->stfmt]->stptr); } diff --git a/mpfr.c b/mpfr.c index 533ec9d9..9b9e538e 100644 --- a/mpfr.c +++ b/mpfr.c @@ -377,7 +377,7 @@ mpg_format_val(const char *format, int index, NODE *s) } else { r = format_tree(format, fmt_list[index]->stlen, dummy, 2); assert(r != NULL); - s->stfmt = (char) index; + s->stfmt = index; } s->flags = oflags; s->stlen = r->stlen; diff --git a/node.c b/node.c index 41545752..24f1493c 100644 --- a/node.c +++ b/node.c @@ -246,7 +246,7 @@ r_format_val(const char *format, int index, NODE *s) } else { r = format_tree(format, fmt_list[index]->stlen, dummy, 2); assert(r != NULL); - s->stfmt = (char) index; + s->stfmt = index; } s->flags = oflags; s->stlen = r->stlen; -- cgit v1.2.3 From 783b841df282ebb80a8f4bc90d668d42ebb7bbd1 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 1 Jul 2016 06:32:58 +0300 Subject: Update pc/Makefile.tst. --- pc/ChangeLog | 4 ++++ pc/Makefile.tst | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pc/ChangeLog b/pc/ChangeLog index fd872e8d..fb5283ca 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,7 @@ +2016-07-01 Scott Deifik + + * Makefile.tst: Sync with mainline. + 2016-06-14 Arnold D. Robbins * Makefile.tst: Sync with mainline: diff --git a/pc/Makefile.tst b/pc/Makefile.tst index e4414294..ea711413 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -148,12 +148,12 @@ BASIC_TESTS = \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ eofsplit exit2 exitval1 exitval2 exitval3 \ fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \ - fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 \ gsubtst7 gsubtst8 \ - hex hsprint \ + hex hex2 hsprint \ inpref inputred intest intprec iobug1 \ leaddig leadnl litoct longsub longwrds \ manglprm math membug1 messages minusstr mmap8k mtchi18n \ @@ -1289,7 +1289,6 @@ symtab10: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk < "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -1608,6 +1607,11 @@ fsbs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +fsnul1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + fsrs: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1703,6 +1707,11 @@ hex: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +hex2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + hsprint: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ -- cgit v1.2.3 From 5da46e952e81f827abc4b75bd79178cfc2875460 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 1 Jul 2016 06:34:53 +0300 Subject: Remove writes to stderr in arrayind1 test. --- test/ChangeLog | 5 +++++ test/arrayind1.awk | 10 +++++----- test/arrayind1.ok | 5 ----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index 59e0dae6..585ab146 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2016-07-01 Arnold D. Robbins + + * arrayind1.awk, arrayind1.ok: Comment out prints to stderr to + avoid buffer flushing on obscure systems. + 2016-06-14 Arnold D. Robbins * Makefile.am (subback): New test. diff --git a/test/arrayind1.awk b/test/arrayind1.awk index fc3683f0..5d4a6f3d 100755 --- a/test/arrayind1.awk +++ b/test/arrayind1.awk @@ -57,7 +57,7 @@ END{ #printf("%10s%16s%10s%16s%10s%10s%10s\n","group",last," included as",posout[x]," as sire, as dam",cum[x,"sire"],cum[x,"dam"]) > "/dev/stderr" } # regular individuals - printf("%16s\n","recoding animals") > "/dev/stderr" +# printf("%16s\n","recoding animals") > "/dev/stderr" iter=1 #--> comment next line and this element of the associative array becomes null #printf("%s%16s\n","at the beginning it should be empty: ",posout["00000779770060"]) > "/dev/stderr" @@ -84,8 +84,8 @@ END{ } iter++ #--> - printf("%s%16s\n","in the loop: ",posout["00000779770060"]) > "/dev/stderr" - fflush("/dev/stderr") +# printf("%s%16s\n","in the loop: ",posout["00000779770060"]) > "/dev/stderr" +# fflush("/dev/stderr") #--> #printf("%10s%10s%10s%10s%16s%16s\n","round",iter,"included",posout[last],"last ",last) > "/dev/stderr" } @@ -95,7 +95,7 @@ END{ #printf("%10s%16s%10s%16s\n","pseudogeneration:",x," including: ",cumgen[x]) > "/dev/stderr" } #--> this is the guilty line - printf("%s%16s\n","at the end: ",posout["00000779770060"]) > "/dev/stderr" - fflush("/dev/stderr") +# printf("%s%16s\n","at the end: ",posout["00000779770060"]) > "/dev/stderr" +# fflush("/dev/stderr") #--> } diff --git a/test/arrayind1.ok b/test/arrayind1.ok index c68346ea..2b11bb5d 100644 --- a/test/arrayind1.ok +++ b/test/arrayind1.ok @@ -1,8 +1,3 @@ -recoding animals -in the loop: 3 -in the loop: 3 -in the loop: 3 -at the end: 3 1 0 0 00000757740011 0 0 0 2 0 0 1975su1du1 0 0 0 3 2 2 00000779770060 1975su1du1 1975su1du1 1 -- cgit v1.2.3 From bc1cf4039d9e52ae7b285f20e68a846d9143a210 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 1 Jul 2016 06:38:01 +0300 Subject: Minor portability fixes in some of the extensions. --- extension/ChangeLog | 9 +++++++++ extension/inplace.c | 1 + extension/revtwoway.c | 8 +++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/extension/ChangeLog b/extension/ChangeLog index 7f62f11b..71af2159 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,12 @@ +2016-07-01 Arnold D. Robbins + + * inplace.c (do_inplace_begin): Flush stdout at the start to + try to avoid flushing problems on some obscure BSD systems. + * revtwoway.c (gawk_getdtablesize): Renamed from getdtablesize. + (getdtablesize): New macro. Avoids problems on FreeBSD 10 + where configure didn't work correctly. Thanks to Nelson Beebe. + Update copyright year. + 2016-01-27 Arnold D. Robbins * filefuncs.c (do_statvfs): Define out f_fsid on AIX. diff --git a/extension/inplace.c b/extension/inplace.c index 07d256b7..c7eb5564 100644 --- a/extension/inplace.c +++ b/extension/inplace.c @@ -125,6 +125,7 @@ do_inplace_begin(int nargs, awk_value_t *result) int fd; assert(result != NULL); + fflush(stdout); if (state.tname) fatal(ext_id, _("inplace_begin: in-place editing already active")); diff --git a/extension/revtwoway.c b/extension/revtwoway.c index c0d9381a..dfe58a1e 100644 --- a/extension/revtwoway.c +++ b/extension/revtwoway.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2012-2014 the Free Software Foundation, Inc. + * Copyright (C) 2012-2014, 2016 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -64,10 +64,10 @@ int plugin_is_GPL_compatible; static size_t max_fds; #ifndef HAVE_GETDTABLESIZE -/* getdtablesize --- replacement version that should be good enough */ +/* gawk_getdtablesize --- replacement version that should be good enough */ static inline int -getdtablesize() +gawk_getdtablesize() { /* * Algorithm for the GNULIB folks: @@ -89,6 +89,8 @@ getdtablesize() /* In the meantime, this is good enough for us: */ return 1024; } + +#define getdtablesize() gawk_getdtablesize() #endif /* -- cgit v1.2.3 From 82024c4ac22e50de3b0ad36d8aa81c52e7b4c9ae Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 1 Jul 2016 06:39:31 +0300 Subject: Minor fixes in gawkapi.c. --- ChangeLog | 5 +++++ gawkapi.c | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e761e38..a109b7d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,11 @@ * node.c (r_format_val): Ditto. Thanks to Andrew Schorr for pointing these out. + Unrelated: + + * gawkapi.c (api_warning): Fix the comment header. + (api_lintwarn): Factor out the call to va_end to after the if. + 2016-06-26 Arnold D. Robbins Repair change of 2015-08-25 to handling of MAYBE_NUM. diff --git a/gawkapi.c b/gawkapi.c index cca045cf..1ef2f79e 100644 --- a/gawkapi.c +++ b/gawkapi.c @@ -193,7 +193,7 @@ api_fatal(awk_ext_id_t id, const char *format, ...) va_end(args); } -/* api_warning --- print a warning message and exit */ +/* api_warning --- print a warning message */ static void api_warning(awk_ext_id_t id, const char *format, ...) @@ -219,11 +219,10 @@ api_lintwarn(awk_ext_id_t id, const char *format, ...) va_start(args, format); if (lintwarn == r_fatal) { err(true, _("fatal: "), format, args); - va_end(args); } else { err(false, _("warning: "), format, args); - va_end(args); } + va_end(args); } /* api_register_input_parser --- register an input_parser; for opening files read-only */ -- cgit v1.2.3