From f2b12ea516e936d275c6c720a57cde83b1ef59d0 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 26 Oct 2005 11:14:02 +0000 Subject: Correct w_cabs.c so it can be added to IMA, add -D_POSIX_MODE for compiling s_lib_version.c (only in the new Makefile) --- libm/Makefile.in | 15 ++++++++++----- libm/w_cabs.c | 10 +++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/libm/Makefile.in b/libm/Makefile.in index ddc8dfa16..1d0852a30 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -24,7 +24,7 @@ CFLAGS+=$(SSP_ALL_CFLAGS) CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE -#DOMULTI=n +CFLAGS-s_lib_version.c=-D_POSIX_MODE LIB_NAME:=libm @@ -92,8 +92,10 @@ FL_MOBJ:=$(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOB endif endif -LIBM_NO_MULTI:=s_lib_version.c w_cabs.c +ifeq ($(DO_C99_MATH),y) +LIBM_NO_MULTI:=s_lib_version.c CSRC:=$(filter-out $(LIBM_NO_MULTI),$(CSRC)) +endif libm_SRC:=$(patsubst %.c,$(libm_DIR)/%.c,$(CSRC)) libm_OBJ:=$(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC)) @@ -103,7 +105,10 @@ libm_MOBJ:=$(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ)) libm_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ)))) -libm_OBJS:=$(libm_OBJ) $(libm_MOBJ) $(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI)) +libm_OBJS:=$(libm_OBJ) $(libm_MOBJ) +ifeq ($(DO_C99_MATH),y) +libm_OBJS+=$(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI)) +endif $(libm_MOBJ) $(libm_MOBJ:.o=.os): $(libm_MSRC) $(compile.m) @@ -114,9 +119,9 @@ libm-so-$(UCLIBC_HAS_FLOATS)+=$(libm_OBJS:.o=.os) CFLAGS-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_DEF) libm-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_SRC) $(libm_MSRC) -#libm-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_MSRC) -#libm-nomulti-$(UCLIBC_HAS_FLOATS)+=$(libm_OBJ) +ifeq ($(DO_C99_MATH),y) libm-nomulti-$(UCLIBC_HAS_FLOATS)+=$(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI)) +endif objclean-y+=libm_clean diff --git a/libm/w_cabs.c b/libm/w_cabs.c index 69188a0dd..6743146c6 100644 --- a/libm/w_cabs.c +++ b/libm/w_cabs.c @@ -5,14 +5,10 @@ * Placed into the Public Domain, 1994. */ +#include #include -struct complex { - double x; - double y; -}; - -double cabs(struct complex z) +double cabs(double _Complex z) { - return hypot(z.x, z.y); + return hypot(__real__ z, __imag__ z); } -- cgit v1.2.3