From b00a2c906d1f11f6d1aa52b0388d467fda0c6b60 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 28 Oct 2017 13:06:38 -0400 Subject: [PATCH] Build fdopen(), hypot(), putenv() in libc. These functions are in POSIX; hypot() is in C99. Also build cabs() because it rides with hypot(), but don't declare cabs() in any header file, because our compiler can't parse C99 "double complex" type. Touch build.lua so it sees that .c files moved. --- lang/cem/libcc.ansi/build.lua | 2 +- lang/cem/libcc.ansi/headers/math.h | 1 + lang/cem/libcc.ansi/{misc => math}/hypot.c | 0 lang/cem/libcc.ansi/{misc => stdio}/fdopen.c | 0 lang/cem/libcc.ansi/{misc => stdlib}/putenv.c | 0 5 files changed, 2 insertions(+), 1 deletion(-) rename lang/cem/libcc.ansi/{misc => math}/hypot.c (100%) rename lang/cem/libcc.ansi/{misc => stdio}/fdopen.c (100%) rename lang/cem/libcc.ansi/{misc => stdlib}/putenv.c (100%) diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua index 20591f803..a0d6eebc1 100644 --- a/lang/cem/libcc.ansi/build.lua +++ b/lang/cem/libcc.ansi/build.lua @@ -37,7 +37,7 @@ for _, plat in ipairs(vars.plats) do "./errno/*.c", "./locale/*.c", "./malloc/*.c", - "./math/*.c", + "./math/*.c", -- hypot.c "./math/*.e", "./misc/environ.c", -- don't build everything here as it's all obsolete "./setjmp/*.c", diff --git a/lang/cem/libcc.ansi/headers/math.h b/lang/cem/libcc.ansi/headers/math.h index 3546b042c..f82c55916 100644 --- a/lang/cem/libcc.ansi/headers/math.h +++ b/lang/cem/libcc.ansi/headers/math.h @@ -33,6 +33,7 @@ extern double ceil(double _x); extern double fabs(double _x); extern double floor(double _x); +extern double hypot(double _x, double _y); extern double pow(double _x, double _y); extern double frexp(double _x, int *_exp); diff --git a/lang/cem/libcc.ansi/misc/hypot.c b/lang/cem/libcc.ansi/math/hypot.c similarity index 100% rename from lang/cem/libcc.ansi/misc/hypot.c rename to lang/cem/libcc.ansi/math/hypot.c diff --git a/lang/cem/libcc.ansi/misc/fdopen.c b/lang/cem/libcc.ansi/stdio/fdopen.c similarity index 100% rename from lang/cem/libcc.ansi/misc/fdopen.c rename to lang/cem/libcc.ansi/stdio/fdopen.c diff --git a/lang/cem/libcc.ansi/misc/putenv.c b/lang/cem/libcc.ansi/stdlib/putenv.c similarity index 100% rename from lang/cem/libcc.ansi/misc/putenv.c rename to lang/cem/libcc.ansi/stdlib/putenv.c