Bug 54543

Summary: joe meets ccc
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: joeAssignee: Lon Hohberger <lhh>
Status: CLOSED WONTFIX QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: alpha   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-09-25 18:43:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2001-10-11 17:35:54 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk  (Win98; I)

Description of problem:
some source code suggestions

Version-Release number of selected component (if applicable):


How reproducible:
Didn't try

Steps to Reproduce:
1. compile joe with Compaq C compiler ccc -w0 -fast
2.
3.
	

Additional info:


In compiling package joe-2.8-24, I got

1.

cc: Warning: path.c, line 238: In this statement, the expression "snprintf(...)" modifies the variable "seq" more than once 
without an intervening sequence point.  This behavior is undefined. (undefvarmod)
 snprintf(name,namesize,"%s/J%d%d.tmp",where,seq= ++seq%1000,(unsigned)time(NULL)%1000);
-^

The following patch seems to shut the compiler up.

*** path.c.old	Thu Oct 11 10:08:01 2001
--- path.c	Thu Oct 11 10:08:43 2001
***************
*** 235,241 ****
   namesize = zlen(where)+16;
   name=(char *)malloc(namesize);
   loop:
!  snprintf(name,namesize,"%s/J%d%d.tmp",where,seq= ++seq%1000,(unsigned)time(NULL)%1000);
   ossep(name);
   if((fd=open(name,O_RDONLY))!= -1)
    {
--- 235,242 ----
   namesize = zlen(where)+16;
   name=(char *)malloc(namesize);
   loop:
!  snprintf( name, namesize, "%s/J%d%d.tmp", where, seq = (seq + 1) % 1000,
! 		(unsigned int) time( NULL) % 1000);
   ossep(name);
   if((fd=open(name,O_RDONLY))!= -1)
    {

2.

cc: Warning: termcap.c, line 439: Non-void function "outout" does not contain a return statement. (missingreturn)
static int outout(c)
^

I made the obvious patch

*** termcap.c.old	Thu Oct 11 10:09:46 2001
--- termcap.c	Thu Oct 11 10:10:20 2001
***************
*** 436,442 ****
  }
  
  static CAP *outcap;
! static int outout(c)
   {
   outcap->out(outcap->outptr,c);
   }
--- 436,443 ----
  }
  
  static CAP *outcap;
! /* static int outout(c) */
! static void outout(c)
   {
   outcap->out(outcap->outptr,c);
   }

3.

cc: Warning: ufile.c, line 298: Non-void function "dosave" does not contain a return statement. (missingreturn)
static int dosave(bw,s,callback,notify)
^

I guessed at the following patch

*** ufile.c.old	Thu Oct 11 10:11:37 2001
--- ufile.c	Thu Oct 11 10:12:03 2001
***************
*** 306,311 ****
--- 306,312 ----
   req->callback=callback;
   if(backup(bw)) saver(bw,0,req,notify);
   else saver(bw,'y',req,notify);
+  return 0;
   }
  
  static int dosave2(bw,c,s,notify)

4.

cc: Error: usearch.c, line 142: Identifier expected but not found. (idexpected)
 srch->restrict=0;
-------^

restrict is now a keyword in ISO C.

I made the following patch

*** usearch.c.old	Thu Oct 11 10:04:50 2001
--- usearch.c	Thu Oct 11 10:05:34 2001
***************
*** 139,145 ****
   srch->markb=0;
   srch->markk=0;
   srch->valid=0;
!  srch->restrict=0;
   izque(SRCHREC,link,&srch->recs);
   for(x=0;x!=26;++x) srch->pieces[x]=0;
   return srch;
--- 139,145 ----
   srch->markb=0;
   srch->markk=0;
   srch->valid=0;
!  srch->restricted = 0;
   izque(SRCHREC,link,&srch->recs);
   for(x=0;x!=26;++x) srch->pieces[x]=0;
   return srch;
***************
*** 290,296 ****
    case 'r': case 'R': srch->replace=1; break;
    case 'b': case 'B': srch->backwards=1; break;
    case 'i': case 'I': srch->ignore=1; break;
!   case 'k': case 'K': srch->restrict=1; break;
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
     if(srch->repeat== -1) srch->repeat=0;
--- 290,296 ----
    case 'r': case 'R': srch->replace=1; break;
    case 'b': case 'B': srch->backwards=1; break;
    case 'i': case 'I': srch->ignore=1; break;
!   case 'k': case 'K': srch->restricted = 1; break;
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9':
     if(srch->repeat== -1) srch->repeat=0;
***************
*** 481,491 ****
   * 1 if we're done
   */
  
! int restrict(bw,srch)
  BW *bw;
  SRCH *srch;
   {
!  if(!srch->valid || !srch->restrict) return 0;
   bw->cursor->xcol=piscol(bw->cursor);
   if(srch->backwards)
    if(!square)
--- 481,491 ----
   * 1 if we're done
   */
  
! int restricted(bw,srch)
  BW *bw;
  SRCH *srch;
   {
!  if(!srch->valid || !srch->restricted) return 0;
   bw->cursor->xcol=piscol(bw->cursor);
   if(srch->backwards)
    if(!square)
***************
*** 542,548 ****
    if(srch->rest || srch->repeat!= -1 && srch->replace)
     {
     if(srch->valid)
!     switch(restrict(bw,srch))
       {
       case -1: goto again;
       case 1: if(srch->addr>=0) pgoto(bw->cursor,srch->addr); return !srch->rest;
--- 542,548 ----
    if(srch->rest || srch->repeat!= -1 && srch->replace)
     {
     if(srch->valid)
!     switch(restricted(bw,srch))
       {
       case -1: goto again;
       case 1: if(srch->addr>=0) pgoto(bw->cursor,srch->addr); return !srch->rest;
***************
*** 553,559 ****
    else if(srch->repeat!= -1)
     {
     if(srch->valid)
!     switch(restrict(bw,srch))
       {
       case -1: goto again;
       case 1: if(srch->addr>=0) pgoto(bw->cursor,srch->addr); return 1;
--- 553,559 ----
    else if(srch->repeat!= -1)
     {
     if(srch->valid)
!     switch(restricted(bw,srch))
       {
       case -1: goto again;
       case 1: if(srch->addr>=0) pgoto(bw->cursor,srch->addr); return 1;
***************
*** 582,588 ****
    case 1:
    bye: if(!srch->flg && !srch->rest)
     {
!    if(srch->valid && srch->restrict)
      msgnw(bw,"Not found (search restricted to marked block)");
     else msgnw(bw,"Not found");
     ret= -1;
--- 582,588 ----
    case 1:
    bye: if(!srch->flg && !srch->rest)
     {
!    if(srch->valid && srch->restricted)
      msgnw(bw,"Not found (search restricted to marked block)");
     else msgnw(bw,"Not found");
     ret= -1;
***************
*** 591,597 ****
  
    case 2:
    if(srch->valid)
!    switch(restrict(bw,srch))
      {
      case -1: goto again;
      case 1: if(srch->addr>=0) pgoto(bw->cursor,srch->addr); goto bye;
--- 591,597 ----
  
    case 2:
    if(srch->valid)
!    switch(restricted(bw,srch))
      {
      case -1: goto again;
      case 1: if(srch->addr>=0) pgoto(bw->cursor,srch->addr); goto bye;
*** usearch.h.old	Thu Oct 11 10:04:13 2001
--- usearch.h	Thu Oct 11 10:04:29 2001
***************
*** 31,37 ****
   P *markb, *markk;	/* Original marks */
   int valid;		/* Set if original marks are a valid block */
   long addr;		/* Addr of last replacement or -1 for none */
!  int restrict;		/* Search restricted to marked block */
   };
  
  SRCH *mksrch();
--- 31,37 ----
   P *markb, *markk;	/* Original marks */
   int valid;		/* Set if original marks are a valid block */
   long addr;		/* Addr of last replacement or -1 for none */
!  int restricted;	/* Search restricted to marked block */
   };
  
  SRCH *mksrch();

Comment 1 Trond Eivind Glomsrxd 2001-10-19 19:47:16 UTC
Most of those seem present in 2.9.6 as well.

Comment 2 Lon Hohberger 2002-11-05 22:38:42 UTC
We don't have this compiler...  That said, the newer versions of joe don't have
these problems (ie, they have different code where the warnings were produced
which ought not produce the warnings).

I'm closing this as WONTFIX; but you're more than welcome to build 2.9.7 from
source -- which shouldn't exhibit these warnings.