Jim will be ready with some additional changes Tuesday morning.  Those
will be on top of the entire Pile O'Patches that were mostly authored by
you and Jakub.  

I'll prepare the commit for the whole shebang when he's done.



> -----Original Message-----
> From: Richard Biener <rguent...@suse.de>
> Sent: Monday, March 24, 2025 09:46
> To: gcc-patches@gcc.gnu.org
> Cc: rdub...@symas.com
> Subject: [PATCH 2/2] [COBOL] Remove unused _Float128 using helpers
> 
> 
> Tested on x86_64-unknown-linux-gnu.
> 
> The only remaining _Float128 use is now via the strtof128 inline
> which is used in two places to commpute the end of a numeric
> literal and verify against the parsed end(?) to do diagnostics.
> I'm not sure why or whether this is necessary - I'd have expected
> lexing to number tokens and then parsing to diagnose unwanted
> characters?  So my preference would be to remove the diagnostic
> and where number parsing support error reporting assert that all
> lexed numbers can be handled by them.  In any case test coverage
> would be nice to have here.
> 
> OK?
> 
> Thanks,
> Richard.
> 
>       * symbols.h (cbl_field_t::value_set): Remove.
>       (strfromf128): Remove.
>       * parse.y (cbl_field_t::value_set): Remove.
> ---
>  gcc/cobol/parse.y   | 22 ----------------------
>  gcc/cobol/symbols.h |  9 ++-------
>  2 files changed, 2 insertions(+), 29 deletions(-)
> 
> diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
> index 43ecef0de8f..390e115f37e 100644
> --- a/gcc/cobol/parse.y
> +++ b/gcc/cobol/parse.y
> @@ -12810,28 +12810,6 @@ cbl_field_t::has_subordinate( const cbl_field_t
> *that ) const {
>    return false;
>  }
> 
> -bool
> -cbl_field_t::value_set( _Float128 value ) {
> -  data = value;
> -  char *initial = string_of(data.value_of());
> -  if( !initial ) return false;
> -
> -  // Trim trailing zeros.
> -  char *p = initial + strlen(initial);
> -  for( --p; initial <= p; --p ) {
> -    if( *p != '0' ) break;
> -    *p = '\0';
> -  }
> -
> -  data.digits = (p - initial) + 1;
> -  p = strchr(initial, '.');
> -  data.rdigits = p? initial + data.digits - p : 0;
> -
> -  data.initial = initial;
> -  data.capacity = type_capacity(type, data.digits);
> -  return true;
> -}
> -
>  const char *
>  cbl_field_t::value_str() const {
>      if( data.etc_type == cbl_field_data_t::value_e )
> diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h
> index f51a2051f51..72bb188ec5b 100644
> --- a/gcc/cobol/symbols.h
> +++ b/gcc/cobol/symbols.h
> @@ -51,16 +51,12 @@
>  #if ! (__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT))
>  static_assert( sizeof(output) == sizeof(long double), "long doubles?"
);
> 
> +// ???  This is still used for verificataion that __nptr parses as
> +// float number via setting *__endptr.
>  static inline _Float128
>  strtof128 (const char *__restrict __nptr, char **__restrict __endptr) {
>    return strtold(nptr, endptr);
>  }
> -
> -static inline int
> -strfromf128 (char *restrict string, size_t size,
> -            const char *restrict format, _Float128 value) {
> -  return  strfroml(str, n, format, fp);
> -}
>  #endif
> 
>  extern const char *numed_message;
> @@ -600,7 +596,6 @@ struct cbl_field_t {
>    bool has_subordinate( const cbl_field_t *that ) const;
> 
>    const char * internalize();
> -  bool value_set( _Float128 value );
>    const char *value_str() const;
> 
>    bool is_key_name() const { return has_attr(record_key_e); }
> --
> 2.43.0

Reply via email to