Merge "Fix our missing abs/labs/llabs/imaxabs (and imaxdiv) symbols."
This commit is contained in:
commit
c933493ac2
@ -283,7 +283,12 @@ libc_upstream_freebsd_src_files := \
|
|||||||
upstream-freebsd/lib/libc/stdio/tempnam.c \
|
upstream-freebsd/lib/libc/stdio/tempnam.c \
|
||||||
upstream-freebsd/lib/libc/stdio/tmpnam.c \
|
upstream-freebsd/lib/libc/stdio/tmpnam.c \
|
||||||
upstream-freebsd/lib/libc/stdio/wsetup.c \
|
upstream-freebsd/lib/libc/stdio/wsetup.c \
|
||||||
|
upstream-freebsd/lib/libc/stdlib/abs.c \
|
||||||
upstream-freebsd/lib/libc/stdlib/getopt_long.c \
|
upstream-freebsd/lib/libc/stdlib/getopt_long.c \
|
||||||
|
upstream-freebsd/lib/libc/stdlib/imaxabs.c \
|
||||||
|
upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
|
||||||
|
upstream-freebsd/lib/libc/stdlib/labs.c \
|
||||||
|
upstream-freebsd/lib/libc/stdlib/llabs.c \
|
||||||
upstream-freebsd/lib/libc/stdlib/qsort.c \
|
upstream-freebsd/lib/libc/stdlib/qsort.c \
|
||||||
upstream-freebsd/lib/libc/stdlib/realpath.c \
|
upstream-freebsd/lib/libc/stdlib/realpath.c \
|
||||||
upstream-freebsd/lib/libc/string/wcpcpy.c \
|
upstream-freebsd/lib/libc/string/wcpcpy.c \
|
||||||
|
@ -249,13 +249,16 @@ typedef struct {
|
|||||||
} imaxdiv_t;
|
} imaxdiv_t;
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
intmax_t imaxabs(intmax_t);
|
|
||||||
imaxdiv_t imaxdiv(intmax_t, intmax_t);
|
intmax_t imaxabs(intmax_t) __pure2;
|
||||||
|
imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2;
|
||||||
|
|
||||||
intmax_t strtoimax(const char *, char **, int);
|
intmax_t strtoimax(const char *, char **, int);
|
||||||
uintmax_t strtoumax(const char *, char **, int);
|
uintmax_t strtoumax(const char *, char **, int);
|
||||||
|
|
||||||
intmax_t strntoimax(const char *nptr, char **endptr, int base, size_t n);
|
intmax_t strntoimax(const char *nptr, char **endptr, int base, size_t n);
|
||||||
uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n);
|
uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif /* _INTTYPES_H_ */
|
#endif /* _INTTYPES_H_ */
|
||||||
|
@ -77,17 +77,9 @@ static __inline__ double atof(const char *nptr)
|
|||||||
return (strtod(nptr, NULL));
|
return (strtod(nptr, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int abs(int __n) {
|
extern int abs(int) __pure2;
|
||||||
return (__n < 0) ? -__n : __n;
|
extern long labs(long) __pure2;
|
||||||
}
|
extern long long llabs(long long) __pure2;
|
||||||
|
|
||||||
static __inline__ long labs(long __n) {
|
|
||||||
return (__n < 0L) ? -__n : __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline__ long long llabs(long long __n) {
|
|
||||||
return (__n < 0LL) ? -__n : __n;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern char * realpath(const char *path, char *resolved);
|
extern char * realpath(const char *path, char *resolved);
|
||||||
extern int system(const char * string);
|
extern int system(const char * string);
|
||||||
|
43
libc/upstream-freebsd/lib/libc/stdlib/abs.c
Normal file
43
libc/upstream-freebsd/lib/libc/stdlib/abs.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 1990, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char sccsid[] = "@(#)abs.c 8.1 (Berkeley) 6/4/93";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
abs(j)
|
||||||
|
int j;
|
||||||
|
{
|
||||||
|
return(j < 0 ? -j : j);
|
||||||
|
}
|
36
libc/upstream-freebsd/lib/libc/stdlib/imaxabs.c
Normal file
36
libc/upstream-freebsd/lib/libc/stdlib/imaxabs.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
intmax_t
|
||||||
|
imaxabs(intmax_t j)
|
||||||
|
{
|
||||||
|
return (j < 0 ? -j : j);
|
||||||
|
}
|
45
libc/upstream-freebsd/lib/libc/stdlib/imaxdiv.c
Normal file
45
libc/upstream-freebsd/lib/libc/stdlib/imaxdiv.c
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
/* See comments in div.c for implementation details. */
|
||||||
|
imaxdiv_t
|
||||||
|
imaxdiv(intmax_t numer, intmax_t denom)
|
||||||
|
{
|
||||||
|
imaxdiv_t retval;
|
||||||
|
|
||||||
|
retval.quot = numer / denom;
|
||||||
|
retval.rem = numer % denom;
|
||||||
|
if (numer >= 0 && retval.rem < 0) {
|
||||||
|
retval.quot++;
|
||||||
|
retval.rem -= denom;
|
||||||
|
}
|
||||||
|
return (retval);
|
||||||
|
}
|
43
libc/upstream-freebsd/lib/libc/stdlib/labs.c
Normal file
43
libc/upstream-freebsd/lib/libc/stdlib/labs.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 1990, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char sccsid[] = "@(#)labs.c 8.1 (Berkeley) 6/4/93";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
long
|
||||||
|
labs(j)
|
||||||
|
long j;
|
||||||
|
{
|
||||||
|
return(j < 0 ? -j : j);
|
||||||
|
}
|
36
libc/upstream-freebsd/lib/libc/stdlib/llabs.c
Normal file
36
libc/upstream-freebsd/lib/libc/stdlib/llabs.c
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
__FBSDID("$FreeBSD$");
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
long long
|
||||||
|
llabs(long long j)
|
||||||
|
{
|
||||||
|
return (j < 0 ? -j : j);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user