ref: c1785ddd18f21259671a5d8347a5b39ab151b1f4
parent: d48c3220b5bbf3604b0b16d344d3cc0c17c5f8a7
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Dec 25 05:06:36 EST 2016
Make float parsing stricter. Empty strings are not mumbers.
--- a/lib/std/fltparse.myr
+++ b/lib/std/fltparse.myr
@@ -284,7 +284,9 @@
const denormal = {x, v, rem, lim
var m, z
- if x.dig.len == 2
+ if x.dig.len == 0
+ m = 0
+ elif x.dig.len == 2
m = (x.dig[0] : uint64)
m |= (x.dig[1] : uint64) << 32
else
--- a/lib/std/intparse.myr
+++ b/lib/std/intparse.myr
@@ -14,10 +14,14 @@
generic intparse = {s
var isneg
+
isneg = false
if hasprefix(s, "-")
s = s[1:]
isneg = true
+ ;;
+ if s.len == 0
+ -> `None
;;
if hasprefix(s, "0x")
--- a/mk/c.mk
+++ b/mk/c.mk
@@ -9,7 +9,7 @@
_LIBPATHS=$(addprefix -l, $(patsubst lib%.a,%,$(notdir $(DEPS)))) $(_PCLIBS)
# yeah, I should probably remove -Werror, but it's nice for developing alone.
-CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -g -O0
+CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare -g -O3
CFLAGS += -MMD -MP -MF .deps/$(subst /,-,$*).d
LIB ?= $(INSTLIB)