diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | awkgram.c | 11 | ||||
-rw-r--r-- | awkgram.y | 11 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 464 | ||||
-rw-r--r-- | doc/gawk.texi | 4 | ||||
-rw-r--r-- | doc/gawktexi.in | 4 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/Makefile.in | 7 | ||||
-rw-r--r-- | test/profile8.awk | 13 | ||||
-rw-r--r-- | test/profile8.ok | 23 | ||||
-rw-r--r-- | test/profile9.awk | 9 | ||||
-rw-r--r-- | test/profile9.ok | 14 |
15 files changed, 319 insertions, 266 deletions
@@ -1,3 +1,9 @@ +2015-12-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (mk_condition): Revise to correctly handle + empty else part for pretty printing. Bug report by + ziyunfei <446240525@qq.com>. + 2015-12-20 Arnold D. Robbins <arnold@skeeve.com> * io.c (nonfatal): New static constant string. @@ -81,7 +81,7 @@ Changes from 4.1.3 to 4.1.x 4. The "exit" command has been added to the debugger as an alias for "quit". -5. AIX 7.1 should pass the test suite now. +5. AIX 7.1 should pass the test suite now. Similar for Minix. Changes from 4.1.2 to 4.1.3 --------------------------- @@ -7673,14 +7673,12 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, */ INSTRUCTION *ip; + bool setup_else_part = true; if (false_branch == NULL) { false_branch = list_create(instruction(Op_no_op)); - if (elsep != NULL) { /* else { } */ - if (do_pretty_print) - (void) list_prepend(false_branch, elsep); - else - bcfree(elsep); + if (elsep == NULL) { /* else { } */ + setup_else_part = false; } } else { /* assert(elsep != NULL); */ @@ -7688,6 +7686,9 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, /* avoid a series of no_op's: if .. else if .. else if .. */ if (false_branch->lasti->opcode != Op_no_op) (void) list_append(false_branch, instruction(Op_no_op)); + } + + if (setup_else_part) { if (do_pretty_print) { (void) list_prepend(false_branch, elsep); false_branch->nexti->branch_end = false_branch->lasti; @@ -5253,14 +5253,12 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, */ INSTRUCTION *ip; + bool setup_else_part = true; if (false_branch == NULL) { false_branch = list_create(instruction(Op_no_op)); - if (elsep != NULL) { /* else { } */ - if (do_pretty_print) - (void) list_prepend(false_branch, elsep); - else - bcfree(elsep); + if (elsep == NULL) { /* else { } */ + setup_else_part = false; } } else { /* assert(elsep != NULL); */ @@ -5268,6 +5266,9 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, /* avoid a series of no_op's: if .. else if .. else if .. */ if (false_branch->lasti->opcode != Op_no_op) (void) list_append(false_branch, instruction(Op_no_op)); + } + + if (setup_else_part) { if (do_pretty_print) { (void) list_prepend(false_branch, elsep); false_branch->nexti->branch_end = false_branch->lasti; diff --git a/doc/ChangeLog b/doc/ChangeLog index bcdb8ffa..de880e76 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2015-12-27 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Fix some @c endfile. Thanks to Antonio + Giovanni Colombo for the report and patch. + 2015-12-20 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Add PROCINFO["NONFATAL"] to the list for PROCINFO. diff --git a/doc/gawk.info b/doc/gawk.info index 5929a638..e29ec00a 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -18432,7 +18432,7 @@ looks something like this: @example @c file examples/messages.awk BEGIN @{ print "Don't panic!" @} - @c end file + @c endfile @end example It also prints some final advice: @@ -18440,7 +18440,7 @@ looks something like this: @example @c file examples/messages.awk END @{ print "Always avoid bored archaeologists!" @} - @c end file + @c endfile @end example ... @@ -35364,235 +35364,235 @@ Ref: Labels Program-Footnote-1744872 Node: Word Sorting744956 Node: History Sorting749028 Node: Extract Program750863 -Node: Simple Sed758394 -Node: Igawk Program761468 -Ref: Igawk Program-Footnote-1775799 -Ref: Igawk Program-Footnote-2776001 -Ref: Igawk Program-Footnote-3776123 -Node: Anagram Program776238 -Node: Signature Program779300 -Node: Programs Summary780547 -Node: Programs Exercises781762 -Ref: Programs Exercises-Footnote-1785891 -Node: Advanced Features785982 -Node: Nondecimal Data787972 -Node: Array Sorting789563 -Node: Controlling Array Traversal790263 -Ref: Controlling Array Traversal-Footnote-1798632 -Node: Array Sorting Functions798750 -Ref: Array Sorting Functions-Footnote-1802637 -Node: Two-way I/O802833 -Ref: Two-way I/O-Footnote-1807784 -Ref: Two-way I/O-Footnote-2807971 -Node: TCP/IP Networking808053 -Node: Profiling811171 -Node: Advanced Features Summary819442 -Node: Internationalization821378 -Node: I18N and L10N822858 -Node: Explaining gettext823545 -Ref: Explaining gettext-Footnote-1828568 -Ref: Explaining gettext-Footnote-2828753 -Node: Programmer i18n828918 -Ref: Programmer i18n-Footnote-1833774 -Node: Translator i18n833823 -Node: String Extraction834617 -Ref: String Extraction-Footnote-1835750 -Node: Printf Ordering835836 -Ref: Printf Ordering-Footnote-1838622 -Node: I18N Portability838686 -Ref: I18N Portability-Footnote-1841142 -Node: I18N Example841205 -Ref: I18N Example-Footnote-1844011 -Node: Gawk I18N844084 -Node: I18N Summary844729 -Node: Debugger846070 -Node: Debugging847092 -Node: Debugging Concepts847533 -Node: Debugging Terms849342 -Node: Awk Debugging851917 -Node: Sample Debugging Session852823 -Node: Debugger Invocation853357 -Node: Finding The Bug854743 -Node: List of Debugger Commands861221 -Node: Breakpoint Control862554 -Node: Debugger Execution Control866248 -Node: Viewing And Changing Data869610 -Node: Execution Stack872984 -Node: Debugger Info874621 -Node: Miscellaneous Debugger Commands878692 -Node: Readline Support883780 -Node: Limitations884676 -Ref: Limitations-Footnote-1888907 -Node: Debugging Summary888958 -Node: Arbitrary Precision Arithmetic890237 -Node: Computer Arithmetic891653 -Ref: table-numeric-ranges895244 -Ref: Computer Arithmetic-Footnote-1895966 -Node: Math Definitions896023 -Ref: table-ieee-formats899337 -Ref: Math Definitions-Footnote-1899940 -Node: MPFR features900045 -Node: FP Math Caution901718 -Ref: FP Math Caution-Footnote-1902790 -Node: Inexactness of computations903159 -Node: Inexact representation904119 -Node: Comparing FP Values905479 -Node: Errors accumulate906561 -Node: Getting Accuracy907994 -Node: Try To Round910704 -Node: Setting precision911603 -Ref: table-predefined-precision-strings912300 -Node: Setting the rounding mode914130 -Ref: table-gawk-rounding-modes914504 -Ref: Setting the rounding mode-Footnote-1917912 -Node: Arbitrary Precision Integers918091 -Ref: Arbitrary Precision Integers-Footnote-1923008 -Node: POSIX Floating Point Problems923157 -Ref: POSIX Floating Point Problems-Footnote-1927039 -Node: Floating point summary927077 -Node: Dynamic Extensions929267 -Node: Extension Intro930820 -Node: Plugin License932086 -Node: Extension Mechanism Outline932883 -Ref: figure-load-extension933322 -Ref: figure-register-new-function934887 -Ref: figure-call-new-function935979 -Node: Extension API Description938042 -Node: Extension API Functions Introduction939574 -Node: General Data Types944433 -Ref: General Data Types-Footnote-1950388 -Node: Memory Allocation Functions950687 -Ref: Memory Allocation Functions-Footnote-1953532 -Node: Constructor Functions953631 -Node: Registration Functions955376 -Node: Extension Functions956061 -Node: Exit Callback Functions958360 -Node: Extension Version String959610 -Node: Input Parsers960273 -Node: Output Wrappers970158 -Node: Two-way processors974670 -Node: Printing Messages976934 -Ref: Printing Messages-Footnote-1978008 -Node: Updating ERRNO978161 -Node: Requesting Values978900 -Ref: table-value-types-returned979637 -Node: Accessing Parameters980520 -Node: Symbol Table Access981756 -Node: Symbol table by name982268 -Node: Symbol table by cookie984289 -Ref: Symbol table by cookie-Footnote-1988438 -Node: Cached values988502 -Ref: Cached values-Footnote-1992003 -Node: Array Manipulation992094 -Ref: Array Manipulation-Footnote-1993185 -Node: Array Data Types993222 -Ref: Array Data Types-Footnote-1995880 -Node: Array Functions995972 -Node: Flattening Arrays999831 -Node: Creating Arrays1006739 -Node: Redirection API1011511 -Node: Extension API Variables1014342 -Node: Extension Versioning1014975 -Node: Extension API Informational Variables1016866 -Node: Extension API Boilerplate1017930 -Node: Finding Extensions1021744 -Node: Extension Example1022304 -Node: Internal File Description1023102 -Node: Internal File Ops1027182 -Ref: Internal File Ops-Footnote-11038944 -Node: Using Internal File Ops1039084 -Ref: Using Internal File Ops-Footnote-11041467 -Node: Extension Samples1041742 -Node: Extension Sample File Functions1043271 -Node: Extension Sample Fnmatch1050920 -Node: Extension Sample Fork1052407 -Node: Extension Sample Inplace1053625 -Node: Extension Sample Ord1056835 -Node: Extension Sample Readdir1057671 -Ref: table-readdir-file-types1058560 -Node: Extension Sample Revout1059365 -Node: Extension Sample Rev2way1059954 -Node: Extension Sample Read write array1060694 -Node: Extension Sample Readfile1062636 -Node: Extension Sample Time1063731 -Node: Extension Sample API Tests1065079 -Node: gawkextlib1065571 -Node: Extension summary1068018 -Node: Extension Exercises1071710 -Node: Language History1073207 -Node: V7/SVR3.11074863 -Node: SVR41077015 -Node: POSIX1078449 -Node: BTL1079829 -Node: POSIX/GNU1080559 -Node: Feature History1086398 -Node: Common Extensions1100718 -Node: Ranges and Locales1102001 -Ref: Ranges and Locales-Footnote-11106617 -Ref: Ranges and Locales-Footnote-21106644 -Ref: Ranges and Locales-Footnote-31106879 -Node: Contributors1107100 -Node: History summary1112669 -Node: Installation1114049 -Node: Gawk Distribution1114994 -Node: Getting1115478 -Node: Extracting1116439 -Node: Distribution contents1118077 -Node: Unix Installation1124173 -Node: Quick Installation1124855 -Node: Shell Startup Files1127269 -Node: Additional Configuration Options1128347 -Node: Configuration Philosophy1130152 -Node: Non-Unix Installation1132522 -Node: PC Installation1132980 -Node: PC Binary Installation1134300 -Node: PC Compiling1136152 -Ref: PC Compiling-Footnote-11139176 -Node: PC Testing1139285 -Node: PC Using1140465 -Node: Cygwin1144579 -Node: MSYS1145349 -Node: VMS Installation1145850 -Node: VMS Compilation1146641 -Ref: VMS Compilation-Footnote-11147871 -Node: VMS Dynamic Extensions1147929 -Node: VMS Installation Details1149614 -Node: VMS Running1151867 -Node: VMS GNV1154708 -Node: VMS Old Gawk1155443 -Node: Bugs1155914 -Node: Other Versions1160111 -Node: Installation summary1166697 -Node: Notes1167755 -Node: Compatibility Mode1168620 -Node: Additions1169402 -Node: Accessing The Source1170327 -Node: Adding Code1171763 -Node: New Ports1177982 -Node: Derived Files1182470 -Ref: Derived Files-Footnote-11187955 -Ref: Derived Files-Footnote-21187990 -Ref: Derived Files-Footnote-31188588 -Node: Future Extensions1188702 -Node: Implementation Limitations1189360 -Node: Extension Design1190543 -Node: Old Extension Problems1191697 -Ref: Old Extension Problems-Footnote-11193215 -Node: Extension New Mechanism Goals1193272 -Ref: Extension New Mechanism Goals-Footnote-11196636 -Node: Extension Other Design Decisions1196825 -Node: Extension Future Growth1198938 -Node: Old Extension Mechanism1199774 -Node: Notes summary1201537 -Node: Basic Concepts1202719 -Node: Basic High Level1203400 -Ref: figure-general-flow1203682 -Ref: figure-process-flow1204367 -Ref: Basic High Level-Footnote-11207668 -Node: Basic Data Typing1207853 -Node: Glossary1211181 -Node: Copying1243127 -Node: GNU Free Documentation License1280666 -Node: Index1305784 +Node: Simple Sed758392 +Node: Igawk Program761466 +Ref: Igawk Program-Footnote-1775797 +Ref: Igawk Program-Footnote-2775999 +Ref: Igawk Program-Footnote-3776121 +Node: Anagram Program776236 +Node: Signature Program779298 +Node: Programs Summary780545 +Node: Programs Exercises781760 +Ref: Programs Exercises-Footnote-1785889 +Node: Advanced Features785980 +Node: Nondecimal Data787970 +Node: Array Sorting789561 +Node: Controlling Array Traversal790261 +Ref: Controlling Array Traversal-Footnote-1798630 +Node: Array Sorting Functions798748 +Ref: Array Sorting Functions-Footnote-1802635 +Node: Two-way I/O802831 +Ref: Two-way I/O-Footnote-1807782 +Ref: Two-way I/O-Footnote-2807969 +Node: TCP/IP Networking808051 +Node: Profiling811169 +Node: Advanced Features Summary819440 +Node: Internationalization821376 +Node: I18N and L10N822856 +Node: Explaining gettext823543 +Ref: Explaining gettext-Footnote-1828566 +Ref: Explaining gettext-Footnote-2828751 +Node: Programmer i18n828916 +Ref: Programmer i18n-Footnote-1833772 +Node: Translator i18n833821 +Node: String Extraction834615 +Ref: String Extraction-Footnote-1835748 +Node: Printf Ordering835834 +Ref: Printf Ordering-Footnote-1838620 +Node: I18N Portability838684 +Ref: I18N Portability-Footnote-1841140 +Node: I18N Example841203 +Ref: I18N Example-Footnote-1844009 +Node: Gawk I18N844082 +Node: I18N Summary844727 +Node: Debugger846068 +Node: Debugging847090 +Node: Debugging Concepts847531 +Node: Debugging Terms849340 +Node: Awk Debugging851915 +Node: Sample Debugging Session852821 +Node: Debugger Invocation853355 +Node: Finding The Bug854741 +Node: List of Debugger Commands861219 +Node: Breakpoint Control862552 +Node: Debugger Execution Control866246 +Node: Viewing And Changing Data869608 +Node: Execution Stack872982 +Node: Debugger Info874619 +Node: Miscellaneous Debugger Commands878690 +Node: Readline Support883778 +Node: Limitations884674 +Ref: Limitations-Footnote-1888905 +Node: Debugging Summary888956 +Node: Arbitrary Precision Arithmetic890235 +Node: Computer Arithmetic891651 +Ref: table-numeric-ranges895242 +Ref: Computer Arithmetic-Footnote-1895964 +Node: Math Definitions896021 +Ref: table-ieee-formats899335 +Ref: Math Definitions-Footnote-1899938 +Node: MPFR features900043 +Node: FP Math Caution901716 +Ref: FP Math Caution-Footnote-1902788 +Node: Inexactness of computations903157 +Node: Inexact representation904117 +Node: Comparing FP Values905477 +Node: Errors accumulate906559 +Node: Getting Accuracy907992 +Node: Try To Round910702 +Node: Setting precision911601 +Ref: table-predefined-precision-strings912298 +Node: Setting the rounding mode914128 +Ref: table-gawk-rounding-modes914502 +Ref: Setting the rounding mode-Footnote-1917910 +Node: Arbitrary Precision Integers918089 +Ref: Arbitrary Precision Integers-Footnote-1923006 +Node: POSIX Floating Point Problems923155 +Ref: POSIX Floating Point Problems-Footnote-1927037 +Node: Floating point summary927075 +Node: Dynamic Extensions929265 +Node: Extension Intro930818 +Node: Plugin License932084 +Node: Extension Mechanism Outline932881 +Ref: figure-load-extension933320 +Ref: figure-register-new-function934885 +Ref: figure-call-new-function935977 +Node: Extension API Description938040 +Node: Extension API Functions Introduction939572 +Node: General Data Types944431 +Ref: General Data Types-Footnote-1950386 +Node: Memory Allocation Functions950685 +Ref: Memory Allocation Functions-Footnote-1953530 +Node: Constructor Functions953629 +Node: Registration Functions955374 +Node: Extension Functions956059 +Node: Exit Callback Functions958358 +Node: Extension Version String959608 +Node: Input Parsers960271 +Node: Output Wrappers970156 +Node: Two-way processors974668 +Node: Printing Messages976932 +Ref: Printing Messages-Footnote-1978006 +Node: Updating ERRNO978159 +Node: Requesting Values978898 +Ref: table-value-types-returned979635 +Node: Accessing Parameters980518 +Node: Symbol Table Access981754 +Node: Symbol table by name982266 +Node: Symbol table by cookie984287 +Ref: Symbol table by cookie-Footnote-1988436 +Node: Cached values988500 +Ref: Cached values-Footnote-1992001 +Node: Array Manipulation992092 +Ref: Array Manipulation-Footnote-1993183 +Node: Array Data Types993220 +Ref: Array Data Types-Footnote-1995878 +Node: Array Functions995970 +Node: Flattening Arrays999829 +Node: Creating Arrays1006737 +Node: Redirection API1011509 +Node: Extension API Variables1014340 +Node: Extension Versioning1014973 +Node: Extension API Informational Variables1016864 +Node: Extension API Boilerplate1017928 +Node: Finding Extensions1021742 +Node: Extension Example1022302 +Node: Internal File Description1023100 +Node: Internal File Ops1027180 +Ref: Internal File Ops-Footnote-11038942 +Node: Using Internal File Ops1039082 +Ref: Using Internal File Ops-Footnote-11041465 +Node: Extension Samples1041740 +Node: Extension Sample File Functions1043269 +Node: Extension Sample Fnmatch1050918 +Node: Extension Sample Fork1052405 +Node: Extension Sample Inplace1053623 +Node: Extension Sample Ord1056833 +Node: Extension Sample Readdir1057669 +Ref: table-readdir-file-types1058558 +Node: Extension Sample Revout1059363 +Node: Extension Sample Rev2way1059952 +Node: Extension Sample Read write array1060692 +Node: Extension Sample Readfile1062634 +Node: Extension Sample Time1063729 +Node: Extension Sample API Tests1065077 +Node: gawkextlib1065569 +Node: Extension summary1068016 +Node: Extension Exercises1071708 +Node: Language History1073205 +Node: V7/SVR3.11074861 +Node: SVR41077013 +Node: POSIX1078447 +Node: BTL1079827 +Node: POSIX/GNU1080557 +Node: Feature History1086396 +Node: Common Extensions1100716 +Node: Ranges and Locales1101999 +Ref: Ranges and Locales-Footnote-11106615 +Ref: Ranges and Locales-Footnote-21106642 +Ref: Ranges and Locales-Footnote-31106877 +Node: Contributors1107098 +Node: History summary1112667 +Node: Installation1114047 +Node: Gawk Distribution1114992 +Node: Getting1115476 +Node: Extracting1116437 +Node: Distribution contents1118075 +Node: Unix Installation1124171 +Node: Quick Installation1124853 +Node: Shell Startup Files1127267 +Node: Additional Configuration Options1128345 +Node: Configuration Philosophy1130150 +Node: Non-Unix Installation1132520 +Node: PC Installation1132978 +Node: PC Binary Installation1134298 +Node: PC Compiling1136150 +Ref: PC Compiling-Footnote-11139174 +Node: PC Testing1139283 +Node: PC Using1140463 +Node: Cygwin1144577 +Node: MSYS1145347 +Node: VMS Installation1145848 +Node: VMS Compilation1146639 +Ref: VMS Compilation-Footnote-11147869 +Node: VMS Dynamic Extensions1147927 +Node: VMS Installation Details1149612 +Node: VMS Running1151865 +Node: VMS GNV1154706 +Node: VMS Old Gawk1155441 +Node: Bugs1155912 +Node: Other Versions1160109 +Node: Installation summary1166695 +Node: Notes1167753 +Node: Compatibility Mode1168618 +Node: Additions1169400 +Node: Accessing The Source1170325 +Node: Adding Code1171761 +Node: New Ports1177980 +Node: Derived Files1182468 +Ref: Derived Files-Footnote-11187953 +Ref: Derived Files-Footnote-21187988 +Ref: Derived Files-Footnote-31188586 +Node: Future Extensions1188700 +Node: Implementation Limitations1189358 +Node: Extension Design1190541 +Node: Old Extension Problems1191695 +Ref: Old Extension Problems-Footnote-11193213 +Node: Extension New Mechanism Goals1193270 +Ref: Extension New Mechanism Goals-Footnote-11196634 +Node: Extension Other Design Decisions1196823 +Node: Extension Future Growth1198936 +Node: Old Extension Mechanism1199772 +Node: Notes summary1201535 +Node: Basic Concepts1202717 +Node: Basic High Level1203398 +Ref: figure-general-flow1203680 +Ref: figure-process-flow1204365 +Ref: Basic High Level-Footnote-11207666 +Node: Basic Data Typing1207851 +Node: Glossary1211179 +Node: Copying1243125 +Node: GNU Free Documentation License1280664 +Node: Index1305782 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 384198a2..b711949b 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -25877,7 +25877,7 @@ that prints a nice message: @@example @@c file examples/messages.awk BEGIN @@@{ print "Don't panic!" @@@} -@@c end file +@@c endfile @@end example It also prints some final advice: @@ -25885,7 +25885,7 @@ It also prints some final advice: @@example @@c file examples/messages.awk END @@@{ print "Always avoid bored archaeologists!" @@@} -@@c end file +@@c endfile @@end example @dots{} @end example diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 7764ec0f..e067a6db 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -24968,7 +24968,7 @@ that prints a nice message: @@example @@c file examples/messages.awk BEGIN @@@{ print "Don't panic!" @@@} -@@c end file +@@c endfile @@end example It also prints some final advice: @@ -24976,7 +24976,7 @@ It also prints some final advice: @@example @@c file examples/messages.awk END @@@{ print "Always avoid bored archaeologists!" @@@} -@@c end file +@@c endfile @@end example @dots{} @end example diff --git a/test/ChangeLog b/test/ChangeLog index 7ecd2716..bf8a2665 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2015-12-27 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (profile8): New test. + * profile8.awk, profile8.ok: New files. + 2015-11-24 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (watchpoint1): New test. diff --git a/test/Makefile.am b/test/Makefile.am index e573f5e1..b9eb6739 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1130,7 +1130,7 @@ GAWK_EXT_TESTS = \ nonfatal1 nonfatal2 nonfatal3 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 \ - profile8 pty1 \ + profile8 profile9 pty1 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow shadowbuiltin \ sortfor sortu split_after_fpat \ @@ -1860,6 +1860,11 @@ profile8: @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile9: + @echo $@ + @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + posix2008sub: @echo $@ @$(AWK) --posix -f "$(srcdir)"/$@.awk > _$@ 2>&1 diff --git a/test/Makefile.in b/test/Makefile.in index 9771921c..df6c576f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1386,7 +1386,7 @@ GAWK_EXT_TESTS = \ nonfatal1 nonfatal2 nonfatal3 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 \ - profile8 pty1 \ + profile8 profile9 pty1 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow shadowbuiltin \ sortfor sortu split_after_fpat \ @@ -2299,6 +2299,11 @@ profile8: @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile9: + @echo $@ + @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + posix2008sub: @echo $@ @$(AWK) --posix -f "$(srcdir)"/$@.awk > _$@ 2>&1 diff --git a/test/profile8.awk b/test/profile8.awk index 16252cea..68d0622e 100644 --- a/test/profile8.awk +++ b/test/profile8.awk @@ -1,9 +1,4 @@ -# Some -# header -# comments - -# Add up -{ sum += $1 } - -# Print sum -END { print sum } +{if(0){}else{}} +{while(0){}} +{do{}while(0)} +{for(;;){}} diff --git a/test/profile8.ok b/test/profile8.ok index 34f7a96b..2b9c156f 100644 --- a/test/profile8.ok +++ b/test/profile8.ok @@ -1,14 +1,21 @@ -# Some -# header -# comments +{ + if (0) { + } else { + } +} + +{ + while (0) { + } +} -# Add up { - sum += $1 + do { + } while (0) } -# Print sum -END { - print sum +{ + for (;;) { + } } diff --git a/test/profile9.awk b/test/profile9.awk new file mode 100644 index 00000000..16252cea --- /dev/null +++ b/test/profile9.awk @@ -0,0 +1,9 @@ +# Some +# header +# comments + +# Add up +{ sum += $1 } + +# Print sum +END { print sum } diff --git a/test/profile9.ok b/test/profile9.ok new file mode 100644 index 00000000..34f7a96b --- /dev/null +++ b/test/profile9.ok @@ -0,0 +1,14 @@ +# Some +# header +# comments + +# Add up +{ + sum += $1 +} + +# Print sum +END { + print sum +} + |