Sergei Organov wrote:
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>.

Then you should add your own package and implement CYGINT_ISO_EXIT; or declare them in your own application-specific header. Only OS definitions should go in <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.)

That's a separate problem due to failing to take into account CDL dependencies. Fixed with the attached patch, checked in.

Jifl

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/signals/current/ChangeLog,v
retrieving revision 1.9
diff -u -5 -p -r1.9 ChangeLog
--- ChangeLog   26 Jun 2003 05:25:30 -0000      1.9
+++ ChangeLog   27 Sep 2007 15:29:09 -0000
@@ -1,5 +1,10 @@
+2007-09-27  Jonathan Larmour  <[EMAIL PROTECTED]>
+
+       * src/siginit.cxx (cyg_libc_signals_default_handler): Handle case where
+       CYGINT_ISO_EXIT not available.
+
 2003-06-26  Jonathan Larmour  <[EMAIL PROTECTED]>

        * include/signal.h: Remove unused definitions that had been used
        for embryonic POSIX signals support.

Index: src/siginit.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/signals/current/src/siginit.cxx,v
retrieving revision 1.3
diff -u -5 -p -r1.3 siginit.cxx
--- src/siginit.cxx     23 May 2002 23:07:09 -0000      1.3
+++ src/siginit.cxx     27 Sep 2007 15:29:09 -0000
@@ -54,10 +54,11 @@
 //========================================================================

 // CONFIGURATION

 #include <pkgconf/libc_signals.h>  // libc signals configuration
+#include <pkgconf/isoinfra.h>      // isoinfra defs, including CYGINT_ISO_EXIT

 // INCLUDES

 #include <cyg/infra/cyg_type.h>    // Common type definitions and support
 #include <signal.h>                // Main signals definitions
@@ -390,11 +391,15 @@ cyg_libc_signals_default_handler(int sig
 {
     CYG_REPORT_FUNCNAME( "cyg_libc_signals_default_handler" );

     CYG_REPORT_FUNCARG1( "signal number = %d", sig );

+#if CYGINT_ISO_EXIT
     exit(1000 + sig); // FIXME
+#else
+    CYG_FAIL("Default signal handler called - no exit available");
+#endif

     CYG_REPORT_RETURN();
 } // cyg_libc_signals_default_handler()

 #ifdef CYGSEM_LIBC_SIGNALS_THREAD_SAFE

--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
 >>>> Visit us on stand 810 at The Embedded Systems Show 2007, NEC <<<<
 >>>> Oct 17-18 Birmingham, UK http://www.edaexhibitions.com/ess/  <<<<
------["The best things in life aren't things."]------      Opinions==mine

Reply via email to