fixincl and `xatexit' (atexit replacement)

Philippe De Muyter phdm@macqel.be
Fri Nov 26 02:31:00 GMT 1999


Problem :
cc -o fixincl fixincl.o server.o procopen.o gnu-regex.o fixlib.o ../../libiberty
/libiberty.a ../../libiberty/libiberty.a
server.o: In function `server_setup':
server.c:224: undefined reference to `atexit'
Could not install binary fixincludes.

Fix :
Thu Nov 25 18:52:31 1999  Philippe De Muyter  <phdm@macqel.be>

	* fixinc/fixincl.c (main): Use `exit', not `return', to allow usage
	of `xatexit' and `xexit'.
	* fixinc/server.h (atexit, exit): Macros defined #ifndef HAVE_ATEXIT.

--- ./gcc/fixinc/fixincl.c	Thu Nov 25 18:26:22 1999
+++ ./gcc/fixinc/fixincl.c	Wed Nov 24 19:05:48 1999
@@ -256,7 +256,7 @@ main (argc, argv)
         if (child == NULLPROCESS)
           {
             process ();
-            return EXIT_SUCCESS;
+            exit (EXIT_SUCCESS);
           }
 
         if (child == NOPROCESS)
@@ -283,7 +283,7 @@ main (argc, argv)
              fixed_ct, altered_ct);
   }
 #endif /* DO_STATS */
-  return EXIT_SUCCESS;
+  exit (EXIT_SUCCESS);
 }
 
 
--- ./gcc/fixinc/server.h	Thu Nov 25 18:26:23 1999
+++ ./gcc/fixinc/server.h	Wed Nov 24 19:11:51 1999
@@ -54,6 +54,11 @@
 #include <unistd.h>
 #endif
 
+#ifndef HAVE_ATEXIT
+#define atexit(f)	xatexit(f)
+#define exit(e)	xexit(e)
+#endif
+
 /*
  *  Dual pipe opening of a child process
  */


More information about the Gcc-patches mailing list