__always_inline is a (Free)BSD specific definition from cdefs.h.
Compilers like Clang don't care about these keywords anyway, as they
simply do whatever they like.
It looks like we already removed this keyword from ld80/e_rem_pio2l.h as
well. Apply exactly the same change to the ld128 version as well.
With this patch I have been able to successfully compile Openlibm on OpenBSD 5.7 (x86_64) using the following command:
gmake GCC=egcc GXX=eg++ USEGCC=1 ARCH=x86_64
(I had to install gcc 4.9 from ports, as Openlibm does not compile with the default compiler shipped with OpenBSD 5.7, which is gcc 4.2.1).
This is rather basic. A clean is needed to get rid of artifacts from
previous runs with other architectures.
Note this requires PR #88 to work because without it x86 is broken.
Closes#89
- Don't define llabs(). This breaks if llabs() is already a macro, which
is allowed by the C standard/POSIX. llabs() was introduced in C99, so
I think we can safely assume it is present on all interesting systems.
- Cast the parameters to fabs() to the floating point type. Clang has
introduced some interesting warnings that trigger if the arguments to
fabs*() are not the right type.
I often build the code with -Wmissing-prototypes to ensure that we don't
accidentically pollute the symbol namespace. If we want to provide a
symbol such as isopenlibm(), make sure we also declare it in
<openlibm_math.h>.
This is a bit more consistent with the naming of the other header files
(openlibm_complex.h and openlibm_fenv.h). Re-add an openlibm.h header
that includes all of the public headers as a shorthand.
Fix up all of the source files to include <openlibm_math.h> instead of
<openlibm.h>. While there, fix ordering of the includes.
While there, also modify the install target. We should make sure to
install all openlibm*.h headers. There is still some work to be done:
openlibm_fenv_*.h still depends on some additional bits. I'd propose
that we eventually create an include/openlibm_cdefs.h that contains all
of the macros we need.
Unlike the __weak_reference() macro, __strong_reference() does type
checking. It can only create the reference if the type of the source and
the destination function match exactly.
Even if double == long double in practice, they remain unequal at the
language level.
I guess the idea would be to eventually also install all of the
openlibm*.h headers, instead of just openlibm.h. Make openlibm_fenv.h
suitable for this purpose by moving all of the $ARCH/fenv.h headers next
to it.
We actually need this change to make OPENLIBM_USE_HOST_FENV_H work.
Right now it's still broken, because the "#include <fenv.h>" performed
by openlibm_fenv.h still pulls in $ARCH/fenv.h as $ARCH/ is added to the
compiler include path.
OpenLibm uses the __weak_reference() macro for platforms where double
and long double use the same layout. That way functions only need to be
provided by the library once. The point is, in this specific case we
want to use strong references; not weak references.
Strong references can be used to give a symbol a second name. If you
look at the resulting object file, you will have two symbols with the
same offset and size. Weak references are different, in the sense that
they are marked in such a way that they act as fallbacks. They are only
used if an explicitly matching symbol is missing.