From 5ef50d00ded8bb0934c2aef6c9f06acf23f66cb7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 12 Jan 2001 07:29:55 +0000 Subject: Update. 2001-01-11 Jakub Jelinek * stdlib/cxa_atexit.c (__cxa_atexit): Cast to (void *, int) func. * stdlib/cxa_finalize.c (__cxa_finalize): Add hidden second argument. * stdlib/cxa_on_exit.c: Remove. * stdlib/Makefile: Revert last patch. * stdlib/Versions: Likewise. * include/stdlib.h: Likewise. * stdlib/exit.h: Revert last patch. (struct exit_function): Add second argument to cxa fn. * stdlib/exit.c: Revert last patch. (exit): Add hidden second argument. --- stdlib/Makefile | 4 ++-- stdlib/Versions | 4 ---- stdlib/cxa_atexit.c | 4 ++-- stdlib/cxa_finalize.c | 4 ++-- stdlib/cxa_on_exit.c | 38 -------------------------------------- stdlib/exit.c | 5 +---- stdlib/exit.h | 11 ++--------- 7 files changed, 9 insertions(+), 61 deletions(-) delete mode 100644 stdlib/cxa_on_exit.c (limited to 'stdlib') diff --git a/stdlib/Makefile b/stdlib/Makefile index 61d2059e55..a20a30768f 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1991-1999, 2000 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 @@ -29,7 +29,7 @@ routines := \ abort \ bsearch qsort msort \ getenv putenv setenv secure-getenv \ - exit on_exit atexit cxa_atexit cxa_on_exit cxa_finalize \ + exit on_exit atexit cxa_atexit cxa_finalize \ abs labs llabs \ div ldiv lldiv \ mblen mbstowcs mbtowc wcstombs wctomb \ diff --git a/stdlib/Versions b/stdlib/Versions index d189f4bdbd..034125a200 100644 --- a/stdlib/Versions +++ b/stdlib/Versions @@ -94,8 +94,4 @@ libc { # used by new G++ ABI __cxa_atexit; __cxa_finalize; } - GLIBC_2.2.1 { - # used in the thread library - __cxa_on_exit; - } } diff --git a/stdlib/cxa_atexit.c b/stdlib/cxa_atexit.c index 180d74a54d..e07d0eda35 100644 --- a/stdlib/cxa_atexit.c +++ b/stdlib/cxa_atexit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001 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 @@ -31,7 +31,7 @@ __cxa_atexit (void (*func) (void *), void *arg, void *d) return -1; new->flavor = ef_cxa; - new->func.cxa.fn = func; + new->func.cxa.fn = (void (*) (void *, int)) func; new->func.cxa.arg = arg; new->func.cxa.dso_handle = d; return 0; diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c index da2d91512e..ad69d5c9ff 100644 --- a/stdlib/cxa_finalize.c +++ b/stdlib/cxa_finalize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2001 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 @@ -39,6 +39,6 @@ __cxa_finalize (void *d) if (d == f->func.cxa.dso_handle /* We don't want to run this cleanup more than once. */ && compare_and_swap (&f->flavor, ef_cxa, ef_free)) - (*f->func.cxa.fn) (f->func.cxa.arg); + (*f->func.cxa.fn) (f->func.cxa.arg, 0); } } diff --git a/stdlib/cxa_on_exit.c b/stdlib/cxa_on_exit.c deleted file mode 100644 index c24fa1e983..0000000000 --- a/stdlib/cxa_on_exit.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2001 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include "exit.h" - -/* Register a function to be called by exit or when a shared library - is unloaded. This function is only called from code generated by - the C++ compiler. */ -int -__cxa_on_exit (void (*func) (int, void *), void *arg, void *d) -{ - struct exit_function *new = __new_exitfn (); - - if (new == NULL) - return -1; - - new->flavor = ef_cxa2; - new->func.cxa2.fn = func; - new->func.cxa2.arg = arg; - new->func.cxa2.dso_handle = d; - return 0; -} diff --git a/stdlib/exit.c b/stdlib/exit.c index 5714999117..b2ebe5ff85 100644 --- a/stdlib/exit.c +++ b/stdlib/exit.c @@ -57,10 +57,7 @@ exit (int status) (*f->func.at) (); break; case ef_cxa: - (*f->func.cxa.fn) (f->func.cxa.arg); - break; - case ef_cxa2: - (*f->func.cxa2.fn) (status, f->func.cxa2.arg); + (*f->func.cxa.fn) (f->func.cxa.arg, status); break; } } diff --git a/stdlib/exit.h b/stdlib/exit.h index 66819dd045..2b52dc5f7e 100644 --- a/stdlib/exit.h +++ b/stdlib/exit.h @@ -26,8 +26,7 @@ enum ef_us, ef_on, ef_at, - ef_cxa, - ef_cxa2 + ef_cxa }; struct exit_function @@ -45,16 +44,10 @@ struct exit_function } on; struct { - void (*fn) (void *arg); + void (*fn) (void *arg, int status); void *arg; void *dso_handle; } cxa; - struct - { - void (*fn) (int status, void *arg); - void *arg; - void *dso_handle; - } cxa2; } func; }; struct exit_function_list -- cgit 1.4.1