Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
1999-10-25  Thorsten Kukuk  <kukuk@suse.de>

	* md5-crypt/md5.h: Remove prototypes for public interface. md5 is
	used only internal.
	* md5-crypt/md5-crypt.c: Use internal names for md5 functions,
	remove weak alias for public names.
	* md5-crypt/md5.c: Remove weak aliase.

1999-10-25  Andreas Jaeger  <aj@suse.de>

	* math/README.libm-test: New file, documents libm-test.inc.

1999-10-25  Andreas Jaeger  <aj@suse.de>

	* math/gen-libm-test.pl: Only generate a new ulps file when -n is
	given.
	(print_ulps_file): Fix loops to not read @tests and @functions
	since those are not initialized with -n now.
	(parse_ulps): Set $results{..}{"kind"}.
  • Loading branch information
Ulrich Drepper committed Oct 25, 1999
1 parent 3a8e65a commit a9b5d2e
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 112 deletions.
20 changes: 20 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
1999-10-25 Thorsten Kukuk <kukuk@suse.de>

* md5-crypt/md5.h: Remove prototypes for public interface. md5 is
used only internal.
* md5-crypt/md5-crypt.c: Use internal names for md5 functions,
remove weak alias for public names.
* md5-crypt/md5.c: Remove weak aliase.

1999-10-25 Andreas Jaeger <aj@suse.de>

* math/README.libm-test: New file, documents libm-test.inc.

1999-10-25 Andreas Jaeger <aj@suse.de>

* math/gen-libm-test.pl: Only generate a new ulps file when -n is
given.
(print_ulps_file): Fix loops to not read @tests and @functions
since those are not initialized with -n now.
(parse_ulps): Set $results{..}{"kind"}.

1999-10-25 Andreas Jaeger <aj@suse.de>

* math/gen-libm-test.pl (parse_ulps): Ignore 0 has ulp.
Expand Down
34 changes: 17 additions & 17 deletions linuxthreads/internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,23 +335,23 @@ void __pthread_reset_main_thread(void);
void __fresetlockfiles(void);
void __pthread_manager_adjust_prio(int thread_prio);

extern int __pthread_attr_setguardsize __P ((pthread_attr_t *__attr,
size_t __guardsize));
extern int __pthread_attr_getguardsize __P ((__const pthread_attr_t *__attr,
size_t *__guardsize));
extern int __pthread_attr_setstackaddr __P ((pthread_attr_t *__attr,
void *__stackaddr));
extern int __pthread_attr_getstackaddr __P ((__const pthread_attr_t *__attr,
void **__stackaddr));
extern int __pthread_attr_setstacksize __P ((pthread_attr_t *__attr,
size_t __stacksize));
extern int __pthread_attr_getstacksize __P ((__const pthread_attr_t *__attr,
size_t *__stacksize));
extern int __pthread_getconcurrency __P ((void));
extern int __pthread_setconcurrency __P ((int __level));
extern int __pthread_mutexattr_gettype __P ((__const pthread_mutexattr_t *__attr,
int *__kind));
extern void __pthread_kill_other_threads_np __P ((void));
extern int __pthread_attr_setguardsize (pthread_attr_t *__attr,
size_t __guardsize) __THROW;
extern int __pthread_attr_getguardsize (__const pthread_attr_t *__attr,
size_t *__guardsize) __THROW;
extern int __pthread_attr_setstackaddr (pthread_attr_t *__attr,
void *__stackaddr) __THROW;
extern int __pthread_attr_getstackaddr (__const pthread_attr_t *__attr,
void **__stackaddr) __THROW;
extern int __pthread_attr_setstacksize (pthread_attr_t *__attr,
size_t __stacksize) __THROW;
extern int __pthread_attr_getstacksize (__const pthread_attr_t *__attr,
size_t *__stacksize) __THROW;
extern int __pthread_getconcurrency (void) __THROW;
extern int __pthread_setconcurrency (int __level) __THROW;
extern int __pthread_mutexattr_gettype (__const pthread_mutexattr_t *__attr,
int *__kind) __THROW;
extern void __pthread_kill_other_threads_np (void) __THROW;

/* Prototypes for the function without cancelation support when the
normal version has it. */
Expand Down
10 changes: 5 additions & 5 deletions linuxthreads/no-tsd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libc-internal interface for thread-specific data.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -17,7 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

#include <sys/cdefs.h> /* for __P */
#include <sys/cdefs.h> /* for __const */
#include <bits/libc-tsd.h>

/* This file provides uinitialized (common) definitions for the
Expand All @@ -29,6 +29,6 @@
If -lpthread is not used, these uninitialized variables default to zero,
which the __libc_tsd_* macros check for. */

void *(*__libc_internal_tsd_get) __P ((enum __libc_tsd_key_t));
int (*__libc_internal_tsd_set) __P ((enum __libc_tsd_key_t,
__const void *));
void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t);
int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
__const void *);
18 changes: 9 additions & 9 deletions linuxthreads/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,31 @@ __BEGIN_DECLS

/* Initialize semaphore object SEM to VALUE. If PSHARED then share it
with other processes. */
extern int sem_init __P ((sem_t *__sem, int __pshared, unsigned int __value));
extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value) __THROW;

/* Free resources associated with semaphore object SEM. */
extern int sem_destroy __P ((sem_t *__sem));
extern int sem_destroy (sem_t *__sem) __THROW;

/* Open a named semaphore NAME with open flaot OFLAG. */
extern sem_t *sem_open __P ((__const char *__name, int __oflag, ...));
extern sem_t *sem_open (__const char *__name, int __oflag, ...) __THROW;

/* Close descriptor for named semaphore SEM. */
extern int sem_close __P ((sem_t *__sem));
extern int sem_close (sem_t *__sem) __THROW;

/* Remove named semaphore NAME. */
extern int sem_unlink __P ((__const char *__name));
extern int sem_unlink (__const char *__name) __THROW;

/* Wait for SEM being posted. */
extern int sem_wait __P ((sem_t *__sem));
extern int sem_wait (sem_t *__sem) __THROW;

/* Test whether SEM is posted. */
extern int sem_trywait __P ((sem_t *__sem));
extern int sem_trywait (sem_t *__sem) __THROW;

/* Post SEM. */
extern int sem_post __P ((sem_t *__sem));
extern int sem_post (sem_t *__sem) __THROW;

/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue __P ((sem_t *__sem, int *__sval));
extern int sem_getvalue (sem_t *__sem, int *__sval) __THROW;

__END_DECLS

Expand Down
2 changes: 1 addition & 1 deletion linuxthreads/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int pthread_kill(pthread_t thread, int signo)
}

/* User-provided signal handlers */
typedef void (*arch_sighandler_t) __PMT ((int, SIGCONTEXT));
typedef void (*arch_sighandler_t) (int, SIGCONTEXT);
static union
{
arch_sighandler_t old;
Expand Down
8 changes: 4 additions & 4 deletions linuxthreads/sysdeps/pthread/bits/libc-tsd.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libc-internal interface for thread-specific data. LinuxThreads version.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand All @@ -26,9 +26,9 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
_LIBC_TSD_KEY_DL_ERROR,
_LIBC_TSD_KEY_N };

extern void *(*__libc_internal_tsd_get) __P ((enum __libc_tsd_key_t));
extern int (*__libc_internal_tsd_set) __P ((enum __libc_tsd_key_t,
__const void *));
extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW;
extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
__const void *) __THROW;

#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
#define __libc_tsd_get(KEY) \
Expand Down
8 changes: 4 additions & 4 deletions linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Signal handling function for threaded programs.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Expand Down Expand Up @@ -28,10 +28,10 @@

/* Modify the signal mask for the calling thread. The arguments have
the same meaning as for sigprocmask(2). */
extern int pthread_sigmask __P ((int __how, __const __sigset_t *__newmask,
__sigset_t *__oldmask));
extern int pthread_sigmask (int __how, __const __sigset_t *__newmask,
__sigset_t *__oldmask)__THROW;

/* Send signal SIGNO to the given thread. */
extern int pthread_kill __P ((pthread_t __thread, int __signo));
extern int pthread_kill (pthread_t __thread, int __signo) __THROW;

#endif /* bits/sigthread.h */
6 changes: 3 additions & 3 deletions linuxthreads/weaks.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include <limits.h>
#include <stdlib.h>

extern int __pthread_return_0 __P ((void));
extern int __pthread_return_1 __P ((void));
extern void __pthread_return_void __P ((void));
extern int __pthread_return_0 (void) __THROW;
extern int __pthread_return_1 (void) __THROW;
extern void __pthread_return_void (void) __THROW;

/* Those are pthread functions which return 0 if successful. */
#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
Expand Down
107 changes: 107 additions & 0 deletions math/README.libm-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
README for libm-test math test suite
====================================

The libm-test math test suite tests a number of function points of
math functions in the GNU C library. The following sections contain a
brief overview. Please note that the test drivers and the Perl script
"gen-libm-test.pl" have some options. A full list of options is
available with --help (for the test drivers) and -h for
"gen-libm-test.pl".


What is tested?
===============
The tests just evaluate the functions at specified points and compare
the results with precomputed values and the requirements of the ISO
C99 standard.

Besides testing the special values mandated by IEEE 754 (infinities,
NaNs and minus zero), some more or less random values are tested.

Files that are part of libm-test
================================

The main file is "libm-test.inc". It is platform and floating point
format independent. The file must be preprocessed by the Perl script
"gen-libm-test.pl". The results are "libm-test.c" and a file
"libm-test-ulps.h" with platform specific deltas.

The test drivers test-double.c, test-float.c, test-ldouble.c test the
normal double, float and long double implementation of libm. The test
drivers with an i in it (test-idouble.c, test-ifloat.c,
test-ildoubl.c) test the corresponding inline functions (where
available - otherwise they also test the real functions in libm).

"gen-libm-test.pl" needs a platform specific files with ULPs (Units of
Last Precision). The file is called "libm-test-ulps" and lives in
platform specific sysdep directory.

How can I generate "libm-test-ulps"?
====================================

The test drivers have an option "-u" to output an unsorted list of all
epsilons that the functions have. The output can be read in directly
but it's better to pretty print it first. "gen-libm-test.pl" has an option
to generate a pretty-printed and sorted new ULPs file from the output
of the test drivers.

To generate a new "libm-test-ulps" file, you can execute for example:
test-double -u --ignore-max-ulp=yes
This generates a file "ULPs" with all double ULPs in it, ignoring any
previous calculated ULPs.
Now move this away, e.g. "mv ULPs allULPs" and generate the ULPs
for all other formats and concat all ULP files together (e.g. "cat
ULPs >> allULPs"). As final step run "gen-libm-test.pl" with the file
as input and ask to generate a pretty printed output in the file "NewUlps":
gen-libm-test.pl -u allULPs -n

Now you can rename "NewUlps" to "libm-test-ulps" and move it into
sysdeps.

Contents of libm-test-ulps
==========================
Since libm-test-ulps can be generated automatically, just a few
notes. The file contains lines for single tests, like:
Test "cos (pi/2) == 0":
float: 1

and lines for maximal errors of single functions, like:
Function "yn":
idouble: 6.0000

The keywords are float, ifloat, double, idouble, ldouble and ildouble
(the prefix i stands for inline). You can also specify known
failures, e.g.:

Test "cos (pi/2) == 0":
float: 1
float: fail

Adding tests to libm-test.inc
=============================

The tests are evaluated by a set of special test macros. The macros
start with "TEST_" followed by a specification the input values, an
underscore and a specification of the output values. As an example,
the test macro for a function with input of type FLOAT (FLOAT is
either float, double, long double) and output of type FLOAT is
"TEST_f_f". The macro's parameter are the name of the function, the
input parameter, output parameter and optionally one exception
parameter.

The accepted parameter types are:
- "f" for FLOAT
- "b" for boolean - just tests if the output parameter evaluates to 0
or 1 (only for output).
- "c" for complex. This parameter needs two values, first the real,
then the imaginary part.
- "i" for int.
- "l" for long int.
- "L" for long long int.
- "F" for the address of a FLOAT (only as input parameter)
- "I" for the address of an int (only as input parameter)

Some functions need special handling. For example gamma sets the
global variable signgam and frexp takes an argument to &int. This
special treatment is coded in "gen-libm-test.pl" and used while
parsing "libm-test.inc".
20 changes: 14 additions & 6 deletions math/gen-libm-test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# Note that functions and tests share the same namespace.

# Information about tests are stored in: %results
# $results{$test}{"kind"} is either "fct" or "test" and flags whether this
# is a maximal error of a function or a single test.
# $results{$test}{"type"} is the result type, e.g. normal or complex.
# $results{$test}{"has_ulps"} is set if deltas exist.
# $results{$test}{"has_fails"} is set if exptected failures exist.
Expand Down Expand Up @@ -102,7 +104,7 @@
print "Usage: gen-libm-test.pl [OPTIONS]\n";
print " -h print this help, then exit\n";
print " -o DIR directory where generated files will be placed\n";
print " -n generate sorted file NewUlps from libm-test-ulps\n";
print " -n only generate sorted file NewUlps from libm-test-ulps\n";
print " -u FILE input file with ulps\n";
exit 0;
}
Expand All @@ -116,8 +118,8 @@
$count = 0;

&parse_ulps ($ulps_file);
&generate_testfile ($input, $output);
&output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file);
&generate_testfile ($input, $output) unless ($opt_n);
&output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
&print_ulps_file ("${output_dir}NewUlps") if ($opt_n);

# Return a nicer representation
Expand Down Expand Up @@ -484,7 +486,7 @@ sub generate_testfile {
# Parse ulps file
sub parse_ulps {
my ($file) = @_;
my ($test, $type, $float, $eps);
my ($test, $type, $float, $eps, $kind);

# $type has the following values:
# "normal": No complex variable
Expand All @@ -508,6 +510,7 @@ sub parse_ulps {
}
s/^.+\"(.*)\".*$/$1/;
$test = $_;
$kind = 'test';
next;
}
if (/^Function: /) {
Expand All @@ -521,6 +524,7 @@ sub parse_ulps {
$type = 'normal';
}
($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
$kind = 'fct';
next;
}
if (/^i?(float|double|ldouble):/) {
Expand All @@ -541,6 +545,7 @@ sub parse_ulps {
} elsif ($type eq 'normal') {
$results{$test}{'type'} = 'normal';
}
$results{$test}{'kind'} = $kind;
next;
}
print "Skipping unknown entry: `$_'\n";
Expand All @@ -567,7 +572,9 @@ sub print_ulps_file {
$last_fct = '';
open NEWULP, ">$file" or die ("Can't open $file: $!");
print NEWULP "# Begin of automatic generation\n";
foreach $test (sort @tests) {
# first the function calls
foreach $test (sort keys %results) {
next if ($results{$test}{'kind'} ne 'test');
foreach $type ('real', 'imag', 'normal') {
if (exists $results{$test}{$type}) {
if (defined $results{$test}) {
Expand Down Expand Up @@ -599,7 +606,8 @@ sub print_ulps_file {
}
print NEWULP "\n# Maximal error of functions:\n";

foreach $fct (sort @functions) {
foreach $fct (sort keys %results) {
next if ($results{$fct}{'kind'} ne 'fct');
foreach $type ('real', 'imag', 'normal') {
if (exists $results{$fct}{$type}) {
if ($type eq 'normal') {
Expand Down
Loading

0 comments on commit a9b5d2e

Please sign in to comment.