diff --git a/boot/usage.ml b/boot/usage.ml index e32723c3b9..0a6b437c5d 100644 --- a/boot/usage.ml +++ b/boot/usage.ml @@ -34,7 +34,7 @@ let print_usage_common co command = \n -boot don't bind the `Stdlib.` prefix to the default -coqlib dir\ \n -noinit don't load Stdlib.Init.Prelude on start\ \n -nois (idem)\ -\n -compat X.Y same as -compat-from Stdlib CoqXY\ +\n -compat X.Y same as -compat-from Stdlib RocqXY (or CoqXY when X is 8)\ \n -compat-from root lib same as -require-import-from root lib, except that\ \n a non existing file only produces a warning\ \n\ diff --git a/doc/changelog/09-cli-tools/19370-compat-from.rst b/doc/changelog/09-cli-tools/19370-compat-from.rst index 89937d0df0..bc4ae8cfe7 100644 --- a/doc/changelog/09-cli-tools/19370-compat-from.rst +++ b/doc/changelog/09-cli-tools/19370-compat-from.rst @@ -1,7 +1,7 @@ - **Added:** :ref:`command line option ` ``-compat-from`` to enable writing compatibility files for libraries similarly to the - ``-compat`` option for Coq + ``-compat`` option for Rocq (`#19370 `_, by Pierre Roux). - **Added:** diff --git a/doc/sphinx/practical-tools/coq-commands.rst b/doc/sphinx/practical-tools/coq-commands.rst index 44b3e9ec7b..30b924d342 100644 --- a/doc/sphinx/practical-tools/coq-commands.rst +++ b/doc/sphinx/practical-tools/coq-commands.rst @@ -419,7 +419,8 @@ and ``coqtop``, unless stated otherwise: *string* must be :n:`"@setting_name"`. See the :ref:`note above ` regarding the order of command-line options. -:-compat *version*: same as ``-compat-from Stdlib Coq`` +:-compat *version*: same as ``-compat-from Stdlib Rocq`` + (or ``Coq`` when version is ``8.*``) :-compat-from *root* *library*: Loads a file that sets a few options to maintain partial backward-compatibility with a previous version. This is equivalent to ``-require-import-from `` diff --git a/lib/deprecation.ml b/lib/deprecation.ml index 7d1655485e..750395fe70 100644 --- a/lib/deprecation.ml +++ b/lib/deprecation.ml @@ -96,6 +96,6 @@ module Version = struct let v9_0 = get_generic_cat "9.0" (* When adding a new version here, please also add #[export] Set Warnings "-deprecated-since-X.Y". - in theories/Compat/CoqX{Y-1}.v *) + in theories/Compat/RocqX{Y-1}.v *) end diff --git a/sysinit/coqargs.ml b/sysinit/coqargs.ml index 4f99191e32..c0e26b993e 100644 --- a/sysinit/coqargs.ml +++ b/sysinit/coqargs.ml @@ -294,7 +294,10 @@ let parse_args ~usage ~init arglist : t * string list = }} |"-compat" -> - let xy = String.(concat "" ("Coq" :: split_on_char '.' (next ()))) in + let arg = String.split_on_char '.' (next ()) in + let rocq_name = match arg with "8" :: _ -> "Coq" | _ -> "Rocq" in + (* remove the above and replace by "Rocq" once theories/Compat/Coq820.v is removed *) + let xy = String.concat "" (rocq_name :: arg) in add_vo_require oval xy ~allow_failure:true (Some "Stdlib") (Some Lib.Import) |"-exclude-dir" -> diff --git a/theories/Compat/Coq820.v b/theories/Compat/Coq820.v index dff223e2a7..6005b03e7c 100644 --- a/theories/Compat/Coq820.v +++ b/theories/Compat/Coq820.v @@ -10,4 +10,7 @@ (** Compatibility file for making Coq act similar to Coq v8.20 *) +(** When removing this file, please cleanup the "-compat" option code + in sysinit/coqargs.ml *) + #[export] Set Warnings "-deprecated-since-8.21". diff --git a/theories/Compat/README.md b/theories/Compat/README.md index d1a538b381..fcdd970441 100644 --- a/theories/Compat/README.md +++ b/theories/Compat/README.md @@ -3,7 +3,7 @@ command line option, in order to provide compatibility features to mimick some behaviors of older versions. For instance, this can disable warnings introduced in later versions. -When adding a file in this directory, please name it `CoqXY.v` and -prepend `From Stdlib Require Export CoqXY.` to the previous file. +When adding a file in this directory, please name it `RocqXY.v` and +prepend `From Stdlib Require Export RocqXY.` to the previous file. When removing the last remaining content of some file, please also remove the file altogether.