Discussion:
Prototype for Init in confdefs.h
Sebastian Huber
2014-10-10 10:17:20 UTC
Permalink
Hello,

what was the reason for this change?

commit d8b74dbebd341073f0c5b03e589d3fcd349745d1
Author: Chris Johns <***@rtems.org>
Date: Tue Apr 28 06:39:24 2009 +0000

2009-04-28 Chris Johns <***@rtems.org>

* sapi/include/confdefs.h: Add a prototype for Init with C linkage
and define Init task command line arguments if confdefs.h provides
an Init entry point.

diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 9432abc..477ce23 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-28 Chris Johns <***@rtems.org>
+
+ * sapi/include/confdefs.h: Add a prototype for Init with C linkage
+ and define Init task command line arguments if confdefs.h provides
+ an Init entry point.
+
2009-04-15 Ralf Corsepius <***@rtems.org>

* configure.ac: Disable LIBSHELL for unix targets.
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 7f7a1ca..b50ff01 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -518,7 +518,16 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
#endif

#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ rtems_task Init (rtems_task_argument );
+ #ifdef __cplusplus
+ }
+ #endif
#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
+ extern const char* bsp_boot_cmdline;
+ #define CONFIGURE_INIT_TASK_ARGUMENTS ((rtems_task_argument)
&bsp_boot_cmdline)
#endif

#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES

This differs from the POSIX_Init treatment in the same file. For C++ this
forces you to use a global Init function. In C you can also define Init as
static. This is a bit confusing. At least Init and POSIX_Init should use
similar definitions.
--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : ***@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Chris Johns
2014-10-11 01:13:13 UTC
Permalink
Post by Sebastian Huber
Hello,
what was the reason for this change?
Maybe commit 2549b4d9a83d310e32329255a5a02604eb9e028b ?
Post by Sebastian Huber
commit d8b74dbebd341073f0c5b03e589d3fcd349745d1
Date: Tue Apr 28 06:39:24 2009 +0000
* sapi/include/confdefs.h: Add a prototype for Init with C linkage
and define Init task command line arguments if confdefs.h provides
an Init entry point.
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 9432abc..477ce23 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+
+ * sapi/include/confdefs.h: Add a prototype for Init with C linkage
+ and define Init task command line arguments if confdefs.h provides
+ an Init entry point.
+
* configure.ac: Disable LIBSHELL for unix targets.
diff --git a/cpukit/sapi/include/confdefs.h
b/cpukit/sapi/include/confdefs.h
index 7f7a1ca..b50ff01 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -518,7 +518,16 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
#endif
#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ rtems_task Init (rtems_task_argument );
+ #ifdef __cplusplus
+ }
+ #endif
#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
+ extern const char* bsp_boot_cmdline;
+ #define CONFIGURE_INIT_TASK_ARGUMENTS ((rtems_task_argument)
&bsp_boot_cmdline)
#endif
#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
This differs from the POSIX_Init treatment in the same file. For C++
this forces you to use a global Init function. In C you can also define
Init as static. This is a bit confusing.
Why not provide CONFIGURE_INIT_TASK_ENTRY_POINT and it can be whatever
linkage you like ?

I think the 'extern "C"' is not needed because there is another around
everything. I do not think nesting them makes the code more C than C. :)
Post by Sebastian Huber
At least Init and POSIX_Init should use similar definitions.
Sure.

I never use either constructs and use 'main'.

Chris

Loading...