summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2017-09-30 23:20:06 +0200
committerDamien Doligez <damien.doligez@gmail.com>2017-10-02 14:42:19 +0200
commit6550a30719e4d41b9f5341f04ab882f1e2ce1731 (patch)
treeca24123cd75604559ff7d318d983908b737c16ea /configure
parentb8763f8897dd6e0e072641537500f380c8c6bfbb (diff)
downloadocaml-6550a30719e4d41b9f5341f04ab882f1e2ce1731.tar.gz
safe-string: clarify the relation between configure- and compile-time options
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure37
1 files changed, 36 insertions, 1 deletions
diff --git a/configure b/configure
index e854b86217..bbc5b62b80 100755
--- a/configure
+++ b/configure
@@ -64,6 +64,7 @@ TOOLPREF=""
with_cfi=true
flambda=false
safe_string=false
+safe_string_default=true
afl_instrument=false
max_testsuite_dir_retries=0
with_cplugins=false
@@ -214,8 +215,36 @@ while : ; do
;; # Ignored for backward compatibility
-fPIC|--fPIC)
with_fpic=true;;
+ # There are two configure-time string safety option,
+ # (un)safe-string and (un)safe-string-default that interact
+ # with a compile-time (un)safe-string option.
+ #
+ # If -safe-string is set at configure time, then the compiler will
+ # always enforce that string and bytes are distinct: the
+ # compile-time -unsafe-string option is disabled. This lets us
+ # assume pervasive string immutability, for code optimizations and
+ # in the C layer.
+ #
+ # If -safe-string is not set at configure-time (if its
+ # negation -unsafe-string is used), the compiler will use the
+ # compile-time (un)safe-string setting to decide whether string
+ # and bytes are compatible on a per-module basis. The
+ # configure-time options (un)safe-string-default decide which
+ # setting will be chosen by default, if no compile-time option
+ # is explicitly passed.
+ #
+ # The configure-time behavior of OCaml 4.05 and older was
+ # equivalent to -unsafe-string -unsafe-string-default.
+ # then). OCaml 4.06 uses -unsafe-string -safe-string-default. We
+ # expect -safe-string to become the default in the future.
-safe-string|--safe-string)
safe_string=true;;
+ -unsafe-string|--unsafe-string)
+ safe_string=false;;
+ -safe-string-default|--safe-string-default)
+ safe_string_default=true;;
+ -unsafe-string-default|--unsafe-string-default)
+ safe_string_default=false;;
-flat-float-array|--flat-float-array)
flat_float_array=true;;
-no-flat-float-array|--no-flat-float-array)
@@ -2101,6 +2130,7 @@ if [ "$ostype" = Cygwin ]; then
fi
config FLAMBDA "$flambda"
config SAFE_STRING "$safe_string"
+config SAFE_STRING_DEFAULT "$safe_string_default"
config WINDOWS_UNICODE "0"
config AFL_INSTRUMENT "$afl_instrument"
config MAX_TESTSUITE_DIR_RETRIES "$max_testsuite_dir_retries"
@@ -2221,10 +2251,15 @@ else
else
inf " using flambda middle-end . no"
fi
- if test "$safe_string" = "true"; then
+ if $safe_string; then
inf " safe strings ............. yes"
else
inf " safe strings ............. no"
+ if $safe_string_default; then
+ inf " (-safe-string is the default per-module option)"
+ else
+ inf " (-unsafe-string is the default per-module option)"
+ fi
fi
if $flat_float_array; then
inf " flat float arrays ........ yes"