Module: xenomai-3
Branch: next
Commit: 2353e59f2e016879a33da96f4583c49ad521a864
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=2353e59f2e016879a33da96f4583c49ad521a864

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Mar 22 09:21:07 2017 +0100

boilerplate/setup: postpone detection of late setup calls

Since #d6d8047, setup descriptors may be registered after the base
inits have been performed, if DSO bootstrap modules were activated.
Postpone the detection of late setup calls after the main bootstrap
module has run instead.

This fixes an issue with --enable-assert in presence of DSO bootstrap
code.

---

 lib/boilerplate/setup.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/boilerplate/setup.c b/lib/boilerplate/setup.c
index 1992826..e534e66 100644
--- a/lib/boilerplate/setup.c
+++ b/lib/boilerplate/setup.c
@@ -50,6 +50,8 @@ const int __weak xenomai_auto_bootstrap = 0;
 
 static int base_init_done;
 
+static int main_init_done;
+
 static DEFINE_PRIVATE_LIST(setup_list);
 
 static const struct option base_options[] = {
@@ -617,16 +619,15 @@ fail:
 void xenomai_init(int *argcp, char *const **argvp)
 {
        const char *me = get_program_name();
-       static int init_done;
 
-       if (init_done) {
+       if (main_init_done) {
                early_warning("duplicate call from main program "
                              "to %s() ignored", __func__);
                early_warning("(xeno-config --no-auto-init disables implicit 
call)");
        }
 
        __xenomai_init(argcp, argvp, me);
-       init_done = 1;
+       main_init_done = 1;
        trace_me("%s bootstrap done", me);
 }
 
@@ -655,7 +656,7 @@ void __register_setup_call(struct setup_descriptor *p, int 
id)
        /*
         * Trap late registration due to wrong constructor priorities.
         */
-       assert(!base_init_done);
+       assert(!main_init_done);
        p->__reserved.id = id;
        p->__reserved.done = 0;
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to