gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-303


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.2-stable, updated. gawk-4.1.0-3039-g05a4e79
Date: Sun, 16 Sep 2018 13:30:16 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.2-stable has been updated
       via  05a4e7931d2d75fe87a18f15484553b9aa62b545 (commit)
      from  87848093635e0d4e647601fe788e024ee90e1be6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=05a4e7931d2d75fe87a18f15484553b9aa62b545

commit 05a4e7931d2d75fe87a18f15484553b9aa62b545
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Sep 16 20:29:55 2018 +0300

    Add lint warning for accessing $0 in an END rule.

diff --git a/ChangeLog b/ChangeLog
index 02dcbb3..fae44dd 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-09-16         Arnold D. Robbins     <address@hidden>
+
+       * field.c (get_field): Add lint check if accessing $0 inside
+       and END rule, print a "may not be portable" warning.
+       * builtin.c (do_print_rec): Call get_field() unconditionally
+       in order to do lint check.
+
 2018-09-14         Adrian Bunk           <address@hidden>
 
        * awk.h (init_debug, debug_prog): Move prototypes to here from ...
diff --git a/builtin.c b/builtin.c
index 44c484f..8247ca3 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2364,8 +2364,7 @@ do_print_rec(int nargs, int redirtype)
        if (fp == NULL)
                return;
 
-       if (! field0_valid)
-               (void) get_field(0L, NULL);     /* rebuild record */
+       (void) get_field(0L, NULL);     /* rebuild record if necessary */
 
        f0 = fields_arr[0];
 
diff --git a/field.c b/field.c
index 5296324..3bcfb42 100644
--- a/field.c
+++ b/field.c
@@ -837,6 +837,13 @@ get_field(long requested, Func_ptr *assign)
         * then the whole line must be rebuilt
         */
        if (requested == 0) {
+               static bool warned = false;
+               extern int currule;
+
+               if (do_lint && currule == END) {
+                       warned = true;
+                       lintwarn(_("accessing $0 from an END rule may not be 
portable"));
+               }
                if (! field0_valid) {
                        /* first, parse remainder of input record */
                        if (NF == -1) {

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog | 7 +++++++
 builtin.c | 3 +--
 field.c   | 7 +++++++
 3 files changed, 15 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]