This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Always provide exit() & friends prototypes.


Hello,

A short patch below ensures exit(), etc. prototypes are provided in
<stdlib.h> even when CYGINT_ISO_EXIT is undefined.

For me it solves the problem that I don't wish to use libc_startup
package, but do use exit()/abort() routines in applications. So the
situation is that application itself provides implementation of those
functions, while their declarations are expected to be found in the
<stdlib.h>.

For eCos source base itself, it solves the following problem. If one
configures eCos, e.g., like is shown below, and tries to compile with
rather recent GCC (v.3+; old versions of GCC happened to declare exit()
internally), she gets the following error:

$ ecosconfig new sparc_leon
$ ecosconfig remove libc_startup
$ ecosconfig check
Target: sparc_leon
Template: default
Removed:
 CYGPKG_LIBC_STARTUP
No conflicts
$ make
[...]
/home/osv/src/ecos/packages/language/c/libc/signals/current/src/siginit.cxx: In function `void cyg_libc_signals_default_handler(int)':
/home/osv/src/ecos/packages/language/c/libc/signals/current/src/siginit.cxx:395: error: `exit' undeclared (first use this function)
/home/osv/src/ecos/packages/language/c/libc/signals/current/src/siginit.cxx:395: error: (Each undeclared identifier is reported only once for each function it appears in.)
[...]
$

Here are the ChangeLog entry and the patch:

2007-09-27  Sergei Organov  <osv@javad.com>

	* include/stdlib.h: provide exit()/atexit()/abort() prototypes
	even when eCos is configured such as the definitions of these
	routines are not included.


Index: packages/isoinfra/current/include/stdlib.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/isoinfra/current/include/stdlib.h,v
retrieving revision 1.6
diff -u -r1.6 stdlib.h
--- packages/isoinfra/current/include/stdlib.h	15 Dec 2002 21:17:31 -0000	1.6
+++ packages/isoinfra/current/include/stdlib.h	27 Sep 2007 13:31:47 -0000
@@ -238,7 +238,7 @@
 
 /*==========================================================================*/
 
-#if CYGINT_ISO_EXIT
+#if 1 || CYGINT_ISO_EXIT
 # ifdef CYGBLD_ISO_EXIT_HEADER
 #  include CYGBLD_ISO_EXIT_HEADER
 # else

-- 
Sergei.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]