]> rtime.felk.cvut.cz Git - ulut.git/commitdiff
uLUt: incorporated changes to compile GAVL and GSA by SDCC.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 7 Nov 2009 22:41:27 +0000 (23:41 +0100)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 7 Nov 2009 22:41:27 +0000 (23:41 +0100)
The patches attached to the SDCC bug #1767885 are required
to fix functions inlining problems.

  #1767885 Parameters lost from scope of intermediate inline function

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ulut/ul_gavl.c
ulut/ul_gavl.h
ulut/ul_gavlchk.c
ulut/ul_gsa.c
ulut/ul_gsa.h
ulut/ul_htimdefs.h
ulut/ul_htimer.h
ulut/ul_logbase.c
ulut/ul_logbase.h

index d290dfc5f31220755c7a0a9e3b90c3f898f3d3ce..20d4797b4540e03c4dbdd54d229df633706ea4b5 100644 (file)
@@ -378,21 +378,21 @@ gavl_delete_and_next_node(gavl_root_t *root, gavl_node_t *node)
 /*===========================================================*/
 /* basic types compare functions */
 
-int gavl_cmp_int(const void *a, const void *b)
+int gavl_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT
 {
   if (*(int*)a>*(int*)b) return 1;
   if (*(int*)a<*(int*)b) return -1;
   return 0;
 }
 
-int gavl_cmp_long(const void *a, const void *b)
+int gavl_cmp_long(const void *a, const void *b) UL_ATTR_REENTRANT
 {
   if (*(long*)a>*(long*)b) return 1;
   if (*(long*)a<*(long*)b) return -1;
   return 0;
 }
 
-int gavl_cmp_ptr(const void *a, const void *b)
+int gavl_cmp_ptr(const void *a, const void *b) UL_ATTR_REENTRANT
 {
   if (*(void**)a>*(void**)b) return 1;
   if (*(void**)a<*(void**)b) return -1;
index 926c69f8ceabcbe8fd90d2f52d5818076c055513..d21d07653a73f6ca627d50feee30e0fce55cf766 100644 (file)
@@ -40,7 +40,7 @@ extern "C" {
 #define GAVL_UNBALANCED_SUPPORT
 
 /* function to compare fields of two items */
-typedef int gavl_cmp_fnc_t(const void *a, const void *b);
+typedef int gavl_cmp_fnc_t(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /**
  * struct gavl_node - Structure Representing Node of Generic AVL Tree
@@ -101,6 +101,8 @@ gavl_next_node(const gavl_node_t *node);
 gavl_node_t *
 gavl_prev_node(const gavl_node_t *node);
 
+#ifndef SDCC
+
 int
 gavl_is_empty(const gavl_root_t *root);
 
@@ -198,6 +200,8 @@ gavl_node2key(const gavl_root_t *root, const gavl_node_t *node)
   return (void*)(p+root->key_offs);
 }
 
+#endif /*SDCC*/
+
 int
 gavl_balance_one(gavl_node_t **subtree);
 
@@ -247,6 +251,8 @@ gavl_delete_and_next_node(gavl_root_t *root, gavl_node_t *node);
 /*===========================================================*/
 /* iterators for generic GAVL type */
 
+#ifndef SDCC
+
 typedef struct {
   gavl_root_t *container;
   gavl_node_t *node;
@@ -351,12 +357,14 @@ gavl_find_after_it(gavl_root_t *container, const void *key, gavl_it_t *it)
 #define gavl_generic_for_each_cut(item_t, root, ptr) \
        for(;(ptr=(item_t*)gavl_cut_first(root));)
 
+#endif /*SDCC*/
+
 /*===========================================================*/
 /* basic types compare functions */
 
-int gavl_cmp_int(const void *a, const void *b);
-int gavl_cmp_long(const void *a, const void *b);
-int gavl_cmp_ptr(const void *a, const void *b);
+int gavl_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT;
+int gavl_cmp_long(const void *a, const void *b) UL_ATTR_REENTRANT;
+int gavl_cmp_ptr(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /*===========================================================*/
 /* More functions useful for partially balanced trees */
index 36f818f61fc0d168c0e46dd5991daff9b2e48c93..43f01ea4ba7d55d0770ab68d5bc4226c3690087b 100644 (file)
@@ -2,7 +2,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <limits.h>
+#ifndef SDCC
 #include <sys/time.h>
+#endif
 
 #include "ul_utmalloc.h"
 #include "ul_gavl.h"
@@ -24,7 +26,7 @@ typedef struct gavl_check_st{
   int depth;
   gavl_node_t *node;
   gavl_root_t *root;
-  int (*node_fnc)(gavl_node_t *node, struct gavl_check_st *check);
+  int (*node_fnc)(gavl_node_t *node, struct gavl_check_st *check) UL_ATTR_REENTRANT;
   void *context;
   int *status;
 } gavl_check_st_t;
index 838d793290996955139e456d1bcac4ae5899503a..0f046b2b3567dc522e8c74331e4a167d5228a8e9 100644 (file)
@@ -382,12 +382,12 @@ gsa_setsort(gsa_array_t *array, int key_offs,
   return gsa_resort_buble(array,array->key_offs,array->cmp_fnc);
 }
 
-int gsa_cmp_int(const void *a, const void *b)
+int gsa_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT
 {
   return *(int*)a-*(int*)b;
 }
 
-int gsa_cmp_ulong(const void *a, const void *b)
+int gsa_cmp_ulong(const void *a, const void *b) UL_ATTR_REENTRANT
 {
   return *(unsigned long*)a-*(unsigned long*)b;
 }
index cc8a069f92f4cfffdaee02776a7f5eb4918182bc..4454cac5dada2dd31aafbcff7c64f96da0812081 100644 (file)
@@ -36,13 +36,13 @@ extern "C" {
 #define GSA_FAFTER 2
 
 /* function to compare fields of two array items */
-typedef int gsa_cmp_fnc_t(const void *a, const void *b);
+typedef int gsa_cmp_fnc_t(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /* compare two integer fields */
-int gsa_cmp_int(const void *a, const void *b);
+int gsa_cmp_int(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /* compare two unsigned long fields */
-int gsa_cmp_ulong(const void *a, const void *b);
+int gsa_cmp_ulong(const void *a, const void *b) UL_ATTR_REENTRANT;
 
 /* define structure representing head of array */
 #define GSA_ARRAY_FOR(_type) \
index 53b7ac2b2dbca225f461d88d5fb29852dc40dc43..1df70472a5743222768be997a2ceabf080f5d3c1 100644 (file)
@@ -47,7 +47,7 @@ ul_htimer_cmp_fnc(const ul_htim_time_t *a, const ul_htim_time_t *b)
 /* Additional, user defined fields for ul_htimer_t structure */
 #define UL_HTIMER_USER_FIELDS 
 
-typedef void (ul_htimer_fnc_t)(unsigned long data);
+typedef void (ul_htimer_fnc_t)(unsigned long data) UL_ATTR_REENTRANT;
 
 /* The wrapper for ul_htimer_run_expired */
 #define UL_HTIMER_FNC_CALL(queue, timer, pact_time) \
index df46814abcd0aff900bb3773a80a0ee492046934..fb260592857dbc41a0ea930cbb7a5a9f285cc25a 100644 (file)
@@ -236,10 +236,10 @@ void ul_htimer_run_expired(ul_htimer_queue_t *queue, ul_htim_time_t *pact_time);
 #ifdef UL_HTIMER_WITH_STD_TYPE
 
 typedef struct ul_root_htimer_ops_t {
-  int (*timer_root_init)(int options, void *context);
-  ul_htimer_queue_t *(*timer_root_get)(int options, void *context);
-  void (*timer_root_put)(ul_htimer_queue_t *queue);
-  int (*current_time)(int options, ul_htim_time_t *htimer_time);
+  int (*timer_root_init)(int options, void *context) UL_ATTR_REENTRANT;
+  ul_htimer_queue_t *(*timer_root_get)(int options, void *context) UL_ATTR_REENTRANT;
+  void (*timer_root_put)(ul_htimer_queue_t *queue) UL_ATTR_REENTRANT;
+  int (*current_time)(int options, ul_htim_time_t *htimer_time) UL_ATTR_REENTRANT;
 } ul_root_htimer_ops_t;
 
 extern ul_root_htimer_ops_t *ul_root_htimer_ops;
index af7f8a83114fa7b1ceb383890c850a50b5e00b8c..5626d69b58f5dab74fce43ecf37979c27efe3099 100644 (file)
@@ -25,7 +25,9 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#ifndef SDCC
 #include <sys/types.h>
+#endif
 #include <stdarg.h>
 
 #else /*__RTL__*/
@@ -78,10 +80,10 @@ void ul_log(ul_log_domain_t *domain, int level,
 
 void
 ul_log_fnc_default(ul_log_domain_t *domain, int level,
-       const char *format, va_list ap);
+       const char *format, va_list ap) UL_ATTR_REENTRANT;
 
 ul_log_fnc_t *ul_log_output;
-#ifndef __RTL__
+#if !defined(__RTL__) && !defined(SDCC)
 FILE *ul_log_default_file;
 #endif /*__RTL__*/
 
@@ -139,7 +141,7 @@ ul_log_redir(ul_log_fnc_t *log_fnc, int add_flags)
   ul_log_output=log_fnc;
 }
 
-#ifndef __RTL__
+#if !defined(__RTL__) && !defined(SDCC)
 void
 ul_log_fnc_default(ul_log_domain_t *domain, int level,
        const char *format, va_list ap)
@@ -156,7 +158,7 @@ ul_log_fnc_default(ul_log_domain_t *domain, int level,
 }
 
 
-#else /*__RTL__*/
+#elif defined(__RTL__)
 void
 ul_log_fnc_default(ul_log_domain_t *domain, int level,
        const char *format, va_list ap)
@@ -176,7 +178,7 @@ ul_log_fnc_default(ul_log_domain_t *domain, int level,
 int
 ul_log_check_default_output(void)
 {
- #ifndef __RTL__
+ #if !defined(__RTL__) && !defined(SDCC)
   char *s;
   char *log_fname;
  #endif /*__RTL__*/
@@ -185,7 +187,7 @@ ul_log_check_default_output(void)
     return 0;
 
   ul_log_output=ul_log_fnc_default;
- #ifndef __RTL__
+ #if !defined(__RTL__) && !defined(SDCC)
   if((log_fname=getenv("UL_LOG_FILENAME"))!=NULL){
     ul_log_default_file=fopen(log_fname,"a");
   }
index 4136e086b1f71a49f2905b9d6de30701922a4684..eb29b2d3db003007634106811cabe3a44c44267c 100644 (file)
@@ -58,7 +58,7 @@ typedef struct ul_log_domain {
 } ul_log_domain_t;
 
 typedef void (ul_log_fnc_t)(ul_log_domain_t *domain, int level,
-       const char *format, va_list ap);
+       const char *format, va_list ap) UL_ATTR_REENTRANT;
 
 void ul_log_redir(ul_log_fnc_t *log_fnc, int add_flags);