Fix some warnings during compilation
authorgreg
Thu, 22 Oct 2009 11:26:45 +0200
changeset 423 4d7ac355701d
parent 422 76aebe92fd5f
child 424 86a7c1d11bbd
Fix some warnings during compilation
plugger.py
targets/plc_common_main.c
targets/plc_debug.c
--- a/plugger.py	Mon Oct 19 16:26:15 2009 +0200
+++ b/plugger.py	Thu Oct 22 11:26:45 2009 +0200
@@ -1287,7 +1287,7 @@
                       "__publish_%s();"%locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
                 "init_calls":"\n    ".join([
                       "init_level=%d; "%(i+1)+
-                      "if(res = __init_%s(argc,argv)){"%locstr +
+                      "if((res = __init_%s(argc,argv))){"%locstr +
                       #"printf(\"%s\"); "%locstr + #for debug
                       "return res;}" for i,locstr in enumerate(locstrs)]),
                 "cleanup_calls":"\n    ".join([
--- a/targets/plc_common_main.c	Mon Oct 19 16:26:15 2009 +0200
+++ b/targets/plc_common_main.c	Thu Oct 22 11:26:45 2009 +0200
@@ -41,7 +41,7 @@
 /*
  * Retrieve input variables, run PLC and publish output variables
  **/
-void __run()
+void __run(void)
 {
     __tick++;
     if (greatest_tick_count__)
@@ -66,6 +66,7 @@
 int __init(int argc,char **argv)
 {
     int res = 0;
+    init_level = 0;
     setlocale(LC_NUMERIC, "C");
     config_init__();
     __init_debug();
@@ -75,7 +76,7 @@
 /*
  * Calls plugin cleanup proc.
  **/
-void __cleanup()
+void __cleanup(void)
 {
     %(cleanup_calls)s
     __cleanup_debug();
--- a/targets/plc_debug.c	Mon Oct 19 16:26:15 2009 +0200
+++ b/targets/plc_debug.c	Thu Oct 22 11:26:45 2009 +0200
@@ -51,17 +51,17 @@
 
 struct_plcvar variable_table[%(variables_pointer_type_table_count)d];
 
-void __init_debug()
+void __init_debug(void)
 {
 %(variables_pointer_type_table_initializer)s
     buffer_state = BUFFER_FREE;
 }
 
-void __cleanup_debug()
+void __cleanup_debug(void)
 {
 }
 
-void __retrieve_debug()
+void __retrieve_debug(void)
 {
 }
 
@@ -71,7 +71,7 @@
 extern void InitiateDebugTransfer(void);
 
 extern unsigned long __tick;
-void __publish_debug()
+void __publish_debug(void)
 {
     /* Check there is no running debugger re-configuration */
     if(TryEnterDebugSection()){
@@ -143,10 +143,11 @@
     latest_subscription = subscription_table;
 }
 
-void FreeDebugData()
+void FreeDebugData(void)
 {
     /* atomically mark buffer as free */
-    long latest_state = AtomicCompareExchange(
+    long latest_state;
+    latest_state = AtomicCompareExchange(
         &buffer_state,
         BUFFER_BUSY,
         BUFFER_FREE);
@@ -169,8 +170,8 @@
         {
             return old_cursor;
         }else{
-            printf("%%d > %%d\n", old_cursor - debug_buffer, BUFFER_SIZE);
-	    return NULL;
+            //printf("%%d > %%d\n", old_cursor - debug_buffer, BUFFER_SIZE);
+            return NULL;
         } 
     }
     *idx = -1;