diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2022-02-27 20:45:27 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2022-02-27 20:45:27 +0200 |
commit | 6083e965fac1b272f9ccb491902b24a24ea14122 (patch) | |
tree | d4454d50f6d0ebcf398111f811243876e2dc62d2 | |
parent | d36d6c02e9f3277850815f3bf5aec3b22fa54a21 (diff) | |
parent | fc1410099d6ccbb72adb54ecffd0711348706ca4 (diff) | |
download | egawk-6083e965fac1b272f9ccb491902b24a24ea14122.tar.gz egawk-6083e965fac1b272f9ccb491902b24a24ea14122.tar.bz2 egawk-6083e965fac1b272f9ccb491902b24a24ea14122.zip |
Merge branch 'gawk-5.1-stable'
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | awk.h | 4 | ||||
-rw-r--r-- | awkgram.c | 10 | ||||
-rw-r--r-- | awkgram.y | 10 | ||||
-rw-r--r-- | debug.c | 2 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 489 | ||||
-rw-r--r-- | doc/gawk.texi | 11 | ||||
-rw-r--r-- | doc/gawktexi.in | 11 | ||||
-rw-r--r-- | eval.c | 4 | ||||
-rw-r--r-- | interpret.h | 6 | ||||
-rw-r--r-- | io.c | 6 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | mpfr.c | 8 | ||||
-rw-r--r-- | profile.c | 7 | ||||
-rw-r--r-- | re.c | 2 | ||||
-rw-r--r-- | symbol.c | 4 |
17 files changed, 316 insertions, 273 deletions
@@ -1,3 +1,11 @@ +2022-02-27 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (cant_happen): Change to allow a format string and arguments, + in order to provide a clue as to what went wrong, and not just + print "internal error". + * awkgram.y, debug.c, eval.c, interpret.h, io.c, main.c, mpfr.c, + profile.c, re.c, symbol.c: Fix all uses of cant_happen(). + 2022-02-25 Arnold D. Robbins <arnold@skeeve.com> Memory issues with MPFR, fix part 2. (Part 1 is in the @@ -1381,8 +1381,8 @@ extern void r_freeblock(void *, int id); #define ALREADY_MALLOCED 2 #define ELIDE_BACK_NL 4 -#define cant_happen() r_fatal("internal error line %d, file: %s", \ - __LINE__, __FILE__) +#define cant_happen(format, ...) r_fatal("internal error: file %s, line %d: " format, \ + __FILE__, __LINE__, __VA_ARGS__) #define emalloc(var,ty,x,str) (void) (var = (ty) emalloc_real((size_t)(x), str, #var, __FILE__, __LINE__)) #define ezalloc(var,ty,x,str) (void) (var = (ty) ezalloc_real((size_t)(x), str, #var, __FILE__, __LINE__)) @@ -6913,7 +6913,7 @@ retry: /* regular code */ break; default: - cant_happen(); + cant_happen("bad value %d for want_param_names", (int) want_param_names); break; } } @@ -8872,7 +8872,7 @@ list_append(INSTRUCTION *l, INSTRUCTION *x) { #ifdef GAWKDEBUG if (l->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l->opcode)); #endif l->lasti->nexti = x; l->lasti = x; @@ -8884,7 +8884,7 @@ list_prepend(INSTRUCTION *l, INSTRUCTION *x) { #ifdef GAWKDEBUG if (l->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l->opcode)); #endif x->nexti = l->nexti; l->nexti = x; @@ -8896,9 +8896,9 @@ list_merge(INSTRUCTION *l1, INSTRUCTION *l2) { #ifdef GAWKDEBUG if (l1->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l1->opcode)); if (l2->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l2->opcode)); #endif l1->lasti->nexti = l2->nexti; l1->lasti = l2->lasti; @@ -4405,7 +4405,7 @@ retry: /* regular code */ break; default: - cant_happen(); + cant_happen("bad value %d for want_param_names", (int) want_param_names); break; } } @@ -6364,7 +6364,7 @@ list_append(INSTRUCTION *l, INSTRUCTION *x) { #ifdef GAWKDEBUG if (l->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l->opcode)); #endif l->lasti->nexti = x; l->lasti = x; @@ -6376,7 +6376,7 @@ list_prepend(INSTRUCTION *l, INSTRUCTION *x) { #ifdef GAWKDEBUG if (l->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l->opcode)); #endif x->nexti = l->nexti; l->nexti = x; @@ -6388,9 +6388,9 @@ list_merge(INSTRUCTION *l1, INSTRUCTION *l2) { #ifdef GAWKDEBUG if (l1->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l1->opcode)); if (l2->opcode != Op_list) - cant_happen(); + cant_happen("unexpected value %s for opcode", opcode2str(l2->opcode)); #endif l1->lasti->nexti = l2->nexti; l1->lasti = l2->lasti; @@ -1732,7 +1732,7 @@ watchpoint_triggered(struct list_item *w) case Node_var_new: break; default: - cant_happen(); + cant_happen("unexpected symbol type %s", nodetype2str(symbol->type)); } } diff --git a/doc/ChangeLog b/doc/ChangeLog index dec843a2..5d8cc9af 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2022-02-27 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (Array Sorting Functions): Add a note to be careful + to use local variables in comparison functions. + 2022-02-25 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in (API Ownership of MPFR and GMP Values): Rework for diff --git a/doc/gawk.info b/doc/gawk.info index f0450b45..037df3d0 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -21551,6 +21551,15 @@ both values to lowercase in order to compare them ignoring case. -| A a B b c C D d e E F f g G H h i I J j k K l L M m -| n N O o p P Q q r R S s t T u U V v w W X x y Y z Z + NOTE: 'Under the hood," 'gawk' uses the C library 'qsort()' + function to manage the sorting. 'qsort()' can call itself + recursively. This means that when you write a comparison function, + you should be careful to avoid the use of global variables and + arrays; use only local variables and arrays that you declare as + additional parameters to the comparison function. Otherwise, you + are likely to cause unintentional memory corruption in your global + arrays and possibly cause 'gawk' itself to fail. + ---------- Footnotes ---------- (1) This is true because locale-based comparison occurs only when in @@ -39138,246 +39147,246 @@ Node: Array Sorting859863 Node: Controlling Array Traversal860568 Ref: Controlling Array Traversal-Footnote-1868936 Node: Array Sorting Functions869054 -Ref: Array Sorting Functions-Footnote-1874428 -Node: Two-way I/O874624 -Ref: Two-way I/O-Footnote-1882350 -Ref: Two-way I/O-Footnote-2882537 -Node: TCP/IP Networking882619 -Node: Profiling885695 -Node: Extension Philosophy895004 -Node: Advanced Features Summary896483 -Node: Internationalization898498 -Node: I18N and L10N900172 -Node: Explaining gettext900859 -Ref: Explaining gettext-Footnote-1906751 -Ref: Explaining gettext-Footnote-2906936 -Node: Programmer i18n907101 -Ref: Programmer i18n-Footnote-1912050 -Node: Translator i18n912099 -Node: String Extraction912893 -Ref: String Extraction-Footnote-1914025 -Node: Printf Ordering914111 -Ref: Printf Ordering-Footnote-1916897 -Node: I18N Portability916961 -Ref: I18N Portability-Footnote-1919417 -Node: I18N Example919480 -Ref: I18N Example-Footnote-1922755 -Ref: I18N Example-Footnote-2922828 -Node: Gawk I18N922937 -Node: I18N Summary923559 -Node: Debugger924900 -Node: Debugging925900 -Node: Debugging Concepts926341 -Node: Debugging Terms928150 -Node: Awk Debugging930725 -Ref: Awk Debugging-Footnote-1931670 -Node: Sample Debugging Session931802 -Node: Debugger Invocation932336 -Node: Finding The Bug933722 -Node: List of Debugger Commands940196 -Node: Breakpoint Control941529 -Node: Debugger Execution Control945223 -Node: Viewing And Changing Data948585 -Node: Execution Stack952126 -Node: Debugger Info953763 -Node: Miscellaneous Debugger Commands957834 -Node: Readline Support962896 -Node: Limitations963792 -Node: Debugging Summary966346 -Node: Namespaces967625 -Node: Global Namespace968736 -Node: Qualified Names970134 -Node: Default Namespace971133 -Node: Changing The Namespace971874 -Node: Naming Rules973488 -Node: Internal Name Management975336 -Node: Namespace Example976378 -Node: Namespace And Features978940 -Node: Namespace Summary980375 -Node: Arbitrary Precision Arithmetic981852 -Node: Computer Arithmetic983339 -Ref: table-numeric-ranges987105 -Ref: table-floating-point-ranges987599 -Ref: Computer Arithmetic-Footnote-1988258 -Node: Math Definitions988315 -Ref: table-ieee-formats991291 -Node: MPFR features991859 -Node: FP Math Caution993577 -Ref: FP Math Caution-Footnote-1994649 -Node: Inexactness of computations995018 -Node: Inexact representation996049 -Node: Comparing FP Values997409 -Node: Errors accumulate998650 -Node: Strange values1000106 -Ref: Strange values-Footnote-11002694 -Node: Getting Accuracy1002799 -Node: Try To Round1005509 -Node: Setting precision1006408 -Ref: table-predefined-precision-strings1007105 -Node: Setting the rounding mode1008936 -Ref: table-gawk-rounding-modes1009310 -Ref: Setting the rounding mode-Footnote-11013242 -Node: Arbitrary Precision Integers1013421 -Ref: Arbitrary Precision Integers-Footnote-11016596 -Node: Checking for MPFR1016745 -Node: POSIX Floating Point Problems1018219 -Ref: POSIX Floating Point Problems-Footnote-11022872 -Node: Floating point summary1022910 -Node: Dynamic Extensions1025100 -Node: Extension Intro1026653 -Node: Plugin License1027919 -Node: Extension Mechanism Outline1028716 -Ref: figure-load-extension1029155 -Ref: figure-register-new-function1030721 -Ref: figure-call-new-function1031814 -Node: Extension API Description1033877 -Node: Extension API Functions Introduction1035590 -Ref: table-api-std-headers1037426 -Node: General Data Types1041676 -Ref: General Data Types-Footnote-11050382 -Node: Memory Allocation Functions1050681 -Ref: Memory Allocation Functions-Footnote-11055182 -Node: Constructor Functions1055281 -Node: API Ownership of MPFR and GMP Values1058934 -Node: Registration Functions1060467 -Node: Extension Functions1061167 -Node: Exit Callback Functions1066489 -Node: Extension Version String1067739 -Node: Input Parsers1068402 -Node: Output Wrappers1081123 -Node: Two-way processors1085635 -Node: Printing Messages1087900 -Ref: Printing Messages-Footnote-11089071 -Node: Updating ERRNO1089224 -Node: Requesting Values1089963 -Ref: table-value-types-returned1090700 -Node: Accessing Parameters1091809 -Node: Symbol Table Access1093046 -Node: Symbol table by name1093558 -Ref: Symbol table by name-Footnote-11096583 -Node: Symbol table by cookie1096711 -Ref: Symbol table by cookie-Footnote-11100896 -Node: Cached values1100960 -Ref: Cached values-Footnote-11104496 -Node: Array Manipulation1104649 -Ref: Array Manipulation-Footnote-11105740 -Node: Array Data Types1105777 -Ref: Array Data Types-Footnote-11108435 -Node: Array Functions1108527 -Node: Flattening Arrays1113025 -Node: Creating Arrays1120001 -Node: Redirection API1124768 -Node: Extension API Variables1127601 -Node: Extension Versioning1128312 -Ref: gawk-api-version1128741 -Node: Extension GMP/MPFR Versioning1130473 -Node: Extension API Informational Variables1132101 -Node: Extension API Boilerplate1133174 -Node: Changes from API V11137148 -Node: Finding Extensions1138720 -Node: Extension Example1139279 -Node: Internal File Description1140077 -Node: Internal File Ops1144157 -Ref: Internal File Ops-Footnote-11155507 -Node: Using Internal File Ops1155647 -Ref: Using Internal File Ops-Footnote-11158030 -Node: Extension Samples1158304 -Node: Extension Sample File Functions1159833 -Node: Extension Sample Fnmatch1167482 -Node: Extension Sample Fork1168969 -Node: Extension Sample Inplace1170187 -Node: Extension Sample Ord1173813 -Node: Extension Sample Readdir1174649 -Ref: table-readdir-file-types1175538 -Node: Extension Sample Revout1176606 -Node: Extension Sample Rev2way1177195 -Node: Extension Sample Read write array1177935 -Node: Extension Sample Readfile1181100 -Node: Extension Sample Time1182195 -Node: Extension Sample API Tests1183947 -Node: gawkextlib1184439 -Node: Extension summary1187357 -Node: Extension Exercises1191059 -Node: Language History1192301 -Node: V7/SVR3.11193957 -Node: SVR41196109 -Node: POSIX1197543 -Node: BTL1198924 -Node: POSIX/GNU1199653 -Node: Feature History1205431 -Node: Common Extensions1222606 -Node: Ranges and Locales1223889 -Ref: Ranges and Locales-Footnote-11228505 -Ref: Ranges and Locales-Footnote-21228532 -Ref: Ranges and Locales-Footnote-31228767 -Node: Contributors1228990 -Node: History summary1234987 -Node: Installation1236367 -Node: Gawk Distribution1237311 -Node: Getting1237795 -Node: Extracting1238758 -Node: Distribution contents1240396 -Node: Unix Installation1247457 -Node: Quick Installation1248261 -Node: Compiling with MPFR1250681 -Node: Shell Startup Files1251371 -Node: Additional Configuration Options1252460 -Node: Configuration Philosophy1254775 -Node: Compiling from Git1257171 -Node: Building the Documentation1257726 -Node: Non-Unix Installation1259110 -Node: PC Installation1259570 -Node: PC Binary Installation1260408 -Node: PC Compiling1261281 -Node: PC Using1262398 -Node: Cygwin1265951 -Node: MSYS1267175 -Node: VMS Installation1267777 -Node: VMS Compilation1268496 -Ref: VMS Compilation-Footnote-11269725 -Node: VMS Dynamic Extensions1269783 -Node: VMS Installation Details1271468 -Node: VMS Running1273730 -Node: VMS GNV1278009 -Node: Bugs1278723 -Node: Bug definition1279635 -Node: Bug address1282571 -Node: Usenet1285959 -Node: Performance bugs1287148 -Node: Asking for help1290069 -Node: Maintainers1292036 -Node: Other Versions1293230 -Node: Installation summary1301394 -Node: Notes1302758 -Node: Compatibility Mode1303552 -Node: Additions1304334 -Node: Accessing The Source1305259 -Node: Adding Code1306696 -Node: New Ports1312888 -Node: Derived Files1317263 -Ref: Derived Files-Footnote-11322923 -Ref: Derived Files-Footnote-21322958 -Ref: Derived Files-Footnote-31323556 -Node: Future Extensions1323670 -Node: Implementation Limitations1324328 -Node: Extension Design1325538 -Node: Old Extension Problems1326682 -Ref: Old Extension Problems-Footnote-11328200 -Node: Extension New Mechanism Goals1328257 -Ref: Extension New Mechanism Goals-Footnote-11331621 -Node: Extension Other Design Decisions1331810 -Node: Extension Future Growth1333923 -Node: Notes summary1334529 -Node: Basic Concepts1335687 -Node: Basic High Level1336368 -Ref: figure-general-flow1336650 -Ref: figure-process-flow1337336 -Ref: Basic High Level-Footnote-11340638 -Node: Basic Data Typing1340823 -Node: Glossary1344151 -Node: Copying1376038 -Node: GNU Free Documentation License1413581 -Node: Index1438701 +Ref: Array Sorting Functions-Footnote-1874965 +Node: Two-way I/O875161 +Ref: Two-way I/O-Footnote-1882887 +Ref: Two-way I/O-Footnote-2883074 +Node: TCP/IP Networking883156 +Node: Profiling886232 +Node: Extension Philosophy895541 +Node: Advanced Features Summary897020 +Node: Internationalization899035 +Node: I18N and L10N900709 +Node: Explaining gettext901396 +Ref: Explaining gettext-Footnote-1907288 +Ref: Explaining gettext-Footnote-2907473 +Node: Programmer i18n907638 +Ref: Programmer i18n-Footnote-1912587 +Node: Translator i18n912636 +Node: String Extraction913430 +Ref: String Extraction-Footnote-1914562 +Node: Printf Ordering914648 +Ref: Printf Ordering-Footnote-1917434 +Node: I18N Portability917498 +Ref: I18N Portability-Footnote-1919954 +Node: I18N Example920017 +Ref: I18N Example-Footnote-1923292 +Ref: I18N Example-Footnote-2923365 +Node: Gawk I18N923474 +Node: I18N Summary924096 +Node: Debugger925437 +Node: Debugging926437 +Node: Debugging Concepts926878 +Node: Debugging Terms928687 +Node: Awk Debugging931262 +Ref: Awk Debugging-Footnote-1932207 +Node: Sample Debugging Session932339 +Node: Debugger Invocation932873 +Node: Finding The Bug934259 +Node: List of Debugger Commands940733 +Node: Breakpoint Control942066 +Node: Debugger Execution Control945760 +Node: Viewing And Changing Data949122 +Node: Execution Stack952663 +Node: Debugger Info954300 +Node: Miscellaneous Debugger Commands958371 +Node: Readline Support963433 +Node: Limitations964329 +Node: Debugging Summary966883 +Node: Namespaces968162 +Node: Global Namespace969273 +Node: Qualified Names970671 +Node: Default Namespace971670 +Node: Changing The Namespace972411 +Node: Naming Rules974025 +Node: Internal Name Management975873 +Node: Namespace Example976915 +Node: Namespace And Features979477 +Node: Namespace Summary980912 +Node: Arbitrary Precision Arithmetic982389 +Node: Computer Arithmetic983876 +Ref: table-numeric-ranges987642 +Ref: table-floating-point-ranges988136 +Ref: Computer Arithmetic-Footnote-1988795 +Node: Math Definitions988852 +Ref: table-ieee-formats991828 +Node: MPFR features992396 +Node: FP Math Caution994114 +Ref: FP Math Caution-Footnote-1995186 +Node: Inexactness of computations995555 +Node: Inexact representation996586 +Node: Comparing FP Values997946 +Node: Errors accumulate999187 +Node: Strange values1000643 +Ref: Strange values-Footnote-11003231 +Node: Getting Accuracy1003336 +Node: Try To Round1006046 +Node: Setting precision1006945 +Ref: table-predefined-precision-strings1007642 +Node: Setting the rounding mode1009473 +Ref: table-gawk-rounding-modes1009847 +Ref: Setting the rounding mode-Footnote-11013779 +Node: Arbitrary Precision Integers1013958 +Ref: Arbitrary Precision Integers-Footnote-11017133 +Node: Checking for MPFR1017282 +Node: POSIX Floating Point Problems1018756 +Ref: POSIX Floating Point Problems-Footnote-11023409 +Node: Floating point summary1023447 +Node: Dynamic Extensions1025637 +Node: Extension Intro1027190 +Node: Plugin License1028456 +Node: Extension Mechanism Outline1029253 +Ref: figure-load-extension1029692 +Ref: figure-register-new-function1031258 +Ref: figure-call-new-function1032351 +Node: Extension API Description1034414 +Node: Extension API Functions Introduction1036127 +Ref: table-api-std-headers1037963 +Node: General Data Types1042213 +Ref: General Data Types-Footnote-11050919 +Node: Memory Allocation Functions1051218 +Ref: Memory Allocation Functions-Footnote-11055719 +Node: Constructor Functions1055818 +Node: API Ownership of MPFR and GMP Values1059471 +Node: Registration Functions1061004 +Node: Extension Functions1061704 +Node: Exit Callback Functions1067026 +Node: Extension Version String1068276 +Node: Input Parsers1068939 +Node: Output Wrappers1081660 +Node: Two-way processors1086172 +Node: Printing Messages1088437 +Ref: Printing Messages-Footnote-11089608 +Node: Updating ERRNO1089761 +Node: Requesting Values1090500 +Ref: table-value-types-returned1091237 +Node: Accessing Parameters1092346 +Node: Symbol Table Access1093583 +Node: Symbol table by name1094095 +Ref: Symbol table by name-Footnote-11097120 +Node: Symbol table by cookie1097248 +Ref: Symbol table by cookie-Footnote-11101433 +Node: Cached values1101497 +Ref: Cached values-Footnote-11105033 +Node: Array Manipulation1105186 +Ref: Array Manipulation-Footnote-11106277 +Node: Array Data Types1106314 +Ref: Array Data Types-Footnote-11108972 +Node: Array Functions1109064 +Node: Flattening Arrays1113562 +Node: Creating Arrays1120538 +Node: Redirection API1125305 +Node: Extension API Variables1128138 +Node: Extension Versioning1128849 +Ref: gawk-api-version1129278 +Node: Extension GMP/MPFR Versioning1131010 +Node: Extension API Informational Variables1132638 +Node: Extension API Boilerplate1133711 +Node: Changes from API V11137685 +Node: Finding Extensions1139257 +Node: Extension Example1139816 +Node: Internal File Description1140614 +Node: Internal File Ops1144694 +Ref: Internal File Ops-Footnote-11156044 +Node: Using Internal File Ops1156184 +Ref: Using Internal File Ops-Footnote-11158567 +Node: Extension Samples1158841 +Node: Extension Sample File Functions1160370 +Node: Extension Sample Fnmatch1168019 +Node: Extension Sample Fork1169506 +Node: Extension Sample Inplace1170724 +Node: Extension Sample Ord1174350 +Node: Extension Sample Readdir1175186 +Ref: table-readdir-file-types1176075 +Node: Extension Sample Revout1177143 +Node: Extension Sample Rev2way1177732 +Node: Extension Sample Read write array1178472 +Node: Extension Sample Readfile1181637 +Node: Extension Sample Time1182732 +Node: Extension Sample API Tests1184484 +Node: gawkextlib1184976 +Node: Extension summary1187894 +Node: Extension Exercises1191596 +Node: Language History1192838 +Node: V7/SVR3.11194494 +Node: SVR41196646 +Node: POSIX1198080 +Node: BTL1199461 +Node: POSIX/GNU1200190 +Node: Feature History1205968 +Node: Common Extensions1223143 +Node: Ranges and Locales1224426 +Ref: Ranges and Locales-Footnote-11229042 +Ref: Ranges and Locales-Footnote-21229069 +Ref: Ranges and Locales-Footnote-31229304 +Node: Contributors1229527 +Node: History summary1235524 +Node: Installation1236904 +Node: Gawk Distribution1237848 +Node: Getting1238332 +Node: Extracting1239295 +Node: Distribution contents1240933 +Node: Unix Installation1247994 +Node: Quick Installation1248798 +Node: Compiling with MPFR1251218 +Node: Shell Startup Files1251908 +Node: Additional Configuration Options1252997 +Node: Configuration Philosophy1255312 +Node: Compiling from Git1257708 +Node: Building the Documentation1258263 +Node: Non-Unix Installation1259647 +Node: PC Installation1260107 +Node: PC Binary Installation1260945 +Node: PC Compiling1261818 +Node: PC Using1262935 +Node: Cygwin1266488 +Node: MSYS1267712 +Node: VMS Installation1268314 +Node: VMS Compilation1269033 +Ref: VMS Compilation-Footnote-11270262 +Node: VMS Dynamic Extensions1270320 +Node: VMS Installation Details1272005 +Node: VMS Running1274267 +Node: VMS GNV1278546 +Node: Bugs1279260 +Node: Bug definition1280172 +Node: Bug address1283108 +Node: Usenet1286496 +Node: Performance bugs1287685 +Node: Asking for help1290606 +Node: Maintainers1292573 +Node: Other Versions1293767 +Node: Installation summary1301931 +Node: Notes1303295 +Node: Compatibility Mode1304089 +Node: Additions1304871 +Node: Accessing The Source1305796 +Node: Adding Code1307233 +Node: New Ports1313425 +Node: Derived Files1317800 +Ref: Derived Files-Footnote-11323460 +Ref: Derived Files-Footnote-21323495 +Ref: Derived Files-Footnote-31324093 +Node: Future Extensions1324207 +Node: Implementation Limitations1324865 +Node: Extension Design1326075 +Node: Old Extension Problems1327219 +Ref: Old Extension Problems-Footnote-11328737 +Node: Extension New Mechanism Goals1328794 +Ref: Extension New Mechanism Goals-Footnote-11332158 +Node: Extension Other Design Decisions1332347 +Node: Extension Future Growth1334460 +Node: Notes summary1335066 +Node: Basic Concepts1336224 +Node: Basic High Level1336905 +Ref: figure-general-flow1337187 +Ref: figure-process-flow1337873 +Ref: Basic High Level-Footnote-11341175 +Node: Basic Data Typing1341360 +Node: Glossary1344688 +Node: Copying1376575 +Node: GNU Free Documentation License1414118 +Node: Index1439238 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index d9b7fbc3..b7e8d888 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -30167,6 +30167,17 @@ $ @kbd{gawk -f case_fold_compare.awk} @print{} n N O o p P Q q r R S s t T u U V v w W X x y Y z Z @end example +@quotation NOTE +`Under the hood,'' @command{gawk} uses the C library @code{qsort()} +function to manage the sorting. @code{qsort()} can call itself +recursively. This means that when you write a comparison function, +you should be careful to avoid the use of global variables and arrays; +use only local variables and arrays that you declare as additional +parameters to the comparison function. Otherwise, you are likely to +cause unintentional memory corruption in your global arrays and possibly +cause @command{gawk} itself to fail. +@end quotation + @node Two-way I/O @section Two-Way Communications with Another Process diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 991136c3..dde1aed2 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -29049,6 +29049,17 @@ $ @kbd{gawk -f case_fold_compare.awk} @print{} n N O o p P Q q r R S s t T u U V v w W X x y Y z Z @end example +@quotation NOTE +`Under the hood,'' @command{gawk} uses the C library @code{qsort()} +function to manage the sorting. @code{qsort()} can call itself +recursively. This means that when you write a comparison function, +you should be careful to avoid the use of global variables and arrays; +use only local variables and arrays that you declare as additional +parameters to the comparison function. Otherwise, you are likely to +cause unintentional memory corruption in your global arrays and possibly +cause @command{gawk} itself to fail. +@end quotation + @node Two-way I/O @section Two-Way Communications with Another Process @@ -1171,7 +1171,7 @@ r_get_lhs(NODE *n, bool reference) break; default: - cant_happen(); + cant_happen("unexpected variable type %s", nodetype2str(n->type)); } if (do_lint && reference && var_uninitialized(n)) @@ -1345,7 +1345,7 @@ setup_frame(INSTRUCTION *pc) break; default: - cant_happen(); + cant_happen("unexpected parameter type %s", nodetype2str(m->type)); } r->vname = fp[i].param; } diff --git a/interpret.h b/interpret.h index 3d9ba572..ca67e966 100644 --- a/interpret.h +++ b/interpret.h @@ -236,7 +236,7 @@ uninitialized_scalar: break; default: - cant_happen(); + cant_happen("unexpected parameter type %s", nodetype2str(m->type)); } } break; @@ -427,7 +427,7 @@ uninitialized_scalar: break; default: - cant_happen(); + cant_happen("unexpected lint type value %d", (int) pc->lint_type); } } break; @@ -1260,7 +1260,7 @@ match_re: } case Op_K_return_from_eval: - cant_happen(); + cant_happen("unexpected opcode %s", opcode2str(op)); break; case Op_K_return: @@ -841,7 +841,7 @@ redirect_string(const char *str, size_t explen, bool not_string, what = "|&"; break; default: - cant_happen(); + cant_happen("invalid redirection type %d", (int) redirtype); } if (do_lint && not_string) lintwarn(_("expression in `%s' redirection is a number"), @@ -1020,7 +1020,7 @@ redirect_string(const char *str, size_t explen, bool not_string, } break; default: - cant_happen(); + cant_happen("invalid redirection type %d", (int) redirtype); } if (mode != NULL) { @@ -1617,7 +1617,7 @@ str2mode(const char *mode) default: ret = 0; /* lint */ - cant_happen(); + cant_happen("invalid open mode \"%s\"", mode); } if (strchr(mode, 'b') != NULL) ret |= O_BINARY; @@ -1293,7 +1293,7 @@ catchsig(int sig) fflush(NULL); abort(); } else - cant_happen(); + cant_happen("unexpected signal, number %s", strsignal(sig)); /* NOTREACHED */ } @@ -516,7 +516,7 @@ mpg_cmp_as_numbers(const NODE *t1, const NODE *t2, scalar_cmp_t comparison_type) ret = (di >= 0); break; default: - cant_happen(); + cant_happen("invalid comparison type %d", (int) comparison_type); break; } @@ -543,7 +543,7 @@ mpg_update_var(NODE *n) nr = FNR; nq = MFNR; } else - cant_happen(); + cant_happen("invalid node for mpg_update_var%s", ""); if (mpz_sgn(nq) == 0) { /* Efficiency hack similar to that for AWKNUM */ @@ -575,7 +575,7 @@ mpg_set_var(NODE *n) else if (n == FNR_node) nq = MFNR; else - cant_happen(); + cant_happen("invalid node for mpg_set_var%s", ""); if (is_mpg_integer(val)) r = val->mpg_i; @@ -1894,7 +1894,7 @@ mod: r = mpg_pow(t1, t2); break; default: - cant_happen(); + cant_happen("unexpected opcode %s", opcode2str(op)); } DEREF(t2); @@ -373,8 +373,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) break; default: - fprintf(stderr, "Got unexpected type %s\n", nodetype2str(m->type)); - cant_happen(); + cant_happen("got unexpected type %s", nodetype2str(m->type)); } switch (pc->opcode) { @@ -581,7 +580,7 @@ cleanup: case Op_K_delete_loop: /* Efficency hack not in effect because of exec_count instruction */ - cant_happen(); + cant_happen("unexpected opcode %s", opcode2str(pc->opcode)); break; case Op_in_array: @@ -1219,7 +1218,7 @@ cleanup: break; default: - cant_happen(); + cant_happen("unexpected opcode %s", opcode2str(pc->opcode)); } if (pc == endp) @@ -144,7 +144,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) case '7': c2 = parse_escape(&src); if (c2 < 0) - cant_happen(); + cant_happen("received bad result %d from parse_escape()", c2); /* * Unix awk treats octal (and hex?) chars * literally in re's, so escape regexp @@ -631,7 +631,7 @@ load_symbols() *aptr = dupnode(untyped); break; default: - cant_happen(); + cant_happen("unexpected node type %s", nodetype2str(r->type)); break; } } @@ -922,7 +922,7 @@ free_bc_internal(INSTRUCTION *cp) unref(m); break; case Op_illegal: - cant_happen(); + cant_happen("unexpected opcode %s", opcode2str(cp->opcode)); default: break; } |