OSDN Git Service

GCC 4.1 fixes.
authorcgf <cgf>
Mon, 17 Jul 2006 19:30:29 +0000 (19:30 +0000)
committercgf <cgf>
Mon, 17 Jul 2006 19:30:29 +0000 (19:30 +0000)
* cygheap.h (cygheap_user): Remove unneeded class names from function
declaration.
* fhandler.h (fhandler_base): Ditto.
(fhandler_dev_floppy): Ditto.
(fhandler_console): Ditto.
* wininfo.h (wininfo): Ditto.
* exceptions.cc (sigpacket::process): Avoid compiler errors about gotos and
initialization.
* fhandler_fifo.cc (fhandler_fifo::open): Ditto.
* fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto.
* mmap.cc (mmap64): Ditto.
* pipe.cc (fhandler_pipe::open): Ditto.
* spawn.cc (spawn_guts): Ditto.
* sec_helper.cc: Fix some comments.
(get_null_sd): Move file-scope static to only function where it is used.

12 files changed:
winsup/cygwin/ChangeLog
winsup/cygwin/cygheap.h
winsup/cygwin/exceptions.cc
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_fifo.cc
winsup/cygwin/fhandler_floppy.cc
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/mmap.cc
winsup/cygwin/pipe.cc
winsup/cygwin/sec_helper.cc
winsup/cygwin/spawn.cc
winsup/cygwin/wininfo.h

index cf8ac0a..fefb7d6 100644 (file)
@@ -1,3 +1,25 @@
+2006-07-17  Christopher Faylor  <cgf@timesys.com>
+
+       GCC 4.1 fixes.
+       * cygheap.h (cygheap_user): Remove unneeded class names from function
+       declaration.
+       * fhandler.h (fhandler_base): Ditto.
+       (fhandler_dev_floppy): Ditto.
+       (fhandler_console): Ditto.
+       * wininfo.h (wininfo): Ditto.
+       * exceptions.cc (sigpacket::process): Avoid compiler errors about gotos
+       and initialization.
+       * fhandler_fifo.cc (fhandler_fifo::open): Ditto.
+       * fhandler_floppy.cc (fhandler_dev_floppy::ioctl): Ditto.
+       * fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto.
+       * mmap.cc (mmap64): Ditto.
+       * pipe.cc (fhandler_pipe::open): Ditto.
+       * spawn.cc (spawn_guts): Ditto.
+
+       * sec_helper.cc: Fix some comments.
+       (get_null_sd): Move file-scope static to only function where it is
+       used.
+
 2006-07-14  Christopher Faylor  <cgf@timesys.com>
 
        * fork.cc (fork): Lock the process before forking to prevent things
index cb18d3d..0afe162 100644 (file)
@@ -216,7 +216,7 @@ public:
       return strcpy (buf, name ());
   }
 
-  const char *cygheap_user::test_uid (char *&, const char *, size_t)
+  const char *test_uid (char *&, const char *, size_t)
     __attribute__ ((regparm (3)));
 };
 
index 12c6e06..e5345f1 100644 (file)
@@ -1118,6 +1118,8 @@ int __stdcall
 sigpacket::process ()
 {
   DWORD continue_now;
+  struct sigaction dummy = global_sigs[SIGSTOP];
+
   if (si.si_signo != SIGCONT)
     continue_now = false;
   else
@@ -1235,7 +1237,6 @@ stop:
   if (ISSTATE (myself, PID_STOPPED))
     goto done;
   handler = (void *) sig_handle_tty_stop;
-  struct sigaction dummy = global_sigs[SIGSTOP];
   thissig = dummy;
 
 dosig:
index 313a655..7b637c8 100644 (file)
@@ -275,7 +275,7 @@ class fhandler_base
     __attribute__ ((regparm (3)));
   int __stdcall fstat_by_handle (struct __stat64 *buf) __attribute__ ((regparm (2)));
   int __stdcall fstat_by_name (struct __stat64 *buf) __attribute__ ((regparm (2)));
-  int fhandler_base::utimes_fs (const struct timeval *) __attribute__ ((regparm (2)));
+  int utimes_fs (const struct timeval *) __attribute__ ((regparm (2)));
   virtual int __stdcall fchmod (mode_t mode) __attribute__ ((regparm (1)));
   virtual int __stdcall fchown (__uid32_t uid, __gid32_t gid) __attribute__ ((regparm (2)));
   virtual int __stdcall facl (int, int, __acl32 *) __attribute__ ((regparm (3)));
@@ -601,7 +601,7 @@ class fhandler_dev_floppy: public fhandler_dev_raw
   IMPLEMENT_STATUS_FLAG (bool, eom_detected)
 
   inline _off64_t get_current_position ();
-  int fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo);
+  int get_drive_info (struct hd_geometry *geo);
 
   BOOL write_file (const void *buf, DWORD to_write, DWORD *written, int *err);
   BOOL read_file (void *buf, DWORD to_read, DWORD *read, int *err);
@@ -928,7 +928,7 @@ class fhandler_console: public fhandler_termios
   static tty_min *get_tty_stuff (int);
   bool is_slow () {return 1;}
   static bool need_invisible ();
-  static bool fhandler_console::has_a () {return !invisible_console;}
+  static bool has_a () {return !invisible_console;}
 };
 
 class fhandler_tty_common: public fhandler_termios
index 8f1a584..aa63152 100644 (file)
@@ -150,6 +150,7 @@ fhandler_fifo::open (int flags, mode_t)
   char mutex[CYG_MAX_PATH];
   char *emutex = mutex + CYG_MAX_PATH;
   char *p, *p1;
+  DWORD resw;
 
   /* Generate a semi-unique name to associate with this fifo but try to ensure
      that it is no larger than CYG_MAX_PATH */
@@ -175,7 +176,7 @@ fhandler_fifo::open (int flags, mode_t)
                                           open an fd. */
   /* FIXME? Need to wait for signal here?
      This shouldn't block for long, but... */
-  DWORD resw = WaitForSingleObject (h, INFINITE);
+  resw = WaitForSingleObject (h, INFINITE);
   lock_process::locker.acquire ();     /* Restore the lock */
   if (resw != WAIT_OBJECT_0 && resw != WAIT_ABANDONED_0)
     {
index 9667235..4595e73 100644 (file)
@@ -506,8 +506,7 @@ fhandler_dev_floppy::ioctl (unsigned int cmd, void *buf)
       /* Just check the restriction that blocksize must be a multiple
         of the sector size of the underlying volume sector size,
         then fall through to fhandler_dev_raw::ioctl. */
-      struct rdop *op = (struct rdop *) buf;
-      if (op->rd_parm % bytes_per_sector)
+      if (((struct rdop *) buf)->rd_parm % bytes_per_sector)
        {
          SetLastError (ERROR_INVALID_PARAMETER);
          __seterrno ();
index 9ecba14..0121d62 100644 (file)
@@ -1021,6 +1021,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
 
   get_ttyp ()->cmd = cmd;
   get_ttyp ()->ioctl_retval = 0;
+  int val;
   switch (cmd)
     {
     case TIOCGWINSZ:
@@ -1052,7 +1053,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
        }
       break;
     case TIOCLINUX:
-      int val = *(unsigned char *) arg;
+      val = *(unsigned char *) arg;
       if (val != 6 || !ioctl_request_event || !ioctl_done_event)
          get_ttyp ()->ioctl_retval = -EINVAL;
       else
index 85718ee..5ace55c 100644 (file)
@@ -977,6 +977,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
   caddr_t base = NULL;
 
   DWORD pagesize = getpagesize ();
+  DWORD checkpagesize;
 
   fh_anonymous.set_io_handle (INVALID_HANDLE_VALUE);
   fh_anonymous.set_access (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE);
@@ -1006,8 +1007,8 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off)
      at least most of the time is, allow 4K aligned addresses in 98,
      to enable remapping of formerly mapped pages.  If no matching
      free pages exist, check addr again, this time for the real alignment. */
-  DWORD checkpagesize = wincap.has_mmap_alignment_bug () ?
-                       getsystempagesize () : pagesize;
+  checkpagesize = wincap.has_mmap_alignment_bug () ?
+                 getsystempagesize () : pagesize;
   if (fixed (flags) && ((uintptr_t) addr % checkpagesize))
     {
       set_errno (EINVAL);
index 183bd18..a6171f2 100644 (file)
@@ -46,6 +46,7 @@ fhandler_pipe::open (int flags, mode_t mode)
   fhandler_pipe *fh = NULL;
   size_t size;
   int pid, rwflags = (flags & O_ACCMODE);
+  bool inh;
 
   sscanf (get_name (), "/proc/%d/fd/pipe:[%d]", &pid, (int *) &pipe_hdl);
   if (pid == myself->pid)
@@ -93,7 +94,7 @@ fhandler_pipe::open (int flags, mode_t mode)
       set_errno (EACCES);
       goto out;
     }
-  bool inh = !(flags & O_NOINHERIT);
+  inh = !(flags & O_NOINHERIT);
   if (!DuplicateHandle (proc, pipe_hdl, hMainProc, &nio_hdl,
                        0, inh, DUPLICATE_SAME_ACCESS))
     {
index d8cd160..a32dcb8 100644 (file)
@@ -443,19 +443,17 @@ set_cygwin_privileges (HANDLE token)
   set_privilege (token, SE_CHANGE_NOTIFY_PRIV, !allow_traverse);
 }
 
-/*
- * Function to return a common SECURITY_DESCRIPTOR * that
- * allows all access.
- */
+/* Function to return a common SECURITY_DESCRIPTOR that
+   allows all access.  */
 
-static NO_COPY SECURITY_DESCRIPTOR *null_sdp = 0;
 
 SECURITY_DESCRIPTOR *__stdcall
 get_null_sd ()
 {
   static NO_COPY SECURITY_DESCRIPTOR sd;
+  static NO_COPY SECURITY_DESCRIPTOR *null_sdp;
 
-  if (null_sdp == 0)
+  if (!null_sdp)
     {
       InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
       SetSecurityDescriptorDacl (&sd, TRUE, 0, FALSE);
@@ -464,11 +462,8 @@ get_null_sd ()
   return null_sdp;
 }
 
-/*
- * Initialize global security attributes.
- *
- * Called from dcrt0.cc (_dll_crt0).
- */
+/* Initialize global security attributes.
+   Called from dcrt0.cc (_dll_crt0).  */
 
 void
 init_global_security ()
index 40a57c0..d1ee321 100644 (file)
@@ -304,6 +304,11 @@ spawn_guts (const char * prog_arg, const char *const *argv,
   path_conv real_path;
   bool reset_sendsig = false;
 
+  const char *runpath;
+  int c_flags;
+  bool wascygexec;
+  cygheap_exec_info *moreinfo;
+
   bool null_app_name = false;
   STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
   int looped = 0;
@@ -326,7 +331,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
   else
     chtype = PROC_EXEC;
 
-  cygheap_exec_info *moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info));
+  moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info));
   moreinfo->old_title = NULL;
 
   /* CreateProcess takes one long string that is the command line (sigh).
@@ -347,7 +352,8 @@ spawn_guts (const char * prog_arg, const char *const *argv,
       goto out;
     }
 
-  bool wascygexec = real_path.iscygexec ();
+
+  wascygexec = real_path.iscygexec ();
   res = newargv.fixup (prog_arg, real_path, ext);
 
   if (res)
@@ -410,7 +416,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
       si.wShowWindow = SW_HIDE;
     }
 
-  int c_flags = GetPriorityClass (hMainProc);
+  c_flags = GetPriorityClass (hMainProc);
   sigproc_printf ("priority class %d", c_flags);
   c_flags |= CREATE_SEPARATE_WOW_VDM;
 
@@ -454,7 +460,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
          || cygheap->fdtab.need_fixup_before ()))
     c_flags |= CREATE_SUSPENDED;
 
-  const char *runpath = null_app_name ? NULL : (const char *) real_path;
+  runpath = null_app_name ? NULL : (const char *) real_path;
 
   syscall_printf ("null_app_name %d (%s, %.9500s)", null_app_name, runpath, one_line.buf);
 
@@ -907,6 +913,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
     {
       char *pgm = NULL;
       char *arg1 = NULL;
+      char *ptr, *buf;
 
       HANDLE h = CreateFile (real_path, GENERIC_READ,
                               FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -927,7 +934,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
            }
          goto err;
        }
-      char *buf = (char *) MapViewOfFile(hm, FILE_MAP_READ, 0, 0, 0);
+      buf = (char *) MapViewOfFile(hm, FILE_MAP_READ, 0, 0, 0);
       CloseHandle (hm);
       if (!buf)
        goto err;
@@ -957,7 +964,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext)
 
       debug_printf ("%s is possibly a script", (char *) real_path);
 
-      char *ptr = buf;
+      ptr = buf;
       if (*ptr++ == '#' && *ptr++ == '!')
        {
          ptr += strspn (ptr, " \t");
index 0247ae9..f67cf9a 100644 (file)
@@ -15,7 +15,7 @@ class wininfo
   static muto _lock;
 public:
   operator HWND ();
-  int __stdcall wininfo::process (HWND, UINT, WPARAM, LPARAM)
+  int __stdcall process (HWND, UINT, WPARAM, LPARAM)
     __attribute__ ((regparm (3)));
   void lock ();
   void release ();