Attachment "warnings.patch" to
ticket [fb97352ad9]
added by
aku
2014-08-11 05:05:52.
Most of the following chunks are related to casting variables to void* for use in rde_stack_push or Tcl_*Hash* function calls. There are a few removals of unused variables and (void)var; of unused parameters.
Index: modules/pt/rde_critcl/m.c
==================================================================
--- modules/pt/rde_critcl/m.c
+++ modules/pt/rde_critcl/m.c
@@ -49,11 +49,11 @@
{
/* Syntax: rde ast
* [0] [1]
*/
- long int ac, i;
+ long int ac;
Tcl_Obj** av;
if (objc != 2) {
Tcl_WrongNumArgs (interp, 2, objv, NULL);
return TCL_ERROR;
@@ -71,11 +71,11 @@
{
/* Syntax: rde asts
* [0] [1]
*/
- long int ac, i;
+ long int ac;
Tcl_Obj** av;
if (objc != 2) {
Tcl_WrongNumArgs (interp, 2, objv, NULL);
return TCL_ERROR;
Index: modules/pt/rde_critcl/ms.c
==================================================================
--- modules/pt/rde_critcl/ms.c
+++ modules/pt/rde_critcl/ms.c
@@ -28,11 +28,11 @@
int
paramms_objcmd (ClientData cd, Tcl_Interp* interp, int objc, Tcl_Obj* CONST* objv)
{
RDE_STATE p = (RDE_STATE) cd;
- int m, res;
+ int m, res = 0;
static CONST char* methods [] = {
"amarked", "ast", "asts", "chan",
"complete", "current", "data", "destroy", "emarked",
"error", "lmarked", "location", "ok",
Index: modules/pt/rde_critcl/ot.c
==================================================================
--- modules/pt/rde_critcl/ot.c
+++ modules/pt/rde_critcl/ot.c
@@ -208,16 +208,19 @@
}
static void
ot_string_rep(Tcl_Obj* obj)
{
+ (void)obj;
ASSERT (0, "Attempted reconversion of rde string to string rep");
}
static int
ot_from_any(Tcl_Interp* ip, Tcl_Obj* obj)
{
+ (void)ip;
+ (void)obj;
ASSERT (0, "Illegal conversion into rde string");
return TCL_ERROR;
}
/*
* = = == === ===== ======== ============= =====================
Index: modules/pt/rde_critcl/p.c
==================================================================
--- modules/pt/rde_critcl/p.c
+++ modules/pt/rde_critcl/p.c
@@ -2,10 +2,11 @@
* (c) PARAM functions
*/
#include <pInt.h> /* Our public and internal APIs */
#include <util.h> /* Allocation macros */
+#include <inttypes.h>
#include <string.h>
/* .................................................. */
static char*
@@ -130,11 +131,11 @@
}
hPtr = Tcl_CreateHashEntry(&p->str, literal, &isnew);
ASSERT (isnew, "Should have found entry");
- Tcl_SetHashValue (hPtr, p->numstr);
+ Tcl_SetHashValue (hPtr, (void*)(uintptr_t) p->numstr);
if (p->numstr >= p->maxnum) {
long int new;
char** str;
Index: modules/pt/rde_critcl/param.c
==================================================================
--- modules/pt/rde_critcl/param.c
+++ modules/pt/rde_critcl/param.c
@@ -5,10 +5,13 @@
#include <param.h> /* Public and private APIs */
#include <stack.h> /* Stack handling */
#include <tc.h> /* Token cache handling */
#include <util.h> /* Allocation utilities */
+#include <ctype.h>
+#include <inttypes.h>
+#include <stdlib.h>
#include <string.h>
/*
* = = == === ===== ======== ============= =====================
*/
@@ -513,11 +516,11 @@
}
SCOPE void
rde_param_i_ast_push (RDE_PARAM p)
{
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
}
SCOPE void
rde_param_i_ast_value_push (RDE_PARAM p)
{
@@ -667,11 +670,11 @@
p->ER->loc = p->CL;
p->ER->msg = rde_stack_new (NULL);
ASSERT_BOUNDS(s,p->numstr);
- rde_stack_push (p->ER->msg, (void*) s);
+ rde_stack_push (p->ER->msg, (void*)(uintptr_t) s);
}
static void
error_state_free (void* esx)
{
@@ -704,11 +707,11 @@
}
SCOPE void
rde_param_i_loc_push (RDE_PARAM p)
{
- rde_stack_push (p->LS, (void*) p->CL);
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
}
SCOPE void
rde_param_i_loc_rewind (RDE_PARAM p)
{
@@ -813,15 +816,15 @@
/*
* 2-level hash table keyed by location, and symbol ...
*/
- hPtr = Tcl_FindHashEntry (&p->NC, (char*) p->CL);
+ hPtr = Tcl_FindHashEntry (&p->NC, (void*)(uintptr_t) p->CL);
if (!hPtr) { return 0; }
tablePtr = (Tcl_HashTable*) Tcl_GetHashValue (hPtr);
- hPtr = Tcl_FindHashEntry (tablePtr, (char*) s);
+ hPtr = Tcl_FindHashEntry (tablePtr, (void*)(uintptr_t) s);
if (!hPtr) { return 0; }
/*
* Found information, apply it to the state, restoring the cached
* situation.
@@ -858,21 +861,21 @@
/*
* 2-level hash table keyed by location, and symbol ...
*/
- hPtr = Tcl_CreateHashEntry (&p->NC, (char*) at, &isnew);
+ hPtr = Tcl_CreateHashEntry (&p->NC, (void*)(uintptr_t) at, &isnew);
if (isnew) {
tablePtr = ALLOC (Tcl_HashTable);
Tcl_InitHashTable (tablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetHashValue (hPtr, tablePtr);
} else {
tablePtr = (Tcl_HashTable*) Tcl_GetHashValue (hPtr);
}
- hPtr = Tcl_CreateHashEntry (tablePtr, (char*) s, &isnew);
+ hPtr = Tcl_CreateHashEntry (tablePtr, (void*)(uintptr_t) s, &isnew);
if (isnew) {
/*
* Copy state into new cache entry.
*/
@@ -1111,11 +1114,11 @@
SCOPE void
rde_param_i_value_reduce (RDE_PARAM p, long int s)
{
Tcl_Obj* newsv;
- int oc, i, j;
+ int i, j;
Tcl_Obj** ov;
long int ac;
Tcl_Obj** av;
long int pos = 1 + (long int) rde_stack_top (p->LS);
@@ -1186,11 +1189,11 @@
Tcl_IncrRefCount (p->SV);
}
return 1;
}
- rde_stack_push (p->LS, (void*) p->CL);
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
return 0;
}
SCOPE int
rde_param_i_symbol_start_d (RDE_PARAM p, long int s)
@@ -1201,31 +1204,31 @@
Tcl_IncrRefCount (p->SV);
}
return 1;
}
- rde_stack_push (p->LS, (void*) p->CL);
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
return 0;
}
SCOPE int
rde_param_i_symbol_void_start (RDE_PARAM p, long int s)
{
if (rde_param_i_symbol_restore (p, s)) return 1;
- rde_stack_push (p->LS, (void*) p->CL);
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
return 0;
}
SCOPE int
rde_param_i_symbol_void_start_d (RDE_PARAM p, long int s)
{
if (rde_param_i_symbol_restore (p, s)) return 1;
- rde_stack_push (p->LS, (void*) p->CL);
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
return 0;
}
SCOPE void
rde_param_i_symbol_done_d_reduce (RDE_PARAM p, long int s, long int m)
@@ -1443,12 +1446,12 @@
}
SCOPE void
rde_param_i_notahead_start_d (RDE_PARAM p)
{
- rde_stack_push (p->LS, (void*) p->CL);
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
}
SCOPE void
rde_param_i_notahead_exit_d (RDE_PARAM p)
{
@@ -1476,29 +1479,29 @@
SCOPE void
rde_param_i_state_push_2 (RDE_PARAM p)
{
/* loc_push + error_push */
- rde_stack_push (p->LS, (void*) p->CL);
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
rde_stack_push (p->ES, p->ER);
if (p->ER) { p->ER->refCount ++; }
}
SCOPE void
rde_param_i_state_push_void (RDE_PARAM p)
{
- rde_stack_push (p->LS, (void*) p->CL);
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
ER_CLEAR (p);
rde_stack_push (p->ES, p->ER);
/* if (p->ER) { p->ER->refCount ++; } */
}
SCOPE void
rde_param_i_state_push_value (RDE_PARAM p)
{
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
- rde_stack_push (p->LS, (void*) p->CL);
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
+ rde_stack_push (p->LS, (void*)(uintptr_t) p->CL);
ER_CLEAR (p);
rde_stack_push (p->ES, p->ER);
/* if (p->ER) { p->ER->refCount ++; } */
}
@@ -1599,11 +1602,11 @@
rde_param_i_seq_void2value (RDE_PARAM p)
{
rde_param_i_error_pop_merge (p);
if (p->ST) {
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
rde_stack_push (p->ES, p->ER);
if (p->ER) { p->ER->refCount ++; }
return 0;
} else {
p->CL = (long int) rde_stack_top (p->LS);
@@ -1660,11 +1663,11 @@
rde_param_i_error_pop_merge (p);
if (p->ST) {
rde_stack_pop (p->LS, 1);
} else {
- rde_stack_push (p->mark, (void*) rde_stack_size (p->ast));
+ rde_stack_push (p->mark, (void*)(uintptr_t) rde_stack_size (p->ast));
p->CL = (long int) rde_stack_top (p->LS);
rde_stack_push (p->ES, p->ER);
if (p->ER) { p->ER->refCount ++; }
}
Index: modules/pt/rde_critcl/tc.c
==================================================================
--- modules/pt/rde_critcl/tc.c
+++ modules/pt/rde_critcl/tc.c
@@ -120,11 +120,11 @@
}
SCOPE void
rde_tc_get (RDE_TC tc, int at, char** ch, long int* len)
{
- long int oc, off, top, end;
+ long int oc, off, end;
void** ov;
rde_stack_get (tc->off, &oc, &ov);
ASSERT_BOUNDS(at,oc);
@@ -146,11 +146,11 @@
}
SCOPE void
rde_tc_get_s (RDE_TC tc, int at, int last, char** ch, long int* len)
{
- long int oc, off, top, end;
+ long int oc, off, end;
void** ov;
rde_stack_get (tc->off, &oc, &ov);
ASSERT_BOUNDS(at,oc);