[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] Fw: What license is acceptable for libdecnumber



On Tue, 2007-09-18 at 13:43 -0700, Jim Blandy wrote:
> "Ryan S. Arnold" <rsa@xxxxxxxxxx> writes:
> > I agree.  We intend to incorporate the code in the existing overrides
> > into the base files using conditionals.
> >
> > Jim do you want patches to the base files to accompany the initial
> > libdfp patch or can we provide a patch at a later time to eliminate the
> > overrides and add the conditionalized code to the base files?
> 
> The patches to the base files probably should be in the initial patch.
> Exactly how the generic code adapts to DFP's presence and absence
> would seem to me to be the most interesting thing to review.

The ISO C-spec technical report defines two macros:

__STDC_DEC_FP__ indicates conformance to the technical report.

__STDC_WANT_DEC_FP__ indicates the desired inclusion of particular
decimal floating point features provided by headers.

I think __STDC_DEC_FP__ can be used to conditionally include/exclude
code from being built into the shared libraries whereas
__STDC_WANT_DEC_FP__ is a user specified define which indicates that
decimal float prototypes are a desired features of the included header
file.

You can see how we used __STDC_WANT_DEC_FP__ in:

glibc/dfp/sysdeps/dfp/math/math.h


The most interesting functions are the polymorphic classification
functions where we need to determine the parameter type (binary float or
decimal float) and forward the call to the appropriate implementation,
e.g.

fpclassify() -> fpclassifyd[32|64|128] | fpclassify[|f|l]

Our .c file overrides like vfprintf do not use __STDC_DEC_FP__ yet. 

One thing I haven't considered is the logistics of gracefully denying a
user's request of decimal float support (specified with
-D__STDC_WANT_DEC_FP__) when libc has been built without
-D__STDC_DEC_FP__.

As it currently stands they'd simply get undefined references to certain
decimal-float-only functions on link and at worst they'd experience
failed function calls due to unrecognized types (e.g. for printf support
when they ask for _Decimal128 printing using %DDf).

Ryan