Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure some paranoid compilers don't choke on our example (unused variable globalc...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 5 Jul 2006 06:21:55 +0000 (06:21 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 5 Jul 2006 06:21:55 +0000 (06:21 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2480 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/ex.c

index f5a7969..598fbf9 100644 (file)
@@ -454,9 +454,10 @@ static void bad_example(void) {
   /* end_of_bad_example */
 }
 #endif
-
+typedef struct {char *first;} global_context_t;
+   
 static void good_example(void) {
-  struct {char*first;} *globalcontext;
+  global_context_t *global_context=malloc(sizeof(global_context_t));
   xbt_ex_t ex;
 
   /* GOOD_EXAMPLE */
@@ -466,7 +467,7 @@ static void good_example(void) {
     char * volatile /*03*/ cp3 = NULL /*02*/;
     TRY {
       cp1 = mallocex(SMALLAMOUNT);
-      globalcontext->first = cp1;
+      global_context->first = cp1;
       cp1 = NULL /*05 give away*/;
       cp2 = mallocex(TOOBIG);
       cp3 = mallocex(SMALLAMOUNT);