[m-rev.] diff: delete unused string formatting predicates

Julien Fischer jfischer at opturion.com
Thu Feb 9 10:32:55 AEDT 2023


Delete unused string formatting predicates.

library/string.format.m:
     Delete the old predicates for formatting ints as unsigned values;
     these are now unused.

configure.ac:
     Require the use of a compiler that does not generate references
     to the deleted predicates.

compiler/introduced_call_table.m:
     Delete the above predicates from the introduced call table.

Julien.

diff --git a/compiler/introduced_call_table.m b/compiler/introduced_call_table.m
index 5840555..69716f8 100644
--- a/compiler/introduced_call_table.m
+++ b/compiler/introduced_call_table.m
@@ -427,10 +427,6 @@ mict_string_format("format_unsigned_int64_component_nowidth_noprec", 4).
  mict_string_format("format_unsigned_int64_component_nowidth_prec", 5).
  mict_string_format("format_unsigned_int64_component_width_noprec", 5).
  mict_string_format("format_unsigned_int64_component_width_prec", 6).
-mict_string_format("format_unsigned_int_component_nowidth_noprec", 4).
-mict_string_format("format_unsigned_int_component_nowidth_prec", 5).
-mict_string_format("format_unsigned_int_component_width_noprec", 5).
-mict_string_format("format_unsigned_int_component_width_prec", 6).

  :- pred mict_table_builtin(string::in, int::in) is semidet.
  :- pragma inline(pred(mict_table_builtin/2)).
diff --git a/configure.ac b/configure.ac
index dadb806..6fc12e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -574,7 +574,7 @@ EOF
          $BOOTSTRAP_MC \
              --verbose \
              $link_static_opt conftest \
-            --trans-opt-deps-spec dummy \
+            --format-2023-01-27 \
              --no-ssdb \
              </dev/null >&AS_MESSAGE_LOG_FD 2>&1 &&
          test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" &&
diff --git a/library/string.format.m b/library/string.format.m
index a0edcaa..5933315 100644
--- a/library/string.format.m
+++ b/library/string.format.m
@@ -59,15 +59,6 @@
  :- pred format_signed_int_component_width_prec(string_format_flags::in,
      int::in, int::in, int::in, string::out) is det.

-:- pred format_unsigned_int_component_nowidth_noprec(string_format_flags::in,
-    string_format_int_base::in, int::in, string::out) is det.
-:- pred format_unsigned_int_component_nowidth_prec(string_format_flags::in,
-    int::in, string_format_int_base::in, int::in, string::out) is det.
-:- pred format_unsigned_int_component_width_noprec(string_format_flags::in,
-    int::in, string_format_int_base::in, int::in, string::out) is det.
-:- pred format_unsigned_int_component_width_prec(string_format_flags::in,
-    int::in, int::in, string_format_int_base::in, int::in, string::out) is det.
-
  :- pred format_uint_component_nowidth_noprec(string_format_flags::in,
      string_format_int_base::in, uint::in, string::out) is det.
  :- pred format_uint_component_nowidth_prec(string_format_flags::in,
@@ -317,33 +308,6 @@ format_signed_int_component_width_prec(Flags, Width, Prec, Int, String) :-

  %---------------------------------------------------------------------------%

-format_unsigned_int_component_nowidth_noprec(Flags, Base, Int, String) :-
-    MaybeWidth = no_specified_width,
-    MaybePrec = no_specified_prec,
-    format_unsigned_int_component(Flags, MaybeWidth, MaybePrec, Base, Int,
-        String).
-
-format_unsigned_int_component_nowidth_prec(Flags, Prec, Base, Int, String) :-
-    MaybeWidth = no_specified_width,
-    MaybePrec = specified_prec(Prec),
-    format_unsigned_int_component(Flags, MaybeWidth, MaybePrec, Base, Int,
-        String).
-
-format_unsigned_int_component_width_noprec(Flags, Width, Base, Int, String) :-
-    MaybeWidth = specified_width(Width),
-    MaybePrec = no_specified_prec,
-    format_unsigned_int_component(Flags, MaybeWidth, MaybePrec, Base, Int,
-        String).
-
-format_unsigned_int_component_width_prec(Flags, Width, Prec, Base, Int,
-        String) :-
-    MaybeWidth = specified_width(Width),
-    MaybePrec = specified_prec(Prec),
-    format_unsigned_int_component(Flags, MaybeWidth, MaybePrec, Base, Int,
-        String).
-
-%---------------------------------------------------------------------------%
-
  format_uint_component_nowidth_noprec(Flags, Base, UInt, String) :-
      MaybeWidth = no_specified_width,
      MaybePrec = no_specified_prec,
@@ -524,27 +488,6 @@ format_signed_int_component(Flags, MaybeWidth, MaybePrec, Int, String) :-
          String = format_signed_int(Flags, MaybeWidth, MaybePrec, Int)
      ).

-:- pred format_unsigned_int_component(string_format_flags::in,
-    string_format_maybe_width::in, string_format_maybe_prec::in,
-    string_format_int_base::in, int::in, string::out) is det.
-
-format_unsigned_int_component(Flags, MaybeWidth, MaybePrec, Base, Int,
-        String) :-
-    ( if using_sprintf then
-        ( Base = base_octal,   SpecChar = "o"
-        ; Base = base_decimal, SpecChar = "u"
-        ; Base = base_hex_lc,  SpecChar = "x"
-        ; Base = base_hex_uc,  SpecChar = "X"
-        ; Base = base_hex_p,   SpecChar = "p"
-        ),
-        FormatStr = make_format_sprintf(Flags, MaybeWidth, MaybePrec,
-            int_length_modifier, SpecChar),
-        String = native_format_int(FormatStr, Int)
-    else
-        UInt = cast_from_int(Int),
-        String = format_uint(Flags, MaybeWidth, MaybePrec, Base, UInt)
-    ).
-
  :- pred format_uint_component(string_format_flags::in,
      string_format_maybe_width::in, string_format_maybe_prec::in,
      string_format_int_base::in, uint::in, string::out) is det.



More information about the reviews mailing list