This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] Clean-up indentation in libgfortran/io/write.c


I was trying to clean-up some GCC trees that I have lying around and
realized that the following code clean-up didn't deserve the 1.2Gbytes
of disk space it was taking up :>  A few months ago whilst developing
a patch for libgfortran's io/write.c, I noticed the "creative" indentation
used in that file, but thought it best not to obfuscate the functional
change by lumping it together with the clean-up below.

This change only affects the whitespace indentation at the beginning
of each line and does not address any other style issues in the source
itself.  If someone could confirm that this file should follow the regular
GCC or GNU style guidelines, I may fix some of the remaining issues as a
follow-up.  Indentation, however, should always be consistent independent
of any particular preferred style.

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap" including fortran, and tested with a top-level "make
-k check" with no new failures.  Committed to mainline CVS as obvious.



2004-11-20  Roger Sayle  <roger@eyesopen.com>

	* io/write.c (write_float, list_formatted_write): Fix indentation.


Index: io/write.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/write.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 write.c
*** io/write.c	4 Oct 2004 15:33:18 -0000	1.16
--- io/write.c	21 Nov 2004 03:02:15 -0000
*************** write_float (fnode *f, const char *sourc
*** 649,689 ****
    n = extract_real (source, len);

    if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
!    {
!      res = finite (n);
!      if (res == 0)
!        {
!          nb =  f->u.real.w;
!          p = write_block (nb);
!          if (nb < 3)
!          {
!              memset (p, '*',nb);
!              return;
!          }
!
!          memset(p, ' ', nb);
!          res = !isnan (n);
!          if (res != 0)
!          {
!             if (signbit(n))
!                fin = '-';
!             else
!                fin = '+';
!
!             if (nb > 7)
!                memcpy(p + nb - 8, "Infinity", 8);
!             else
!                memcpy(p + nb - 3, "Inf", 3);
!             if (nb < 8 && nb > 3)
!                p[nb - 4] = fin;
!             else if (nb > 8)
!                p[nb - 9] = fin;
!           }
!          else
!              memcpy(p + nb - 3, "NaN", 3);
!          return;
!        }
!    }

    if (f->format != FMT_G)
      {
--- 649,689 ----
    n = extract_real (source, len);

    if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
!     {
!       res = finite (n);
!       if (res == 0)
! 	{
! 	  nb =  f->u.real.w;
! 	  p = write_block (nb);
! 	  if (nb < 3)
! 	    {
! 	      memset (p, '*',nb);
! 	      return;
! 	    }
!
! 	  memset(p, ' ', nb);
! 	  res = !isnan (n);
! 	  if (res != 0)
! 	    {
! 	      if (signbit(n))
! 		fin = '-';
! 	      else
! 		fin = '+';
!
! 	      if (nb > 7)
! 		memcpy(p + nb - 8, "Infinity", 8);
! 	      else
! 		memcpy(p + nb - 3, "Inf", 3);
! 	      if (nb < 8 && nb > 3)
! 		p[nb - 4] = fin;
! 	      else if (nb > 8)
! 		p[nb - 9] = fin;
! 	    }
! 	  else
! 	    memcpy(p + nb - 3, "NaN", 3);
! 	  return;
! 	}
!     }

    if (f->format != FMT_G)
      {
*************** list_formatted_write (bt type, void *p,
*** 1248,1267 ****
  void
  namelist_write (void)
  {
!    namelist_info * t1, *t2;
!    int len,num;
!    void * p;
!
!    num = 0;
!    write_character("&",1);
!    write_character (ioparm.namelist_name, ioparm.namelist_name_len);
!    write_character("\n",1);

!    if (ionml != NULL)
!      {
!        t1 = ionml;
!        while (t1 != NULL)
!         {
            num ++;
            t2 = t1;
            t1 = t1->next;
--- 1248,1267 ----
  void
  namelist_write (void)
  {
!   namelist_info * t1, *t2;
!   int len,num;
!   void * p;
!
!   num = 0;
!   write_character("&",1);
!   write_character (ioparm.namelist_name, ioparm.namelist_name_len);
!   write_character("\n",1);

!   if (ionml != NULL)
!     {
!       t1 = ionml;
!       while (t1 != NULL)
! 	{
            num ++;
            t2 = t1;
            t1 = t1->next;
*************** namelist_write (void)
*** 1292,1305 ****
              default:
                internal_error ("Bad type for namelist write");
              }
!          write_character(",",1);
!          if (num > 5)
!            {
!               num = 0;
!               write_character("\n",1);
!            }
!         }
!      }
!      write_character("/",1);
!
  }
--- 1292,1304 ----
              default:
                internal_error ("Bad type for namelist write");
              }
! 	  write_character(",",1);
! 	  if (num > 5)
! 	    {
! 	      num = 0;
! 	      write_character("\n",1);
! 	    }
! 	}
!     }
!   write_character("/",1);
  }


Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]