summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authoralainfrisch <alain@frisch.fr>2016-07-13 11:04:16 +0200
committeralainfrisch <alain@frisch.fr>2016-07-19 14:28:51 +0200
commit012e1ef878cc2aa0ffc759858dc7ced36fa97f6a (patch)
tree310c3ceea38149b72f76d6aaf04059d3d1f9cf14 /driver
parent507507829e9639374ede5a2dade1bb6d6b98ad49 (diff)
downloadocaml-012e1ef878cc2aa0ffc759858dc7ced36fa97f6a.tar.gz
"./configure -safe-string" to force safe-string mode
When configured with -safe-string, the OCaml tools will default to the safe-string mode and ignore -unsafe-string command-line arguments. This is intended to serve two purposes: - Facilitate the detection of packages that are not ready for -safe-string ready. (Perhaps with some OPAM switch?) - Enable some optimizations that assume that all linked units are compiled with -safe-string. Note: currently, there is no check that units compiled with an OCaml configured without -safe-string are not linked in.
Diffstat (limited to 'driver')
-rw-r--r--driver/main_args.ml13
1 files changed, 11 insertions, 2 deletions
diff --git a/driver/main_args.ml b/driver/main_args.ml
index 35f91b4358..efefdddc62 100644
--- a/driver/main_args.ml
+++ b/driver/main_args.ml
@@ -423,7 +423,9 @@ let mk_S f =
;;
let mk_safe_string f =
- "-safe-string", Arg.Unit f, " Make strings immutable"
+ "-safe-string", Arg.Unit f,
+ if Config.safe_string then " Make strings immutable (default)"
+ else " Make strings immutable"
;;
let mk_shared f =
@@ -476,7 +478,14 @@ let mk_unsafe f =
;;
let mk_unsafe_string f =
- "-unsafe-string", Arg.Unit f, " Make strings mutable (default)"
+ if Config.safe_string then
+ let err () =
+ raise (Arg.Bad "OCaml has been configured with -safe-string: \
+ -unsafe-string is not available")
+ in
+ "-unsafe-string", Arg.Unit err, " (option not available)"
+ else
+ "-unsafe-string", Arg.Unit f, " Make strings mutable (default)"
;;
let mk_use_runtime f =