From 1f88bfc3b4adeb4e276619f8e0ccd15766e68674 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 24 Sep 2001 18:58:33 +0200
Subject: [PATCH] Fixed a few warnings.

Rev: src/builtin.cmod:1.66
Rev: src/builtin_functions.c:1.406
Rev: src/combine_path.h:1.8
Rev: src/iterators.cmod:1.14
Rev: src/las.c:1.266
Rev: src/peep.c:1.70
Rev: src/program.c:1.372
Rev: src/stralloc.c:1.136
Rev: src/svalue.c:1.124
Rev: src/threads.c:1.166
---
 src/builtin.cmod        |  6 ++----
 src/builtin_functions.c | 23 +++++++++--------------
 src/combine_path.h      |  4 ++--
 src/iterators.cmod      |  3 +--
 src/las.c               |  5 +++--
 src/peep.c              |  6 +++---
 src/program.c           | 10 +++-------
 src/stralloc.c          |  4 +---
 src/svalue.c            | 11 +++++------
 src/threads.c           |  7 ++++---
 10 files changed, 33 insertions(+), 46 deletions(-)

diff --git a/src/builtin.cmod b/src/builtin.cmod
index 348390b55c..42b2eab45f 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -1,5 +1,5 @@
 /* -*- c -*-
- * $Id: builtin.cmod,v 1.65 2001/09/21 17:57:12 grubba Exp $
+ * $Id: builtin.cmod,v 1.66 2001/09/24 16:46:34 grubba Exp $
  */
 
 #include "global.h"
@@ -620,7 +620,6 @@ PIKEFUN string function_name(program|function func)
   efun;
   optflags OPT_TRY_OPTIMIZE;
 {
-  struct pike_string *s;
   switch(func->type)
   {
     default:
@@ -1025,7 +1024,6 @@ PIKECLASS backtrace_frame
   PIKEFUN mixed `[]=(int index, mixed value)
   {
     INT32 numargs = 0;
-    INT32 i;
 
     if (THIS->args) {
       numargs = THIS->args->size;
@@ -1255,7 +1253,7 @@ PIKECLASS Buffer
    *!
    *!   Initializes a new buffer.
    *!
-   *!   If no @[initial_size] is specified, 4096 is used. If you
+   *!   If no @[initial_size] is specified, 256 is used. If you
    *!   know approximately how big the buffer will be, you can optimize
    *!   the operation of @[add()] (slightly) by passing the size to this
    *!   function.
diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 5a86a9d129..a75e32d166 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.405 2001/09/04 19:26:54 mast Exp $");
+RCSID("$Id: builtin_functions.c,v 1.406 2001/09/24 16:57:17 grubba Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -495,7 +495,7 @@ PMOD_EXPORT void f_random_string(INT32 args)
   INT_TYPE len, e;
   get_all_args("random_string",args,"%i",&len);
   ret = begin_shared_string(len);
-  for(e=0;e<len;e++) ret->str[e]=my_rand();
+  for(e=0;e<len;e++) ret->str[e] = DO_NOT_WARN((char)my_rand());
   pop_n_elems(args);
   push_string(end_shared_string(ret));
 }
@@ -1080,7 +1080,6 @@ PMOD_EXPORT void f_zero_type(INT32 args)
 
 static int generate_zero_type(node *n)
 {
-  node **arg;
   if(count_args(CDR(n)) != 1) return 0;
   if(do_docode(CDR(n),DO_NOT_COPY) != 1)
     fatal("Count args was wrong in generate_zero_type().\n");
@@ -1502,7 +1501,7 @@ void f_string_to_utf8(INT32 args)
     } else {
       /* This and onwards is extended UTF-8 encoding. */
       /* 32 - 36bit */
-      out->str[j++] = 0xfe;
+      out->str[j++] = DO_NOT_WARN((char)0xfe);
       out->str[j++] = 0x80 | ((c >> 30) & 0x3f);
       out->str[j++] = 0x80 | ((c >> 24) & 0x3f);
       out->str[j++] = 0x80 | ((c >> 18) & 0x3f);
@@ -1684,7 +1683,7 @@ PMOD_EXPORT void f_utf8_to_string(INT32 args)
 static void f_parse_pike_type( INT32 args )
 {
   struct pike_type *t;
-  struct pike_string *res;
+
   if( !args || Pike_sp[-1].type != T_STRING ||
       Pike_sp[-1].u.string->size_shift )
     Pike_error( "__parse_pike_type requires a 8bit string as its first argument\n" );
@@ -3314,7 +3313,6 @@ PMOD_EXPORT void f_sleep(INT32 args)
 #endif
 
    double delay=0.0;
-   double target;
    int do_microsleep;
    int do_abort_on_signal;
 
@@ -3424,7 +3422,6 @@ PMOD_EXPORT void f_sleep(INT32 args)
  */
 void f_gc(INT32 args)
 {
-  INT32 tmp;
   pop_n_elems(args);
   push_int(do_gc());
 }
@@ -3941,11 +3938,10 @@ PMOD_EXPORT void f_localtime(INT32 args)
  */
 PMOD_EXPORT void f_mktime (INT32 args)
 {
-  INT_TYPE sec, min, hour, mday, mon, year, isdst;
+  INT_TYPE sec, min, hour, mday, mon, year;
   struct tm date;
-  struct svalue s;
-  struct svalue * r;
   int retval;
+
   if (args<1)
     SIMPLE_TOO_FEW_ARGS_ERROR("mktime", 1);
 
@@ -4200,7 +4196,7 @@ PMOD_EXPORT void f_glob(INT32 args)
 {
   INT32 i,matches;
   struct array *a;
-  struct svalue *sval, tmp;
+  struct svalue tmp;
   struct pike_string *glob;
 
   if(args < 2)
@@ -4458,7 +4454,7 @@ static struct array *longest_ordered_sequence(struct array *a)
 {
   int *stack;
   int *links;
-  int i,j,top=0,l=0,ltop=-1;
+  int i, top=0, l=0, ltop=-1;
   struct array *res;
   ONERROR tmp;
   ONERROR tmp2;
@@ -6019,7 +6015,6 @@ PMOD_EXPORT void f_transpose(INT32 args)
   struct array *out;
   struct array *in;
   struct array *outinner;
-  struct array *ininner;
   INT32 sizeininner=0,sizein=0;
   INT32 inner=0;
   INT32 j,i;
@@ -6332,7 +6327,7 @@ PMOD_EXPORT void f_map_array(INT32 args)
 PMOD_EXPORT void f_map(INT32 args)
 {
    struct svalue *mysp;
-   struct array *a,*d,*f;
+   struct array *a,*d;
    int splice,i,n;
 
    if (args<1)
diff --git a/src/combine_path.h b/src/combine_path.h
index c92879a343..49f069d92d 100644
--- a/src/combine_path.h
+++ b/src/combine_path.h
@@ -1,5 +1,5 @@
 /*
- * $Id: combine_path.h,v 1.7 2001/06/11 11:49:47 grubba Exp $
+ * $Id: combine_path.h,v 1.8 2001/09/24 16:51:28 grubba Exp $
  *
  * Combine path template.
  *
@@ -54,7 +54,7 @@ static void APPEND_PATH(struct string_builder *s,
 			size_t len)
 {
   size_t from=0;
-  int tmp,c;
+  int tmp;
   int abs=0;
 
   /* First, check if path is absolute, 
diff --git a/src/iterators.cmod b/src/iterators.cmod
index 439703a3e5..b7608ee57a 100644
--- a/src/iterators.cmod
+++ b/src/iterators.cmod
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: iterators.cmod,v 1.13 2001/06/17 15:59:05 grubba Exp $");
+RCSID("$Id: iterators.cmod,v 1.14 2001/09/24 16:47:27 grubba Exp $");
 #include "main.h"
 #include "object.h"
 #include "mapping.h"
@@ -523,7 +523,6 @@ PIKECLASS file_line_iterator
   PIKEFUN object `+(int steps)
     {
       struct object *o=low_clone(file_line_iterator_program);
-      int i;
       struct file_line_iterator_struct *ssi;
       (ssi = OBJ2_FILE_LINE_ITERATOR(o))[0]=*THIS;
       if (THIS->buffer) {
diff --git a/src/las.c b/src/las.c
index 35dd7f06f1..98748ca3c7 100644
--- a/src/las.c
+++ b/src/las.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: las.c,v 1.265 2001/08/16 04:38:51 mast Exp $");
+RCSID("$Id: las.c,v 1.266 2001/09/24 16:50:58 grubba Exp $");
 
 #include "language.h"
 #include "interpret.h"
@@ -4692,7 +4692,9 @@ static node *localopt(node *n)
 
 static void optimize(node *n)
 {
+#ifndef IN_TPIKE
   node *tmp1, *tmp2, *tmp3;
+#endif /* !IN_TPIKE */
   INT32 save_line = lex.current_line;
 #ifdef PIKE_DEBUG
   struct pike_string *save_file = lex.current_file;
@@ -5168,7 +5170,6 @@ static struct svalue *is_stupid_func(node *n,
 				     int vargs,
 				     struct pike_type *type)
 {
-  node *a,*b;
   int tmp;
   while(1)
   {
diff --git a/src/peep.c b/src/peep.c
index 0d510cf949..c7c56627ef 100644
--- a/src/peep.c
+++ b/src/peep.c
@@ -19,7 +19,7 @@
 #include "interpret.h"
 #include "pikecode.h"
 
-RCSID("$Id: peep.c,v 1.69 2001/08/16 18:49:46 marcus Exp $");
+RCSID("$Id: peep.c,v 1.70 2001/09/24 16:58:33 grubba Exp $");
 
 static void asm_opt(void);
 
@@ -142,7 +142,7 @@ void update_arg(int instr,INT32 arg)
 
 void assemble(void)
 {
-  INT32 d,max_label,tmp;
+  INT32 max_label,tmp;
   INT32 *labels, *jumps, *uses;
   ptrdiff_t e, length;
   p_instr *c;
@@ -185,7 +185,7 @@ void assemble(void)
       {
 	while(1)
 	{
-	  int tmp,tmp2;
+	  int tmp;
 	  tmp=labels[c[e].arg];
 	  
 	  while(tmp<length &&
diff --git a/src/program.c b/src/program.c
index 26682222cb..aff13e32b4 100644
--- a/src/program.c
+++ b/src/program.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: program.c,v 1.371 2001/09/20 19:09:37 hubbe Exp $");
+RCSID("$Id: program.c,v 1.372 2001/09/24 16:42:48 grubba Exp $");
 #include "program.h"
 #include "object.h"
 #include "dynamic_buffer.h"
@@ -1927,7 +1927,6 @@ struct program *end_first_pass(int finish)
 
   if(Pike_compiler->init_node)
   {
-    union idptr tmp;
     e=dooptcode(s,
 		mknode(F_COMMA_EXPR,
 		       Pike_compiler->init_node,mknode(F_RETURN,mkintnode(0),0)),
@@ -2475,7 +2474,6 @@ void low_inherit(struct program *p,
   int e;
   ptrdiff_t inherit_offset, storage_offset;
   struct inherit inherit;
-  struct pike_string *s;
 
 #if 0
   fprintf(stderr,"LOW_INHERIT(pid=%d, parent=%p, parid=%d, paroff=%d, flags=0x%x, name=%s);\n",
@@ -3309,7 +3307,7 @@ PMOD_EXPORT int add_float_constant(char *name,
 {
   struct svalue tmp;
   tmp.type=T_FLOAT;
-  tmp.u.float_number=f;
+  tmp.u.float_number = DO_NOT_WARN((FLOAT_TYPE)f);
   tmp.subtype=0;
   return simple_add_constant(name, &tmp, flags);
 }
@@ -3357,7 +3355,6 @@ PMOD_EXPORT int add_object_constant(char *name,
 PMOD_EXPORT int add_function_constant(char *name, void (*cfun)(INT32), char * type, INT16 flags)
 {
   struct svalue s;
-  struct pike_string *n;
   INT32 ret;
 
   s.type=T_FUNCTION;
@@ -5239,7 +5236,7 @@ void pop_local_variables(int level)
 void pop_compiler_frame(void)
 {
   struct compiler_frame *f;
-  int e;
+
   f=Pike_compiler->compiler_frame;
 #ifdef PIKE_DEBUG
   if(!f)
@@ -5331,7 +5328,6 @@ struct program *low_program_from_function(struct program *p,
 
 PMOD_EXPORT struct program *program_from_function(const struct svalue *f)
 {
-  struct identifier *id;
   if(f->type != T_FUNCTION) return 0;
   if(f->subtype == FUNCTION_BUILTIN) return 0;
   if(!f->u.object->prog) return 0;
diff --git a/src/stralloc.c b/src/stralloc.c
index 757da97e59..d3267b615e 100644
--- a/src/stralloc.c
+++ b/src/stralloc.c
@@ -27,7 +27,7 @@
 #define HUGE HUGE_VAL
 #endif /*!HUGE*/
 
-RCSID("$Id: stralloc.c,v 1.135 2001/09/21 21:53:19 grubba Exp $");
+RCSID("$Id: stralloc.c,v 1.136 2001/09/24 16:44:06 grubba Exp $");
 
 /* #define STRALLOC_USE_PRIMES */
 
@@ -1612,7 +1612,6 @@ PMOD_EXPORT ptrdiff_t string_search(struct pike_string *haystack,
 				    ptrdiff_t start)
 {
   SearchMojt mojt;
-  struct generic_mem_searcher s;
   char *r;
 
   if(needle->size_shift > haystack->size_shift ||
@@ -2086,7 +2085,6 @@ PMOD_EXPORT void string_builder_fill(struct string_builder *s,
   howmany-=tmp;
   if(howmany > 0)
   {
-    void *new_from;
     PCHARP to;
     tmp=MINIMUM(howmany, len);
     to=MKPCHARP_STR_OFF(s->s,s->s->len);
diff --git a/src/svalue.c b/src/svalue.c
index 09bd93bbf5..426b26d7ba 100644
--- a/src/svalue.c
+++ b/src/svalue.c
@@ -62,7 +62,7 @@ static int pike_isnan(double x)
 #endif /* HAVE__ISNAN */
 #endif /* HAVE_ISNAN */
 
-RCSID("$Id: svalue.c,v 1.123 2001/09/20 19:10:24 hubbe Exp $");
+RCSID("$Id: svalue.c,v 1.124 2001/09/24 16:49:20 grubba Exp $");
 
 struct svalue dest_ob_zero = {
   T_INT, 0,
@@ -532,7 +532,6 @@ PMOD_EXPORT unsigned INT32 hash_svalue(const struct svalue *s)
 
 PMOD_EXPORT int svalue_is_true(const struct svalue *s)
 {
-  unsigned INT32 q;
   check_type(s->type);
   check_refs(s);
 
@@ -1231,10 +1230,10 @@ PMOD_EXPORT void describe_svalue(const struct svalue *s,int indent,struct proces
 	  pop_stack();
 	}
 	else {
+#if 0
 	  struct pike_string *file;
 	  INT32 line;
-#if 0
-	  /* This provides useful info sometimes, but there are code
+	  /* This provides useful info sometimes, but there is code
 	   * that looks for the plain "object" string to resort to
 	   * other fallbacks. */
 	  if ((file = get_program_line(s->u.object->prog, &line))) {
@@ -1257,10 +1256,10 @@ PMOD_EXPORT void describe_svalue(const struct svalue *s,int indent,struct proces
       break;
 
     case T_PROGRAM: {
+#if 0
       struct pike_string *file;
       INT32 line;
-#if 0
-      /* This provides useful info sometimes, but there are code that
+      /* This provides useful info sometimes, but there is code that
        * looks for the plain "program" string to resort to other
        * fallbacks. */
       if ((file = get_program_line(s->u.program, &line))) {
diff --git a/src/threads.c b/src/threads.c
index bfb8cc1271..06e328d39a 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.165 2001/09/20 19:36:43 hubbe Exp $");
+RCSID("$Id: threads.c,v 1.166 2001/09/24 16:45:39 grubba Exp $");
 
 PMOD_EXPORT int num_threads = 1;
 PMOD_EXPORT int threads_disabled = 0;
@@ -29,6 +29,9 @@ PMOD_EXPORT COND_T live_threads_change;
 PMOD_EXPORT COND_T threads_disabled_change;
 PMOD_EXPORT size_t thread_stack_size=256 * 1204;
 
+/* SCO magic... */
+int  __thread_sys_behavior = 1;
+
 #if !defined(HAVE_PTHREAD_ATFORK) && !defined(th_atfork)
 #include "callback.h"
 
@@ -738,7 +741,6 @@ int num_lwps = 1;
  */
 void f_thread_create(INT32 args)
 {
-  THREAD_T dummy;
   struct thread_starter *arg;
   int tmp;
   arg = ALLOC_STRUCT(thread_starter);
@@ -1668,7 +1670,6 @@ void low_th_init(void)
 
 void th_init(void)
 {
-  struct program *tmp;
   ptrdiff_t mutex_key_offset;
 
 #ifdef UNIX_THREADS
-- 
GitLab