diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2023-01-04 21:03:24 +0000 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2023-01-05 16:55:30 +0000 |
commit | 4413365616e8c6024d1ff4e23309e5012ee33b9f (patch) | |
tree | 7a78aa715239f0da417222414d4c2238553e9980 | |
parent | 80ff207da6d8784e227eb93f75c4ac5a300c8420 (diff) | |
download | gcc-4413365616e8c6024d1ff4e23309e5012ee33b9f.zip gcc-4413365616e8c6024d1ff4e23309e5012ee33b9f.tar.gz gcc-4413365616e8c6024d1ff4e23309e5012ee33b9f.tar.bz2 |
modula-2: Remove uses of scalb*() and significand*() [PR107631]
The scalb*() functions are obsolete in Posix from 2004 and removed in
2008.
The significand*() functions are glibc-only and considered there to be
obsolescent (not supported for types such as _Float128).
We can remove them from Modula-2 since they are not required for ISO
support, but we need to provide an implementation of significand* for
the "fraction()" functions.
PR modula2/107631
gcc/m2/ChangeLog:
* gm2-gcc/m2builtins.cc: Remove scalb, scalbf, scalbl,
significand, significandf, significandl.
* gm2-libs/Builtins.def (significand): Likewise.
* gm2-libs/Builtins.mod: Likewise.
* target-independent/Builtins.texi: Likewise.
* gm2-libs-iso/LowLong.mod: Implement fraction with scalbn*() and
ilogb*().
* gm2-libs-iso/LowReal.mod: Likewise.
* gm2-libs-iso/LowShort.mod: Likewise.
-rw-r--r-- | gcc/m2/gm2-gcc/m2builtins.cc | 12 | ||||
-rw-r--r-- | gcc/m2/gm2-libs-iso/LowLong.mod | 5 | ||||
-rw-r--r-- | gcc/m2/gm2-libs-iso/LowReal.mod | 4 | ||||
-rw-r--r-- | gcc/m2/gm2-libs-iso/LowShort.mod | 4 | ||||
-rw-r--r-- | gcc/m2/gm2-libs/Builtins.def | 8 | ||||
-rw-r--r-- | gcc/m2/gm2-libs/Builtins.mod | 30 | ||||
-rw-r--r-- | gcc/m2/target-independent/Builtins.texi | 14 |
7 files changed, 6 insertions, 71 deletions
diff --git a/gcc/m2/gm2-gcc/m2builtins.cc b/gcc/m2/gm2-gcc/m2builtins.cc index bbfc605..35901a2 100644 --- a/gcc/m2/gm2-gcc/m2builtins.cc +++ b/gcc/m2/gm2-gcc/m2builtins.cc @@ -192,12 +192,6 @@ static struct builtin_function_entry list_of_builtins[] = { "signbitf", NULL, NULL }, { "__builtin_signbitl", BT_FN_INT_LONG_DOUBLE, BUILT_IN_SIGNBITL, BUILT_IN_NORMAL, "signbitl", NULL, NULL }, - { "__builtin_significand", BT_FN_DOUBLE_DOUBLE, BUILT_IN_SIGNIFICAND, - BUILT_IN_NORMAL, "significand", NULL, NULL }, - { "__builtin_significandf", BT_FN_FLOAT_FLOAT, BUILT_IN_SIGNIFICANDF, - BUILT_IN_NORMAL, "significandf", NULL, NULL }, - { "__builtin_significandl", BT_FN_LONG_DOUBLE_LONG_DOUBLE, - BUILT_IN_SIGNIFICANDL, BUILT_IN_NORMAL, "significandl", NULL, NULL }, { "__builtin_modf", BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, BUILT_IN_MODF, BUILT_IN_NORMAL, "modf", NULL, NULL }, { "__builtin_modff", BT_FN_FLOAT_FLOAT_FLOATPTR, BUILT_IN_MODFF, @@ -216,12 +210,6 @@ static struct builtin_function_entry list_of_builtins[] = { BUILT_IN_NEXTTOWARDF, BUILT_IN_NORMAL, "nexttowardf", NULL, NULL }, { "__builtin_nexttowardl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE, BUILT_IN_NEXTTOWARDL, BUILT_IN_NORMAL, "nexttowardl", NULL, NULL }, - { "__builtin_scalb", BT_FN_DOUBLE_DOUBLE_DOUBLE, BUILT_IN_SCALB, - BUILT_IN_NORMAL, "scalb", NULL, NULL }, - { "__builtin_scalbf", BT_FN_FLOAT_FLOAT_FLOAT, BUILT_IN_SCALBF, - BUILT_IN_NORMAL, "scalbf", NULL, NULL }, - { "__builtin_scalbl", BT_FN_LONG_DOUBLE_LONG_DOUBLE_LONG_DOUBLE, - BUILT_IN_SCALBL, BUILT_IN_NORMAL, "scalbl", NULL, NULL }, { "__builtin_scalbln", BT_FN_DOUBLE_DOUBLE_LONG, BUILT_IN_SCALBLN, BUILT_IN_NORMAL, "scalbln", NULL, NULL }, { "__builtin_scalblnf", BT_FN_FLOAT_FLOAT_LONG, BUILT_IN_SCALBLNF, diff --git a/gcc/m2/gm2-libs-iso/LowLong.mod b/gcc/m2/gm2-libs-iso/LowLong.mod index 74f7ca9..9842679 100644 --- a/gcc/m2/gm2-libs-iso/LowLong.mod +++ b/gcc/m2/gm2-libs-iso/LowLong.mod @@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see IMPLEMENTATION MODULE LowLong ; FROM SYSTEM IMPORT ADDRESS ; -FROM Builtins IMPORT ilogbl, significandl, modfl, signbitl, scalbnl, huge_vall, nextafterl ; +FROM Builtins IMPORT ilogbl, modfl, signbitl, scalbnl, huge_vall, nextafterl ; FROM dtoa IMPORT Mode, strtod, dtoa ; FROM libc IMPORT free ; FROM RealMath IMPORT power ; @@ -64,10 +64,9 @@ END exponent ; PROCEDURE fraction (x: LONGREAL) : LONGREAL ; BEGIN - RETURN significandl(x) + RETURN scalbnl(x, -ilogbl (x)) END fraction ; - (* sign - returns the signum of x. sign(x) = 1.0 for all x>0.0 sign(x) = -1.0 for all x<0.0. diff --git a/gcc/m2/gm2-libs-iso/LowReal.mod b/gcc/m2/gm2-libs-iso/LowReal.mod index cc74f65..7db6ff0 100644 --- a/gcc/m2/gm2-libs-iso/LowReal.mod +++ b/gcc/m2/gm2-libs-iso/LowReal.mod @@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see IMPLEMENTATION MODULE LowReal ; FROM SYSTEM IMPORT ADDRESS ; -FROM Builtins IMPORT ilogb, significand, modf, signbit, scalbn, huge_val, nextafter ; +FROM Builtins IMPORT ilogb, modf, signbit, scalbn, huge_val, nextafter ; FROM dtoa IMPORT Mode, strtod, dtoa ; FROM libc IMPORT free ; FROM RealMath IMPORT power ; @@ -64,7 +64,7 @@ END exponent ; PROCEDURE fraction (x: REAL) : REAL ; BEGIN - RETURN significand(x) + RETURN scalbn (x, -ilogb (x)) END fraction ; diff --git a/gcc/m2/gm2-libs-iso/LowShort.mod b/gcc/m2/gm2-libs-iso/LowShort.mod index 8921982..e820711 100644 --- a/gcc/m2/gm2-libs-iso/LowShort.mod +++ b/gcc/m2/gm2-libs-iso/LowShort.mod @@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see IMPLEMENTATION MODULE LowShort ; FROM SYSTEM IMPORT ADDRESS ; -FROM Builtins IMPORT ilogbf, significandf, modff, signbitf, scalbnf, huge_valf, nextafterf ; +FROM Builtins IMPORT ilogbf, modff, signbitf, scalbnf, huge_valf, nextafterf ; FROM dtoa IMPORT Mode, strtod, dtoa ; FROM libc IMPORT free ; FROM RealMath IMPORT power ; @@ -64,7 +64,7 @@ END exponent ; PROCEDURE fraction (x: SHORTREAL) : SHORTREAL ; BEGIN - RETURN significandf(x) + RETURN scalbnf (x, -ilogbf (x)) END fraction ; diff --git a/gcc/m2/gm2-libs/Builtins.def b/gcc/m2/gm2-libs/Builtins.def index 1c32169..8d849be 100644 --- a/gcc/m2/gm2-libs/Builtins.def +++ b/gcc/m2/gm2-libs/Builtins.def @@ -78,10 +78,6 @@ PROCEDURE __BUILTIN__ huge_val () : REAL ; PROCEDURE __BUILTIN__ huge_valf () : SHORTREAL ; PROCEDURE __BUILTIN__ huge_vall () : LONGREAL ; -PROCEDURE __BUILTIN__ significand (r: REAL) : REAL ; -PROCEDURE __BUILTIN__ significandf (s: SHORTREAL) : SHORTREAL ; -PROCEDURE __BUILTIN__ significandl (l: LONGREAL) : LONGREAL ; - PROCEDURE __BUILTIN__ modf (x: REAL; VAR y: REAL) : REAL ; PROCEDURE __BUILTIN__ modff (x: SHORTREAL; VAR y: SHORTREAL) : SHORTREAL ; @@ -99,10 +95,6 @@ PROCEDURE __BUILTIN__ nexttoward (x, y: REAL) : LONGREAL ; PROCEDURE __BUILTIN__ nexttowardf (x, y: SHORTREAL) : LONGREAL ; PROCEDURE __BUILTIN__ nexttowardl (x, y: LONGREAL) : LONGREAL ; -PROCEDURE __BUILTIN__ scalb (x, n: REAL) : REAL ; -PROCEDURE __BUILTIN__ scalbf (x, n: SHORTREAL) : SHORTREAL ; -PROCEDURE __BUILTIN__ scalbl (x, n: LONGREAL) : LONGREAL ; - PROCEDURE __BUILTIN__ scalbln (x: REAL; n: LONGINT) : REAL ; PROCEDURE __BUILTIN__ scalblnf (x: SHORTREAL; n: LONGINT) : SHORTREAL ; PROCEDURE __BUILTIN__ scalblnl (x: LONGREAL; n: LONGINT) : LONGREAL ; diff --git a/gcc/m2/gm2-libs/Builtins.mod b/gcc/m2/gm2-libs/Builtins.mod index c679259..a5d9939 100644 --- a/gcc/m2/gm2-libs/Builtins.mod +++ b/gcc/m2/gm2-libs/Builtins.mod @@ -222,21 +222,6 @@ BEGIN RETURN cbuiltin.ilogbl (x) END ilogbl ; -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_significand)) significand (r: REAL) : REAL ; -BEGIN - RETURN cbuiltin.significand (r) -END significand ; - -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_significandf)) significandf (s: SHORTREAL) : SHORTREAL ; -BEGIN - RETURN cbuiltin.significandf (s) -END significandf ; - -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_significandl)) significandl (l: LONGREAL) : LONGREAL ; -BEGIN - RETURN cbuiltin.significandl (l) -END significandl ; - PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_modf)) modf (x: REAL; VAR y: REAL) : REAL ; BEGIN RETURN cbuiltin.modf (x, y) @@ -297,21 +282,6 @@ BEGIN RETURN cbuiltin.nexttowardl (x, y) END nexttowardl ; -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_scalb)) scalb (x, n: REAL) : REAL ; -BEGIN - RETURN cbuiltin.scalb (x, n) -END scalb ; - -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_scalbf)) scalbf (x, n: SHORTREAL) : SHORTREAL ; -BEGIN - RETURN cbuiltin.scalbf (x, n) -END scalbf ; - -PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_scalbl)) scalbl (x, n: LONGREAL) : LONGREAL ; -BEGIN - RETURN cbuiltin.scalbl (x, n) -END scalbl ; - PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_scalbln)) scalbln (x: REAL; n: LONGINT) : REAL ; BEGIN RETURN cbuiltin.scalbln (x, n) diff --git a/gcc/m2/target-independent/Builtins.texi b/gcc/m2/target-independent/Builtins.texi index 6ab1f2b..bf0afe1 100644 --- a/gcc/m2/target-independent/Builtins.texi +++ b/gcc/m2/target-independent/Builtins.texi @@ -90,13 +90,6 @@ PROCEDURE __BUILTIN__ huge_valf () : SHORTREAL ; @findex huge_vall PROCEDURE __BUILTIN__ huge_vall () : LONGREAL ; -@findex significand -PROCEDURE __BUILTIN__ significand (r: REAL) : REAL ; -@findex significandf -PROCEDURE __BUILTIN__ significandf (s: SHORTREAL) : SHORTREAL ; -@findex significandl -PROCEDURE __BUILTIN__ significandl (l: LONGREAL) : LONGREAL ; - @findex modf PROCEDURE __BUILTIN__ modf (x: REAL; VAR y: REAL) : REAL ; @findex modff @@ -126,13 +119,6 @@ PROCEDURE __BUILTIN__ nexttowardf (x, y: SHORTREAL) : LONGREAL ; @findex nexttowardl PROCEDURE __BUILTIN__ nexttowardl (x, y: LONGREAL) : LONGREAL ; -@findex scalb -PROCEDURE __BUILTIN__ scalb (x, n: REAL) : REAL ; -@findex scalbf -PROCEDURE __BUILTIN__ scalbf (x, n: SHORTREAL) : SHORTREAL ; -@findex scalbl -PROCEDURE __BUILTIN__ scalbl (x, n: LONGREAL) : LONGREAL ; - @findex scalbln PROCEDURE __BUILTIN__ scalbln (x: REAL; n: LONGINT) : REAL ; @findex scalblnf |