Commit Graph

106 Commits

Author SHA1 Message Date
tg 92370ec355 shave off 12 bytes (with fixed gcc) by making the definitions more legible
(and dropping struct padding, tbh)
2016-07-27 00:55:27 +00:00
tg 2364bb5f22 use ^< and ^> for ROL and ROR in R53, schedule >>> as SAR for R54
cf. http://david.tribble.com/text/c0xrot.htm
2016-07-25 20:41:23 +00:00
tg c3e794c4d0 rework string pooling; disable our own (rely on compiler’s)…
• if HAVE_STRING_POOLING is set to 1
• if HAVE_STRING_POOLING is set to 2 and not GCC < 4 is used
• if HAVE_STRING_POOLING is not set to 0 and LLVM or GCC >= 4 is used

Closes: LP#1580348
2016-07-25 00:04:48 +00:00
tg 92833fc6ce fix utf_widthadj/utf_skipcols handling for the remaining cases I can spot 2016-05-05 22:56:15 +00:00
tg 152eee2085 handle combining characters at the end of the string correctly 2016-05-05 21:33:46 +00:00
tg 7c93759f66 fix invalid read for ksh93-style base-1 integers
(valgrind; reported by fmunozs via IRC, thanks!)
2016-03-01 18:29:38 +00:00
tg a3c28ebd67 plug a few display problems with special parameter name expansions
reported by Stéphane Chazelas
2016-02-26 18:48:14 +00:00
tg 000580ca8f fix buffer overrun (LP#1533394) 2016-01-14 21:17:50 +00:00
tg 124e6693e9 janitorial work 2015-11-29 17:05:02 +00:00
tg 1a4f644d6e save ~1½K from the bootfloppy by reusing MirBSD libkern wcwidth(3)
but don’t bother for this for the regular /bin/mksh either
to keep the generic code path tested well
2015-10-24 19:45:23 +00:00
tg 4adcfe8b58 oksh sync, simplify *all* if(x)free(x); constructs, simplify x_push() and sync boilerplate while here 2015-09-05 19:19:12 +00:00
tg f66c194f29 oksh sync RCSIDs only:
• expr.c long done already
• mksh.1 does not apply to us (no character classes)
2014-12-15 23:26:36 +00:00
tg 9eed448a96 Unicode 7.0.0 2014-06-24 19:53:19 +00:00
tg 89e774fd7e • fix ${12345678901234567890} segfault (OOB access / integer overflow)
‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
  ‣ always use our wcwidth code
  ‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
2014-01-05 21:57:29 +00:00
tg 2f7eec765d merge oksh’s “ctype cleanups” commit
(not much of it applies since we don’t use the OS’ table-based lookup)
2014-01-05 19:11:46 +00:00
tg 328cbf510c Unicode 6.3.0 2013-11-30 23:20:04 +00:00
tg 3bc3e8665a fix postun in not evaluated side of e.g. ternary operator (LP#1187729) 2013-07-21 18:38:56 +00:00
tg 49d1ebfb71 Replace wcwidth code by mine based on Unicode 6.2.0 2013-05-31 23:27:14 +00:00
tg 75a4809a3a fix remaining signed int nonsense I am aware of 2013-04-26 19:10:58 +00:00
tg 1df3efdb86 another intermediate step/commit to get arithmetics right:
do the correct operations for comparisons (just keep using the
signed/unsigned switch from bivui for them), division (by working
on absolutes and adding the sign at the end), modulo (stupidly by
divising in signed, multiplying and subtracting, to get the sign
of the result right)

also adds rotation

XXX to check: do we need to AND before assigning the result in division?
2013-04-14 13:36:53 +00:00
tg 7cce9de0bc one can’t cast an unsigned int to a signed int portably either, if the value
is larger than the positive range of the latter (implementation-defined), so
avoid them in all explicit cases and rearrange stuff and check for it

(I’m gonna have to revise lots more code…)
2013-04-01 02:37:53 +00:00
tg fb3555d7f5 got an SAR, thanks to dalias on IRC 2013-04-01 02:28:35 +00:00
tg e1a4c3ed28 do use val.u on the RHS of a shift 2013-04-01 01:29:47 +00:00
tg 0f417614dd ugh, signed >> on negative values is implementation-defined
(but, at least, not undefined, and usually right; regress-test for it)
2013-04-01 01:16:37 +00:00
tg d96c733069 looks like multiplication is also the same between signed and unsigned 2013-04-01 01:02:09 +00:00
tg 6a745a01fa begin using unsigned arithmetics internally as much as possible
(i.e. where signedness doesn’t matter, given -fwrapv) and note
where there’s work to do; note future improvements and additions;
optimise a little

mostly untested
2013-03-31 18:33:13 +00:00
tg 24b81b5969 RCSID-only sync: oksh found out about idivwrapv 2013-03-29 16:54:05 +00:00
tg 12f0ff60d2 prevent more access to invalid memories (Debian #700604) 2013-02-15 18:36:48 +00:00
tg d8662eb228 even more hacks to pass “-O666 -fstrict-overflow -Wstrict-overflow=9 -flto=jobserver” with “gcc version 4.8.0 20120930 (experimental) [trunk revision 191865] (Debian 20120930-1)” ☹ plus make the rtchecks mandatory 2012-10-03 17:24:23 +00:00
tg 0415b74436 Update wcwidth data from Unicode 6.1.0 2012-09-01 23:46:41 +00:00
tg c1f821d4e5 (mksh) tighten 32-bit requirements; (lksh) switch to long; allow any bitness 2012-06-28 20:17:39 +00:00
tg dc5ae267ce make tempvar() and vtemp global 2012-06-28 20:02:29 +00:00
tg 9646c98356 I give up on writing (1 << 31) in any form.
Now we just use 0x80000000UL and cast that to mksh_uari_t and,
if required, that to mksh_ari_t afterwards.
2012-03-31 17:52:33 +00:00
tg e67b98e21b use _setjmp/_longjmp on NeXTstep: its Intel port always restores the signal mask on siglongjmp, which we never have 2012-03-31 17:30:00 +00:00
tg cf75e7b6ce couple of minor/cosmetic fixes from RT’s compile farm:
• promote SCO OpenServer and UnixWare to !oswarn
• omit trying -O2/-O on OpenServer 5 and USL C
• cast mksh_ari_t to int, mksh_uari_t to unsigned int for printf
• skip ulimit-1 on syllable (which is still too broken)
• write ((mksh_ari_t)-2147483648) ipv UB ((mksh_ari_t)1 << 31)
  and add a comment that that is actually meant
• rewrite functions returning !void ending in NOTREACHED
  so they’ve got a jump target returning an error at the
  end, to aid older compilers and just to be safe
• cast struct stat.st_size to off_t or size_t explicitly when needed
• shorten struct env by two bytes and an alignment, at least

also, optimise control flow and fix more paren matching cases
2012-03-29 19:23:01 +00:00
tg 7ec1ae3771 followup for cid 1004EE408E1382C1752 and 1004EE40DDD498FBB0D:
do a mirtoconf run-time check (ugh) to see whether the CPU designers
smoked/were brain-dead or if we don’t actually need the manual check
2011-12-31 02:04:18 +00:00
tg 5070ea2387 skip R/O check in an unevaluated ternary part; 10x jilles 2011-12-16 20:03:02 +00:00
tg e18f4d114a actually, behave with silent wraparound; results validated by bc(1) 2011-12-11 01:56:43 +00:00
tg 971b153933 catch intmin/-1 instead of dumping core on SIGFPE; from Jilles Tjoelker 2011-12-11 01:35:10 +00:00
tg 9782f6b4d1 • access(2) is broken in at least kFreeBSD 9.0 as “modern” OS, so bring
back the wrapper code as well as refactor most other code calling it
• apparently, names can’t end in ‘_’ or contain ‘__’ anywhere…
2011-09-07 15:24:22 +00:00
tg 577c918beb patch most of Jerker Bäck’s concerns out, unless not applicable 2011-08-27 18:06:52 +00:00
tg 210608b199 regenerate all wcwidth code from UCD 6.0.0 and related tables,
and mgk25’s wcwidth.c 5.0 code; add check against 2-byte wchar_t;
optimise libc wcwidth(3) implementation taken from mksh and sync these
2010-12-11 16:05:03 +00:00
tg e57379aab7 regenerate from Unicode 6.0.0 2010-11-01 17:28:49 +00:00
tg 3747722db4 improve string pooling: saves 316 bytes in .text 2010-08-28 18:50:58 +00:00
tg 23f3f58d14 on MirBSD we can use the system wcwidth() and save ~800by on the ramdisc 2010-08-14 21:35:13 +00:00
tg f3b3b4b1fb remove some debugging code 2010-01-25 14:38:04 +00:00
tg 769e222586 re-vamp __attribute__ handling; let this pass on HP-UX bundled compiler
as well as HP aCC
2009-12-12 22:27:10 +00:00
tg a77bbf6123 HP aCC tells me I'm using "const" twice, and /usr/ccs/bin/cc even
errors out here. Let's hope that this form will *still* have the
entirety of that array in .rodata...

XXX more to come, thanks to HP DSPP PvP, e.g. __attribute__ stuff
2009-12-08 19:23:34 +00:00
tg 703551bd4f attempt a better fix: break off widthadj upon encountering NUL,
add remaining columns as octets (should also speed optimise)
2009-12-05 20:17:59 +00:00
tg a09f05e77a /me is annoyed
I read, IIRC in the Cederqvist, that 'cvs tag' sets a sticky tag onto
the cwd… it doesn’t, apparently. (I actually like it better this way,
but one needs to know!)
2009-11-28 14:28:03 +00:00