* [patch/rfc] constafy floatformat
@ 2003-09-15 22:31 Andrew Cagney
2003-09-16 0:22 ` DJ Delorie
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-09-15 22:31 UTC (permalink / raw)
To: gdb-patches, gcc-patches, binutils
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Hello,
The attached changes the "from" parameter to the various floatformat
functions to a "const char *" / "const double *".
Baring comments I intend committing this one in a few hours.
To test the waters, I'm planning on following this up with a patch
proposing that this file be switched to ISO C.
enjoy,
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 3485 bytes --]
Index: include/ChangeLog
2003-09-15 Andrew Cagney <cagney@redhat.com>
* floatformat.h (floatformat_to_double): Make input buffer constant.
(floatformat_from_double, floatformat_is_valid): Ditto.
Index: libiberty/ChangeLog
2003-09-15 Andrew Cagney <cagney@redhat.com>
* floatformat.c (get_field): Make "data" constant.
(floatformat_is_valid, floatformat_to_double): Make "from"
constant, fix casts.
(floatformat_from_double): Make "from" constant.
Index: include/floatformat.h
===================================================================
RCS file: /cvs/src/src/include/floatformat.h,v
retrieving revision 1.7
diff -u -r1.7 floatformat.h
--- include/floatformat.h 15 Sep 2003 21:28:56 -0000 1.7
+++ include/floatformat.h 15 Sep 2003 22:10:58 -0000
@@ -113,18 +113,18 @@
Store the double in *TO. */
extern void
-floatformat_to_double PARAMS ((const struct floatformat *, char *, double *));
+floatformat_to_double PARAMS ((const struct floatformat *, const char *, double *));
/* The converse: convert the double *FROM to FMT
and store where TO points. */
extern void
floatformat_from_double PARAMS ((const struct floatformat *,
- double *, char *));
+ const double *, char *));
/* Return non-zero iff the data at FROM is a valid number in format FMT. */
extern int
-floatformat_is_valid PARAMS ((const struct floatformat *fmt, char *from));
+floatformat_is_valid PARAMS ((const struct floatformat *fmt, const char *from));
#endif /* defined (FLOATFORMAT_H) */
Index: libiberty/floatformat.c
===================================================================
RCS file: /cvs/src/src/libiberty/floatformat.c,v
retrieving revision 1.8
diff -u -r1.8 floatformat.c
--- libiberty/floatformat.c 15 Sep 2003 20:14:39 -0000 1.8
+++ libiberty/floatformat.c 15 Sep 2003 22:11:00 -0000
@@ -143,7 +143,7 @@
"floatformat_ia64_quad_little"
};
\f
-static unsigned long get_field PARAMS ((unsigned char *,
+static unsigned long get_field PARAMS ((const unsigned char *,
enum floatformat_byteorders,
unsigned int,
unsigned int,
@@ -153,7 +153,7 @@
TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
static unsigned long
get_field (data, order, total_len, start, len)
- unsigned char *data;
+ const unsigned char *data;
enum floatformat_byteorders order;
unsigned int total_len;
unsigned int start;
@@ -207,10 +207,10 @@
void
floatformat_to_double (fmt, from, to)
const struct floatformat *fmt;
- char *from;
+ const char *from;
double *to;
{
- unsigned char *ufrom = (unsigned char *)from;
+ const unsigned char *ufrom = (const unsigned char *)from;
double dto;
long exponent;
unsigned long mant;
@@ -331,7 +331,7 @@
void
floatformat_from_double (fmt, from, to)
const struct floatformat *fmt;
- double *from;
+ const double *from;
char *to;
{
double dfrom;
@@ -409,7 +409,7 @@
int
floatformat_is_valid (fmt, from)
const struct floatformat *fmt;
- char *from;
+ const char *from;
{
if (fmt == &floatformat_i387_ext)
{
@@ -419,7 +419,7 @@
if the exponent is zero can it be zero, and then it must
be zero. */
unsigned long exponent, int_bit;
- unsigned char *ufrom = (unsigned char *) from;
+ const unsigned char *ufrom = (const unsigned char *) from;
exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
fmt->exp_start, fmt->exp_len);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch/rfc] constafy floatformat
2003-09-15 22:31 [patch/rfc] constafy floatformat Andrew Cagney
@ 2003-09-16 0:22 ` DJ Delorie
2003-09-16 1:40 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: DJ Delorie @ 2003-09-16 0:22 UTC (permalink / raw)
To: ac131313; +Cc: gdb-patches, gcc-patches, binutils
> The attached changes the "from" parameter to the various floatformat
> functions to a "const char *" / "const double *".
Ok.
> Baring comments I intend committing this one in a few hours.
Please do not check in unapproved patches to libiberty.
> To test the waters, I'm planning on following this up with a patch
> proposing that this file be switched to ISO C.
No. Libiberty cannot be converted to ISO C until *every* project that
uses it has been converted. Libiberty will be the last conversion.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch/rfc] constafy floatformat
2003-09-16 0:22 ` DJ Delorie
@ 2003-09-16 1:40 ` Andrew Cagney
2003-09-16 2:48 ` DJ Delorie
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-09-16 1:40 UTC (permalink / raw)
To: DJ Delorie; +Cc: gdb-patches, gcc-patches, binutils
>> To test the waters, I'm planning on following this up with a patch
>> proposing that this file be switched to ISO C.
>
>
> No. Libiberty cannot be converted to ISO C until *every* project that
> uses it has been converted. Libiberty will be the last conversion.
Do you have a list of what's left. GCC, BINUTILS and GDB have all
adopted ISO C.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch/rfc] constafy floatformat
2003-09-16 1:40 ` Andrew Cagney
@ 2003-09-16 2:48 ` DJ Delorie
0 siblings, 0 replies; 4+ messages in thread
From: DJ Delorie @ 2003-09-16 2:48 UTC (permalink / raw)
To: ac131313; +Cc: gdb-patches, gcc-patches, binutils
> Do you have a list of what's left. GCC, BINUTILS and GDB have all
> adopted ISO C.
Ok, fair question. I checked sources.redhat.com's usual repository
and didn't find anything else (assuming "gcc" covers its entire
repository).
However, I'd like to think about this for a bit, and come up with a
migration plan, rather than just letting people randomly migrate files
they're interested in.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-09-16 2:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-15 22:31 [patch/rfc] constafy floatformat Andrew Cagney
2003-09-16 0:22 ` DJ Delorie
2003-09-16 1:40 ` Andrew Cagney
2003-09-16 2:48 ` DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox