public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (3 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 10/11] Fix strict aliasing Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:16     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 04/11] Remove misleading indentation Peter Foley
                     ` (6 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

GCC 6.0+ can assert that this argument is nonnull.
Remove the unnecessary check to fix a warning.

winsup/cygwin/ChangeLog
malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/malloc_wrapper.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index 43b8144..0db5de8 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -126,8 +126,7 @@ posix_memalign (void **memptr, size_t alignment, size_t bytes)
   __malloc_unlock ();
   if (!res)
     return ENOMEM;
-  if (memptr)
-    *memptr = res;
+  *memptr = res;
   return 0;
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 11/11] respect datarootdir
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
  2016-03-19 17:46   ` [PATCH 07/11] The address of an class always evaluates to true Peter Foley
  2016-03-19 17:46   ` [PATCH 02/11] Remove dead code from fhandler_console Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:49     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 10/11] Fix strict aliasing Peter Foley
                     ` (8 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

Recent versions of autoconf define datadir/infodir in terms of
datarootdir. Add it.

winsup/ChangeLog
* Makefile.in: define datarootdir

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/Makefile.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/Makefile.in b/winsup/Makefile.in
index 29ef22a..1fdf93a 100644
--- a/winsup/Makefile.in
+++ b/winsup/Makefile.in
@@ -33,6 +33,7 @@ endif
 else
 tooldir:=$(exec_prefix)/$(target_alias)
 endif
+datarootdir:=@datarootdir@
 datadir:=@datadir@
 infodir:=@infodir@
 includedir:=@includedir@
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 03/11] Add necessary braces to if statements
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (8 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 06/11] Remove always true nonnull check on "this" pointer Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 10:56     ` Corinna Vinschen
  2016-03-20  9:56   ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Corinna Vinschen
  2016-03-20 10:54   ` Corinna Vinschen
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

The missing braces cause only the first expression to be guarded by the
else clause.

winsup/cygwin/ChangeLog
* fhandler_disk_file.cc (facl): Add missing braces to if statement.
* mount.cc (dos_drive_mappings): Add missing braces to if statement.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/fhandler_disk_file.cc | 3 ++-
 winsup/cygwin/mount.cc              | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 470dae8..2cf738f 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1055,11 +1055,12 @@ cant_access_acl:
 	  case GETACL:
 	    if (!aclbufp)
 	      set_errno(EFAULT);
-	    else
+	    else {
 	      res = getacl (get_stat_handle (), pc, nentries, aclbufp);
 	      /* For this ENOSYS case, see security.cc:get_file_attribute(). */
 	      if (res == -1 && get_errno () == ENOSYS)
 		goto cant_access_acl;
+            }
 	    break;
 	  case GETACLCNT:
 	    res = getacl (get_stat_handle (), pc, 0, NULL);
diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc
index ece8745..22bc49c 100644
--- a/winsup/cygwin/mount.cc
+++ b/winsup/cygwin/mount.cc
@@ -1962,7 +1962,7 @@ dos_drive_mappings::dos_drive_mappings ()
   HANDLE sh = FindFirstVolumeW (vol, 64);
   if (sh == INVALID_HANDLE_VALUE)
     debug_printf ("FindFirstVolumeW, %E");
-  else
+  else {
     do
       {
 	/* Skip drives which are not mounted. */
@@ -2023,6 +2023,7 @@ dos_drive_mappings::dos_drive_mappings ()
       }
     while (FindNextVolumeW (sh, vol, 64));
     FindVolumeClose (sh);
+  }
 }
 
 wchar_t *
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 06/11] Remove always true nonnull check on "this" pointer.
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (7 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 09/11] Add c++14 sized deallocation operator Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-29 20:50     ` Peter Foley
  2016-03-30 11:24     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 03/11] Add necessary braces to if statements Peter Foley
                     ` (2 subsequent siblings)
  11 siblings, 2 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

G++ 6.0 can assert that the this pointer is non-null for member functions.

winsup/cygserver/ChangeLog
process.cc (submission_loop::request_loop): Remove nonnull check on this.
process.cc (sync_wait_array): Ditto.
process.cc (check_and_remove_process): Ditto.
threaded_queue.cc (add_submission_loop): Ditto.
threaded_queue.cc (add): Ditto.
threaded_queue.cc (start): Ditto.
threaded_queue.cc (stop): Ditto.

winsup/cygwin/ChangeLog
fhandler_dsp.cc (Audio_out::buf_info): Remove nonnull check on this.
fhandler_dsp.cc (Audio_in::buf_info): Ditto.
path.cc (fcwd_access_t::Free): Ditto.
pinfo.cc (_pinfo::exists): Ditto.
pinfo.cc (_pinfo::commune_request): Ditto.
pinfo.cc (_pinfo::pipe_fhandler): Ditto.
pinfo.cc (_pinfo::fd): Ditto.
pinfo.cc (_pinfo::fds): Ditto.
pinfo.cc (_pinfo::root): Ditto.
pinfo.cc (_pinfo::cwd): Ditto.
pinfo.cc (_pinfo::cmdline): Ditto.
signal.cc (_pinfo::kill): Ditto.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygserver/process.cc        |  3 ---
 winsup/cygserver/threaded_queue.cc |  4 ----
 winsup/cygwin/fhandler_dsp.cc      |  4 ++--
 winsup/cygwin/path.cc              |  2 +-
 winsup/cygwin/pinfo.cc             | 16 ++++++++--------
 winsup/cygwin/signal.cc            |  2 +-
 6 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc
index d78ca37..d8b2bea 100644
--- a/winsup/cygserver/process.cc
+++ b/winsup/cygserver/process.cc
@@ -174,7 +174,6 @@ process::cleanup ()
 void
 process_cache::submission_loop::request_loop ()
 {
-  assert (this);
   assert (_cache);
   assert (_interrupt_event);
 
@@ -379,7 +378,6 @@ process_cache::wait_for_processes (const HANDLE interrupt_event)
 size_t
 process_cache::sync_wait_array (const HANDLE interrupt_event)
 {
-  assert (this);
   assert (interrupt_event && interrupt_event != INVALID_HANDLE_VALUE);
 
   /* Always reset _cache_add_trigger before filling up the array again. */
@@ -426,7 +424,6 @@ process_cache::sync_wait_array (const HANDLE interrupt_event)
 void
 process_cache::check_and_remove_process (const size_t index)
 {
-  assert (this);
   assert (index < elements (_wait_array) - SPECIALS_COUNT);
 
   class process *const process = _process_array[index];
diff --git a/winsup/cygserver/threaded_queue.cc b/winsup/cygserver/threaded_queue.cc
index ba69e1a..4a4e94c 100644
--- a/winsup/cygserver/threaded_queue.cc
+++ b/winsup/cygserver/threaded_queue.cc
@@ -86,7 +86,6 @@ threaded_queue::~threaded_queue ()
 void
 threaded_queue::add_submission_loop (queue_submission_loop *const submitter)
 {
-  assert (this);
   assert (submitter);
   assert (submitter->_queue == this);
   assert (!submitter->_next);
@@ -159,7 +158,6 @@ threaded_queue::stop ()
 void
 threaded_queue::add (queue_request *const therequest)
 {
-  assert (this);
   assert (therequest);
   assert (!therequest->_next);
 
@@ -317,7 +315,6 @@ queue_submission_loop::~queue_submission_loop ()
 bool
 queue_submission_loop::start ()
 {
-  assert (this);
   assert (!_hThread);
 
   const bool was_running = _running;
@@ -341,7 +338,6 @@ queue_submission_loop::start ()
 bool
 queue_submission_loop::stop ()
 {
-  assert (this);
   assert (_hThread && _hThread != INVALID_HANDLE_VALUE);
 
   const bool was_running = _running;
diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc
index 9fa2c6e..bfdd4c4 100644
--- a/winsup/cygwin/fhandler_dsp.cc
+++ b/winsup/cygwin/fhandler_dsp.cc
@@ -502,7 +502,7 @@ fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
 				       int rate, int bits, int channels)
 {
   p->fragstotal = MAX_BLOCKS;
-  if (this && dev_)
+  if (dev_)
     {
       /* If the device is running we use the internal values,
 	 possibly set from the wave file. */
@@ -959,7 +959,7 @@ fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
 {
   p->fragstotal = MAX_BLOCKS;
   p->fragsize = blockSize (rate, bits, channels);
-  if (this && dev_)
+  if (dev_)
     {
       p->fragments = Qisr2app_->query ();
       if (pHdr_ != NULL)
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 20391bf..df09d70 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3937,7 +3937,7 @@ fcwd_access_t::Free (PVOID heap)
 {
   /* Decrement the reference count.  If it's down to 0, free
      structure from heap. */
-  if (this && InterlockedDecrement (&ReferenceCount ()) == 0)
+  if (InterlockedDecrement (&ReferenceCount ()) == 0)
     {
       /* In contrast to pre-Vista, the handle on init is always a
 	 fresh one and not the handle inherited from the parent
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index be32cfd..409a0b7 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -514,7 +514,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
 bool __reg1
 _pinfo::exists ()
 {
-  return this && process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED));
+  return process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED));
 }
 
 bool
@@ -685,7 +685,7 @@ _pinfo::commune_request (__uint32_t code, ...)
   res.s = NULL;
   res.n = 0;
 
-  if (!this || !pid)
+  if (!pid)
     {
       set_errno (ESRCH);
       goto err;
@@ -783,7 +783,7 @@ out:
 fhandler_pipe *
 _pinfo::pipe_fhandler (int64_t unique_id, size_t &n)
 {
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (pid == myself->pid)
     return NULL;
@@ -796,7 +796,7 @@ char *
 _pinfo::fd (int fd, size_t &n)
 {
   char *s;
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (pid != myself->pid)
     {
@@ -820,7 +820,7 @@ char *
 _pinfo::fds (size_t &n)
 {
   char *s;
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (pid != myself->pid)
     {
@@ -848,7 +848,7 @@ char *
 _pinfo::root (size_t& n)
 {
   char *s;
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (pid != myself->pid && !ISSTATE (this, PID_NOTCYGWIN))
     {
@@ -893,7 +893,7 @@ char *
 _pinfo::cwd (size_t& n)
 {
   char *s = NULL;
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (ISSTATE (this, PID_NOTCYGWIN))
     {
@@ -939,7 +939,7 @@ char *
 _pinfo::cmdline (size_t& n)
 {
   char *s = NULL;
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (ISSTATE (this, PID_NOTCYGWIN))
     {
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 8dfd4ab..c259678 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -263,7 +263,7 @@ _pinfo::kill (siginfo_t& si)
 	}
       this_pid = pid;
     }
-  else if (si.si_signo == 0 && this && process_state == PID_EXITED)
+  else if (si.si_signo == 0 && process_state == PID_EXITED)
     {
       this_process_state = process_state;
       this_pid = pid;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 04/11] Remove misleading indentation
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (4 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 05/11] A pointer to a pointer is nonnull Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:03     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 08/11] Fix typoed comparison Peter Foley
                     ` (5 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

GCC 6.0+ warns on misleading indentation, so fix it.

winsup/cygserver/ChangeLog
* sysv_msg.cc (msgsnd): Fix misleading indentation.
* sysv_msg.cc (msgrcv): Ditto.
* sysv_sem.cc (semop): Ditto.
winsup/cygwing/ChangeLog
* syscalls.cc (getpriority): Fix misleading indentation.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygserver/sysv_msg.cc | 4 ++--
 winsup/cygserver/sysv_sem.cc | 2 +-
 winsup/cygwin/syscalls.cc    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/winsup/cygserver/sysv_msg.cc b/winsup/cygserver/sysv_msg.cc
index 217cc1d..fefc750 100644
--- a/winsup/cygserver/sysv_msg.cc
+++ b/winsup/cygserver/sysv_msg.cc
@@ -736,7 +736,7 @@ msgsnd(struct thread *td, struct msgsnd_args *uap)
 			  if (error != EIDRM)
 #endif /* __CYGWIN__ */
 				error = EINTR;
-				goto done2;
+			  goto done2;
 			}
 
 			/*
@@ -1092,7 +1092,7 @@ msgrcv(struct thread *td, struct msgrcv_args *uap)
 		    if (error != EIDRM)
 #endif /* __CYGWIN__ */
 			error = EINTR;
-			goto done2;
+		    goto done2;
 		}
 
 		/*
diff --git a/winsup/cygserver/sysv_sem.cc b/winsup/cygserver/sysv_sem.cc
index e7ba48b..751190a 100644
--- a/winsup/cygserver/sysv_sem.cc
+++ b/winsup/cygserver/sysv_sem.cc
@@ -1180,7 +1180,7 @@ semop(struct thread *td, struct semop_args *uap)
 		    if (error != EIDRM)
 #endif /* __CYGWIN__ */
 			error = EINTR;
-			goto done2;
+		    goto done2;
 		}
 		DPRINTF(("semop:  good morning!\n"));
 	}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 3dd6af1..15fb8ce 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3838,7 +3838,7 @@ getpriority (int which, id_t who)
 	  case PRIO_USER:
 	    if ((uid_t) who == p->uid && p->nice < nice)
 	      nice = p->nice;
-	      break;
+	    break;
 	  }
     }
 out:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 07/11] The address of an class always evaluates to true
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:17     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 02/11] Remove dead code from fhandler_console Peter Foley
                     ` (10 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

winsup/cygwin/pinfo.cc:465:14: error: the compiler can assume that the
address of 'tc' will always evaluate to 'true' [-Werror=address]

winsup/cygwin/ChangeLog
* pinfo.cc (_pinfo::set_ctty): remove always true check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/pinfo.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 409a0b7..17bf063 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -462,7 +462,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
 {
   tty_min& tc = *fh->tc ();
   debug_printf ("old %s, ctty device number %y, tc.ntty device number %y flags & O_NOCTTY %y", __ctty (), ctty, tc.ntty, flags & O_NOCTTY);
-  if (fh && &tc && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY))
+  if (fh && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY))
     {
       ctty = tc.ntty;
       if (cygheap->ctty != fh->archetype)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address
@ 2016-03-19 17:46 ` Peter Foley
  2016-03-19 17:46   ` [PATCH 07/11] The address of an class always evaluates to true Peter Foley
                     ` (11 more replies)
  0 siblings, 12 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

initial_sp has been unused since commit fbf23e3 back in 2000.
Keep the value, so as to avoid changing the offset of magic_biscuit.

winsup/cygwin/lib/_cygwin_crt0_common.cc:140:52:
error: calling 'void* __builtin_frame_address(unsigned int)' with a
nonzero argument is unsafe [-Werror=frame-address]
   u->initial_sp = (char *) __builtin_frame_address (1);

winsup/cygwin/ChangeLog
lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Initialize initial_sp
with nullptr.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/lib/_cygwin_crt0_common.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc
index 718ce94..96ebeee 100644
--- a/winsup/cygwin/lib/_cygwin_crt0_common.cc
+++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc
@@ -135,9 +135,8 @@ _cygwin_crt0_common (MainFunc f, per_process *u)
   u->premain[3] = cygwin_premain3;
   u->fmode_ptr = &_fmode;
 
-  /* This is used to record what the initial sp was.  The value is needed
-     when copying the parent's stack to the child during a fork.  */
-  u->initial_sp = (char *) __builtin_frame_address (1);
+  /* Unused */
+  u->initial_sp = nullptr;
 
   /* Remember whatever the user linked his application with - or
      point to entries in the dll.  */
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 10/11] Fix strict aliasing
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (2 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 11/11] respect datarootdir Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:34     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 05/11] A pointer to a pointer is nonnull Peter Foley
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

Fix a strict aliasing error detected by gcc 6.0+

winsup/cygwin/ChangeLog
* pinfo.cc (winpids::enum_process): Fix strict aliasing.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/pinfo.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 17bf063..e6ceba8 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -1391,14 +1391,13 @@ winpids::enum_processes (bool winpid)
 	}
 
       PSYSTEM_PROCESS_INFORMATION px = procs;
-      char *&pxc = (char *&)px;
       while (1)
 	{
 	  if (px->UniqueProcessId)
 	    add (nelem, true, (DWORD) (uintptr_t) px->UniqueProcessId);
 	  if (!px->NextEntryOffset)
 	    break;
-	  pxc += px->NextEntryOffset;
+          px = (PSYSTEM_PROCESS_INFORMATION) ((char *) px + px->NextEntryOffset);
 	}
     }
   return nelem;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 02/11] Remove dead code from fhandler_console.
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
  2016-03-19 17:46   ` [PATCH 07/11] The address of an class always evaluates to true Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 10:57     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 11/11] respect datarootdir Peter Foley
                     ` (9 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

This if is unconditionally false, so remove it.

winsup/cygwin/fhandler_console.cc: In member function 'bool dev_console::fillin(HANDLE)':
winsup/cygwin/fhandler_console.cc:740:22: error: self-comparison always evaluates to false [-Werror=tautological-compare]
       if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
           ~~~~~~~~~~~^~~~~~~~~~~~~
winsup/cygwin/fhandler_console.cc:740:50: error: self-comparison always evaluates to false [-Werror=tautological-compare]
       if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
                                       ~~~~~~~~~~~^~~~~~~~~~~~~

winsup/cygwin/ChangeLog
* fhandle_console.cc (fillin): remove dead code

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/fhandler_console.cc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index ef2d1c5..41af223 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -746,8 +746,6 @@ dev_console::fillin (HANDLE h)
     {
       dwWinSize.Y = 1 + b.srWindow.Bottom - b.srWindow.Top;
       dwWinSize.X = 1 + b.srWindow.Right - b.srWindow.Left;
-      if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
-	dwEnd.X = dwEnd.Y = 0;
       if (b.dwCursorPosition.Y > dwEnd.Y
 	  || (b.dwCursorPosition.Y >= dwEnd.Y && b.dwCursorPosition.X > dwEnd.X))
 	dwEnd = b.dwCursorPosition;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (6 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 08/11] Fix typoed comparison Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:28     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 06/11] Remove always true nonnull check on "this" pointer Peter Foley
                     ` (3 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

When compiling with -std=c++14 (the default for gcc 6.0+), the sized
deallocation operator must be defined to prevent undefined symbols when
linking.

winsup/cygwin/ChangeLog:
cxx.cc (operator delete(void *p, size_t)): Define.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/cxx.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/winsup/cygwin/cxx.cc b/winsup/cygwin/cxx.cc
index 0faeaf7..df7491b 100644
--- a/winsup/cygwin/cxx.cc
+++ b/winsup/cygwin/cxx.cc
@@ -29,6 +29,11 @@ operator delete (void *p)
 {
   free (p);
 }
+void
+operator delete (void *p, size_t)
+{
+  ::operator delete(p);
+}
 
 void *
 operator new[] (std::size_t s)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 08/11] Fix typoed comparison
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (5 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 04/11] Remove misleading indentation Peter Foley
@ 2016-03-19 17:46   ` Peter Foley
  2016-03-20 11:20     ` Corinna Vinschen
  2016-03-19 17:46   ` [PATCH 09/11] Add c++14 sized deallocation operator Peter Foley
                     ` (4 subsequent siblings)
  11 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-19 17:46 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

winsup/cygwin/ChangeLog
* thread.cc (semaphore::open): Fix mistaken conditional.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/thread.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 531d6a8..05757ac 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -3746,7 +3746,7 @@ semaphore::open (unsigned long long hash, LUID luid, int fd, int oflag,
   for (semaphore *sema = semaphores.head; sema; sema = sema->next)
     if (sema->fd >= 0 && sema->hash == hash
 	&& sema->luid.HighPart == luid.HighPart
-	&& sema->luid.LowPart == sema->luid.LowPart)
+	&& sema->luid.LowPart == luid.LowPart)
       {
 	wasopen = true;
 	semaphores.mx.unlock ();
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (9 preceding siblings ...)
  2016-03-19 17:46   ` [PATCH 03/11] Add necessary braces to if statements Peter Foley
@ 2016-03-20  9:56   ` Corinna Vinschen
  2016-03-21  1:44     ` Peter Foley
  2016-03-20 10:54   ` Corinna Vinschen
  11 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20  9:56 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

Hi Peter,


thanks for the patch series.  With the exception of patch 6 all of
them are short enough to go in as trivial patches.  However, for 
patch 6 we'd need a copyright assignment from you.  Please have a look
at the "Before you get started" section on https://cygwin.com/contrib.html
There's an assign.txt document you (and potentiall your employer) can
sign and send as PDF.  It's usually rather painless.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                     ` (10 preceding siblings ...)
  2016-03-20  9:56   ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Corinna Vinschen
@ 2016-03-20 10:54   ` Corinna Vinschen
  11 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 10:54 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> initial_sp has been unused since commit fbf23e3 back in 2000.
> Keep the value, so as to avoid changing the offset of magic_biscuit.
> 
> winsup/cygwin/lib/_cygwin_crt0_common.cc:140:52:
> error: calling 'void* __builtin_frame_address(unsigned int)' with a
> nonzero argument is unsafe [-Werror=frame-address]
>    u->initial_sp = (char *) __builtin_frame_address (1);
> 
> winsup/cygwin/ChangeLog
> lib/_cygwin_crt0_common.cc (_cygwin_crt0_common): Initialize initial_sp
> with nullptr.
> 
> Signed-off-by: Peter Foley <pefoley2@pefoley.com>
> ---
>  winsup/cygwin/lib/_cygwin_crt0_common.cc | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc
> index 718ce94..96ebeee 100644
> --- a/winsup/cygwin/lib/_cygwin_crt0_common.cc
> +++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc
> @@ -135,9 +135,8 @@ _cygwin_crt0_common (MainFunc f, per_process *u)
>    u->premain[3] = cygwin_premain3;
>    u->fmode_ptr = &_fmode;
>  
> -  /* This is used to record what the initial sp was.  The value is needed
> -     when copying the parent's stack to the child during a fork.  */
> -  u->initial_sp = (char *) __builtin_frame_address (1);
> +  /* Unused */
> +  u->initial_sp = nullptr;

We're not building in C++11 mode yet.  I fixed that locally to use
NULL instead, which I'd prefer anyway.  Patch applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 03/11] Add necessary braces to if statements
  2016-03-19 17:46   ` [PATCH 03/11] Add necessary braces to if statements Peter Foley
@ 2016-03-20 10:56     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 10:56 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> The missing braces cause only the first expression to be guarded by the
> else clause.
> 
> winsup/cygwin/ChangeLog
> * fhandler_disk_file.cc (facl): Add missing braces to if statement.
> * mount.cc (dos_drive_mappings): Add missing braces to if statement.

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 02/11] Remove dead code from fhandler_console.
  2016-03-19 17:46   ` [PATCH 02/11] Remove dead code from fhandler_console Peter Foley
@ 2016-03-20 10:57     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 10:57 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> This if is unconditionally false, so remove it.
> 
> winsup/cygwin/fhandler_console.cc: In member function 'bool dev_console::fillin(HANDLE)':
> winsup/cygwin/fhandler_console.cc:740:22: error: self-comparison always evaluates to false [-Werror=tautological-compare]
>        if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
>            ~~~~~~~~~~~^~~~~~~~~~~~~
> winsup/cygwin/fhandler_console.cc:740:50: error: self-comparison always evaluates to false [-Werror=tautological-compare]
>        if (b.dwSize.Y != b.dwSize.Y || b.dwSize.X != b.dwSize.X)
>                                        ~~~~~~~~~~~^~~~~~~~~~~~~
> 
> winsup/cygwin/ChangeLog
> * fhandle_console.cc (fillin): remove dead code

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 04/11] Remove misleading indentation
  2016-03-19 17:46   ` [PATCH 04/11] Remove misleading indentation Peter Foley
@ 2016-03-20 11:03     ` Corinna Vinschen
  2016-03-21 17:16       ` [PATCH v2 3/5] " Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:03 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> GCC 6.0+ warns on misleading indentation, so fix it.
> 
> winsup/cygserver/ChangeLog
> * sysv_msg.cc (msgsnd): Fix misleading indentation.
> * sysv_msg.cc (msgrcv): Ditto.
> * sysv_sem.cc (semop): Ditto.
> winsup/cygwing/ChangeLog
> * syscalls.cc (getpriority): Fix misleading indentation.

I only applied the hunk affecting syscalls.cc for now.

The patches to sysv_msg.cc and sysv_sem.cc are not quite right, IMHO.
The GCC warning is rather a problem here.  The indentation is correct
in terms of the original code.  The only reason it's treated as incorrect
is the special handling added in the #ifdef __CYGWIN__ block.  Changing
the indentation just to satisfy the special Cygwin case is not the way
to go.

Ohter than that, partially applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-19 17:46   ` [PATCH 05/11] A pointer to a pointer is nonnull Peter Foley
@ 2016-03-20 11:16     ` Corinna Vinschen
  2016-03-21 14:20       ` Peter Foley
  2016-03-21 16:38       ` Peter Rosin
  0 siblings, 2 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:16 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> GCC 6.0+ can assert that this argument is nonnull.
> Remove the unnecessary check to fix a warning.
> 
> winsup/cygwin/ChangeLog
> malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.

Eh, what?!?  How on earth can gcc assert memptr is always non-NULL?
An application can call posix_memalign(NULL, 4096, 4096) just fine,
can't it?  If so, *memptr = res crashes.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 07/11] The address of an class always evaluates to true
  2016-03-19 17:46   ` [PATCH 07/11] The address of an class always evaluates to true Peter Foley
@ 2016-03-20 11:17     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:17 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> winsup/cygwin/pinfo.cc:465:14: error: the compiler can assume that the
> address of 'tc' will always evaluate to 'true' [-Werror=address]
> 
> winsup/cygwin/ChangeLog
> * pinfo.cc (_pinfo::set_ctty): remove always true check.

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 08/11] Fix typoed comparison
  2016-03-19 17:46   ` [PATCH 08/11] Fix typoed comparison Peter Foley
@ 2016-03-20 11:20     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:20 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 308 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> winsup/cygwin/ChangeLog
> * thread.cc (semaphore::open): Fix mistaken conditional.

Applied.


THanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-19 17:46   ` [PATCH 09/11] Add c++14 sized deallocation operator Peter Foley
@ 2016-03-20 11:28     ` Corinna Vinschen
  2016-03-21 16:35       ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:28 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> When compiling with -std=c++14 (the default for gcc 6.0+), the sized
> deallocation operator must be defined to prevent undefined symbols when
> linking.
> 
> winsup/cygwin/ChangeLog:
> cxx.cc (operator delete(void *p, size_t)): Define.
> 
> Signed-off-by: Peter Foley <pefoley2@pefoley.com>
> ---
>  winsup/cygwin/cxx.cc | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/winsup/cygwin/cxx.cc b/winsup/cygwin/cxx.cc
> index 0faeaf7..df7491b 100644
> --- a/winsup/cygwin/cxx.cc
> +++ b/winsup/cygwin/cxx.cc
> @@ -29,6 +29,11 @@ operator delete (void *p)
>  {
>    free (p);
>  }
> +void
> +operator delete (void *p, size_t)
> +{
> +  ::operator delete(p);
> +}
>  
>  void *
>  operator new[] (std::size_t s)
> -- 
> 2.7.4

This looks incomplete to me.  Don't we have to export the symbol?


Thanks,
Corinna


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 10/11] Fix strict aliasing
  2016-03-19 17:46   ` [PATCH 10/11] Fix strict aliasing Peter Foley
@ 2016-03-20 11:34     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:34 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> Fix a strict aliasing error detected by gcc 6.0+
> 
> winsup/cygwin/ChangeLog
> * pinfo.cc (winpids::enum_process): Fix strict aliasing.

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 11/11] respect datarootdir
  2016-03-19 17:46   ` [PATCH 11/11] respect datarootdir Peter Foley
@ 2016-03-20 11:49     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-20 11:49 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

On Mar 19 13:45, Peter Foley wrote:
> Recent versions of autoconf define datadir/infodir in terms of
> datarootdir. Add it.
> 
> winsup/ChangeLog
> * Makefile.in: define datarootdir

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address
  2016-03-20  9:56   ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Corinna Vinschen
@ 2016-03-21  1:44     ` Peter Foley
  0 siblings, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-21  1:44 UTC (permalink / raw)
  To: cygwin-patches, Peter Foley

On Sun, Mar 20, 2016 at 5:55 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> There's an assign.txt document you (and potentiall your employer) can
> sign and send as PDF.  It's usually rather painless.
>
>
> Thanks,
> Corinna

Copyright assignment form signed and emailed.

Thanks,

Peter Foley

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-20 11:16     ` Corinna Vinschen
@ 2016-03-21 14:20       ` Peter Foley
  2016-03-21 15:05         ` Corinna Vinschen
  2016-03-21 16:38       ` Peter Rosin
  1 sibling, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 14:20 UTC (permalink / raw)
  To: cygwin-patches

On Sun, Mar 20, 2016 at 7:15 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Eh, what?!?  How on earth can gcc assert memptr is always non-NULL?
> An application can call posix_memalign(NULL, 4096, 4096) just fine,
> can't it?  If so, *memptr = res crashes.
>

So, it looks like what's happening is that gcc special-cases
posix_memalign as a builtin function.

See https://github.com/gcc-mirror/gcc/blob/master/gcc/builtins.def#L831

This causes the below warning to be outputted for my testcase:

a.cc:9:25: warning: null argument where non-null required (argument 1)
[-Wnonnull]
     posix_memalign(0,1,1);
                         ^
a.cc: In function ‘int posix_memalign(void**, long unsigned int, long
unsigned int)’:
a.cc:3:3: warning: nonnull argument ‘memptr’ compared to NULL
[-Wnonnull-compare]
   if (memptr)
   ^~

Testcase:

extern "C" posix_memalign(void **memptr, unsigned long, unsigned long) {
  void *a = 0;
  if (memptr)
    *memptr = a;
  return 0;
}

int main() {
    posix_memalign(0,1,1);
}

(Note that passing -fno-builtin causes the warning to go away, as
posix_memalign is no-longer special-cased)

In addition, both newlib and glibc appear to assume the memptr arg is nonnull.
https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c#l5008
https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/sys/linux/malloc.c#l4938

Hope that makes this more understandable.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-21 14:20       ` Peter Foley
@ 2016-03-21 15:05         ` Corinna Vinschen
  2016-03-21 15:52           ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 15:05 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 2001 bytes --]

On Mar 21 10:19, Peter Foley wrote:
> On Sun, Mar 20, 2016 at 7:15 AM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > Eh, what?!?  How on earth can gcc assert memptr is always non-NULL?
> > An application can call posix_memalign(NULL, 4096, 4096) just fine,
> > can't it?  If so, *memptr = res crashes.
> >
> 
> So, it looks like what's happening is that gcc special-cases
> posix_memalign as a builtin function.
> 
> See https://github.com/gcc-mirror/gcc/blob/master/gcc/builtins.def#L831
> 
> This causes the below warning to be outputted for my testcase:
> 
> a.cc:9:25: warning: null argument where non-null required (argument 1)
> [-Wnonnull]
>      posix_memalign(0,1,1);
>                          ^
> a.cc: In function ‘int posix_memalign(void**, long unsigned int, long
> unsigned int)’:
> a.cc:3:3: warning: nonnull argument ‘memptr’ compared to NULL
> [-Wnonnull-compare]
>    if (memptr)
>    ^~
> 
> Testcase:
> 
> extern "C" posix_memalign(void **memptr, unsigned long, unsigned long) {
>   void *a = 0;
>   if (memptr)
>     *memptr = a;
>   return 0;
> }
> 
> int main() {
>     posix_memalign(0,1,1);
> }
> 
> (Note that passing -fno-builtin causes the warning to go away, as
> posix_memalign is no-longer special-cased)
> 
> In addition, both newlib and glibc appear to assume the memptr arg is nonnull.
> https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c#l5008
> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/sys/linux/malloc.c#l4938
> 
> Hope that makes this more understandable.

Yes, but in glibc this is combined with a header disallowing a non-NULL
argument.  This is missing in newlib yet.  I guess this would make the
change acceptable.  Alternatively a __try/__except block in
posix_memalign.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-21 15:05         ` Corinna Vinschen
@ 2016-03-21 15:52           ` Peter Foley
  0 siblings, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-21 15:52 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 11:05 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Yes, but in glibc this is combined with a header disallowing a non-NULL
> argument.  This is missing in newlib yet.  I guess this would make the
> change acceptable.  Alternatively a __try/__except block in
> posix_memalign.

Ah, I'll look into improving the newlib header then.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-20 11:28     ` Corinna Vinschen
@ 2016-03-21 16:35       ` Peter Foley
  2016-03-21 17:13         ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 16:35 UTC (permalink / raw)
  To: cygwin-patches

On Sun, Mar 20, 2016 at 7:28 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> This looks incomplete to me.  Don't we have to export the symbol?

I don't believe so.
As I understand it, if you're overriding the standard c++ delete
implementation, starting with c++14, you also need to provide an
implementation of the sized deallocation operator, which is designed
to increase performance of deallocation if the size of the object to
be deallocated is known.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3663.html
However, the sized deallocation operator can simply be defined as an
call to the original delete operator, which simply preserves the
current behavior.
Adding this definition fixes a whole host of errors like the below:

 /home/peter/cross/src/cygwin/winsup/cygwin/fhandler_disk_file.cc:2373:
undefined reference to `operator delete(void*, unsigned long)'

Hope that makes more sense.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-20 11:16     ` Corinna Vinschen
  2016-03-21 14:20       ` Peter Foley
@ 2016-03-21 16:38       ` Peter Rosin
  2016-03-21 19:49         ` Corinna Vinschen
  1 sibling, 1 reply; 77+ messages in thread
From: Peter Rosin @ 2016-03-21 16:38 UTC (permalink / raw)
  To: cygwin-patches

On 2016-03-20 12:15, Corinna Vinschen wrote:
> On Mar 19 13:45, Peter Foley wrote:
>> GCC 6.0+ can assert that this argument is nonnull.
>> Remove the unnecessary check to fix a warning.
>>
>> winsup/cygwin/ChangeLog
>> malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.
> 
> Eh, what?!?  How on earth can gcc assert memptr is always non-NULL?
> An application can call posix_memalign(NULL, 4096, 4096) just fine,
> can't it?  If so, *memptr = res crashes.

I think that passing NULL qualifies as undefined, in which case the
crash is ok, no?

I'm sure it will misbehave if you pass (void **)1 too. So, some might
argue that the business of special-casing NULL here is questionable.

Or is there some reason to protect the posix_memalign users from
themselves?

Cheers,
Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 16:35       ` Peter Foley
@ 2016-03-21 17:13         ` Corinna Vinschen
  2016-03-21 17:47           ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 17:13 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1374 bytes --]

On Mar 21 12:35, Peter Foley wrote:
> On Sun, Mar 20, 2016 at 7:28 AM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > This looks incomplete to me.  Don't we have to export the symbol?
> 
> I don't believe so.
> As I understand it, if you're overriding the standard c++ delete
> implementation, starting with c++14, you also need to provide an
> implementation of the sized deallocation operator, which is designed
> to increase performance of deallocation if the size of the object to
> be deallocated is known.
> See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3663.html
> However, the sized deallocation operator can simply be defined as an
> call to the original delete operator, which simply preserves the
> current behavior.

But we export these functions as fallback functions to the applications.
See libstdcxx_wrapper.cc and the end of cxx.cc.  While the comment in
cxx.cc claims that this should "not be used in practice", there might be
c++14 code ending up with undefined references to the new delete
operator, isn't it?

https://cygwin.com/ml/cygwin-patches/2009-q3/msg00010.html outlines
why these exports were necessary in the first place.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH v2 3/5] Remove misleading indentation
  2016-03-20 11:03     ` Corinna Vinschen
@ 2016-03-21 17:16       ` Peter Foley
  2016-03-21 19:17         ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 17:16 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

GCC 6.0+ warns on misleading indentation, so fix it.

winsup/cygserver/ChangeLog
* sysv_msg.cc (msgsnd): Fix misleading indentation.
* sysv_msg.cc (msgrcv): Ditto.
* sysv_sem.cc (semop): Ditto.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygserver/sysv_msg.cc | 6 ++++--
 winsup/cygserver/sysv_sem.cc | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/winsup/cygserver/sysv_msg.cc b/winsup/cygserver/sysv_msg.cc
index 217cc1d..9e90d05 100644
--- a/winsup/cygserver/sysv_msg.cc
+++ b/winsup/cygserver/sysv_msg.cc
@@ -733,7 +733,8 @@ msgsnd(struct thread *td, struct msgsnd_args *uap)
 			if (error != 0) {
 				DPRINTF(("msgsnd:  interrupted system call\n"));
 #ifdef __CYGWIN__
-			  if (error != EIDRM)
+			  if (error == EIDRM)
+                              goto done2;
 #endif /* __CYGWIN__ */
 				error = EINTR;
 				goto done2;
@@ -1089,7 +1090,8 @@ msgrcv(struct thread *td, struct msgrcv_args *uap)
 		if (error != 0) {
 			DPRINTF(("msgrcv:  interrupted system call\n"));
 #ifdef __CYGWIN__
-		    if (error != EIDRM)
+		    if (error == EIDRM)
+                        goto done2;
 #endif /* __CYGWIN__ */
 			error = EINTR;
 			goto done2;
diff --git a/winsup/cygserver/sysv_sem.cc b/winsup/cygserver/sysv_sem.cc
index e7ba48b..349322c 100644
--- a/winsup/cygserver/sysv_sem.cc
+++ b/winsup/cygserver/sysv_sem.cc
@@ -1177,7 +1177,8 @@ semop(struct thread *td, struct semop_args *uap)
 		 */
 		if (error != 0) {
 #ifdef __CYGWIN__
-		    if (error != EIDRM)
+		    if (error == EIDRM)
+                        goto done2;
 #endif /* __CYGWIN__ */
 			error = EINTR;
 			goto done2;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 17:16 [PATCH v2 1/5] Add nonnull annotation to posix_memalign Peter Foley
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
@ 2016-03-21 17:16 ` Peter Foley
  2016-03-21 19:25   ` Corinna Vinschen
  2016-03-21 17:16 ` [PATCH 4/5] Don't build utils/lsaauth when cross compiling Peter Foley
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 17:16 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

/home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
undefined reference to `DnsFree'

winsup/cygwin/ChangeLog
Makefile.in: Add libdnsapi to DLL_IMPORTS

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 6695488..5ada7cb 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -149,7 +149,8 @@ EXTRA_OFILES:=
 
 MALLOC_OFILES:=malloc.o
 
-DLL_IMPORTS:=${shell $(CC) -print-file-name=w32api/libkernel32.a} ${shell $(CC) -print-file-name=w32api/libntdll.a}
+DLL_IMPORTS:=${shell $(CC) -print-file-name=w32api/libkernel32.a} ${shell $(CC) -print-file-name=w32api/libntdll.a} ${shell $(CC) -print-file-name=w32api/libdnsapi.a}
+
 
 MT_SAFE_OBJECTS:=
 #
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-21 17:16 [PATCH v2 1/5] Add nonnull annotation to posix_memalign Peter Foley
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
  2016-03-21 17:16 ` [PATCH 2/5] Link against libdnsapi to avoid undefined reference Peter Foley
@ 2016-03-21 17:16 ` Peter Foley
  2016-03-21 19:30   ` Corinna Vinschen
  2016-03-21 17:16 ` [PATCH 5/5] Add with-only-headers Peter Foley
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 17:16 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

Don't require a mingw compiler when bootstrapping a cross toolchain.
Also update some obsolete macros.

winsup/ChangeLog
configure.ac: Only build lsaauth and utils when compiling natively
configure: Regenerate.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/configure    | 11 ++++++++---
 winsup/configure.ac | 16 ++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)
 mode change 100755 => 100644 winsup/configure.ac

diff --git a/winsup/configure b/winsup/configure
index 0887d66..57c3378 100755
--- a/winsup/configure
+++ b/winsup/configure
@@ -680,7 +680,8 @@ CXX
 CXXFLAGS
 CCC
 CPP'
-ac_subdirs_all='cygwin utils cygserver lsaauth doc'
+ac_subdirs_all='utils lsaauth
+cygwin cygserver doc'
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -2092,7 +2093,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3433,9 +3433,14 @@ export CXX
 
 
 
+if test "x$cross_compiling" != xyes; then
+
 
+subdirs="$subdirs utils lsaauth"
+
+fi
 
-subdirs="$subdirs cygwin utils cygserver lsaauth doc"
+subdirs="$subdirs cygwin cygserver doc"
 
 INSTALL_LICENSE="install-license"
 
diff --git a/winsup/configure.ac b/winsup/configure.ac
old mode 100755
new mode 100644
index 43b95c5..ce4f4bb
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -10,9 +10,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin toplevel], 0,
-	cygwin@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin toplevel],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(Makefile.in)
 AC_CONFIG_AUX_DIR(..)
 
@@ -20,7 +19,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -34,11 +33,16 @@ AC_LANG(C++)
 
 AC_CYGWIN_INCLUDES
 
-AC_CONFIG_SUBDIRS(cygwin utils cygserver lsaauth doc)
+if test "x$cross_compiling" != xyes; then
+    AC_CONFIG_SUBDIRS([utils lsaauth])
+fi
+
+AC_CONFIG_SUBDIRS(cygwin cygserver doc)
 INSTALL_LICENSE="install-license"
 
 AC_SUBST(INSTALL_LICENSE)
 
 AC_PROG_MAKE_SET
 
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH v2 1/5] Add nonnull annotation to posix_memalign.
  2016-03-21 15:52           ` Peter Foley
@ 2016-03-21 17:16 Peter Foley
  2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
                   ` (5 more replies)
  -1 siblings, 6 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-21 17:16 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

GCC 6.0+ asserts that the memptr argument to the builtin function
posix_memalign is nonnull.
Add the necessary annotation to the prototype and
remove the now unnecessary check to fix a warning.

newlib/Changelog
newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as
non-null.

winsup/cygwin/ChangeLog
malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 newlib/libc/include/stdlib.h    | 2 +-
 winsup/cygwin/malloc_wrapper.cc | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index f4b2626..7d4ae76 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -253,7 +253,7 @@ int	_EXFUN(_unsetenv_r,(struct _reent *, const char *__string));
 
 #ifdef __rtems__
 #if __POSIX_VISIBLE >= 200112
-int _EXFUN(posix_memalign,(void **, size_t, size_t));
+int _EXFUN(__nonnull (1) posix_memalign,(void **, size_t, size_t));
 #endif
 #endif
 
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index 43b8144..0db5de8 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -126,8 +126,7 @@ posix_memalign (void **memptr, size_t alignment, size_t bytes)
   __malloc_unlock ();
   if (!res)
     return ENOMEM;
-  if (memptr)
-    *memptr = res;
+  *memptr = res;
   return 0;
 }
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 5/5] Add with-only-headers
  2016-03-21 17:16 [PATCH v2 1/5] Add nonnull annotation to posix_memalign Peter Foley
                   ` (2 preceding siblings ...)
  2016-03-21 17:16 ` [PATCH 4/5] Don't build utils/lsaauth when cross compiling Peter Foley
@ 2016-03-21 17:16 ` Peter Foley
  2016-03-21 19:48   ` Corinna Vinschen
  2016-03-21 19:28 ` [PATCH v2 1/5] Add nonnull annotation to posix_memalign Corinna Vinschen
  2016-03-22  1:51 ` Yaakov Selkowitz
  5 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 17:16 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

When cross-compiling a toolchan targeting cygwin, building cygwin1.dll
requires libstdc++v3 to be built.
However, building libstdc++v3 requires the cygwin headers to be
installed.
Work around this circular dependency by adding a --with-only-headers
configure option to only install the headers without trying to build any
libraries.

winsup/ChangeLog
Makefile.in: add special install target for with-only-headers
configure.ac: add with-only-headers option
configure: regenerate
winsup/cygserver/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-only-headers
configure: regenerate
winsup/cygwin/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-only-headers
configure: regenerate

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/Makefile.in            |  5 +++++
 winsup/configure              | 15 ++++++++++++++-
 winsup/configure.ac           |  8 ++++++--
 winsup/cygserver/configure    |  3 ++-
 winsup/cygserver/configure.ac | 12 +++++++-----
 winsup/cygwin/configure       |  3 ++-
 winsup/cygwin/configure.ac    | 14 ++++++++------
 7 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/winsup/Makefile.in b/winsup/Makefile.in
index 1fdf93a..76da977 100644
--- a/winsup/Makefile.in
+++ b/winsup/Makefile.in
@@ -69,7 +69,12 @@ install-license: CYGWIN_LICENSE COPYING
 	  ${INSTALL} $$i $(DESTDIR)$(prefix)/share/doc/Cygwin ; \
 	done
 
+ifeq (@with_only_headers@,yes)
+install: Makefile
+	@${MAKE} -C cygwin install-headers
+else
 install: Makefile $(INSTALL_LICENSE) $(INSTALL_SUBDIRS)
+endif
 
 clean: $(CLEAN_SUBDIRS)
 
diff --git a/winsup/configure b/winsup/configure
index 57c3378..55a5490 100755
--- a/winsup/configure
+++ b/winsup/configure
@@ -596,6 +596,7 @@ cygwin_headers
 newlib_headers
 windows_headers
 windows_libdir
+with_only_headers
 CPP
 ac_ct_CXX
 CXXFLAGS
@@ -665,6 +666,7 @@ target_builddir'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_only_headers
 with_windows_headers
 with_windows_libs
 '
@@ -1294,6 +1296,8 @@ if test -n "$ac_init_help"; then
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-only-headers     only install headers for bootstraping a
+                          cross-compiler
   --with-windows-headers=DIR
                           specify where the windows includes are located
   --with-windows-libs=DIR specify where the windows libraries are located
@@ -3359,6 +3363,13 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+# Check whether --with-only-headers was given.
+if test "${with_only_headers+set}" = set; then :
+  withval=$with_only_headers;
+fi
+
+
+
 
 
 # Check whether --with-windows-headers was given.
@@ -3368,6 +3379,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3386,6 +3398,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
@@ -3433,7 +3446,7 @@ export CXX
 
 
 
-if test "x$cross_compiling" != xyes; then
+if test "x$cross_compiling" != "xyes"; then
 
 
 subdirs="$subdirs utils lsaauth"
diff --git a/winsup/configure.ac b/winsup/configure.ac
index ce4f4bb..01c61dc 100644
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -25,15 +25,19 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_CPP
 AC_LANG(C)
+AC_ARG_WITH([only-headers],[AS_HELP_STRING([--with-only-headers],[only install headers for bootstraping a cross-compiler])])
+AC_SUBST(with_only_headers)
 
 AC_WINDOWS_HEADERS
-AC_WINDOWS_LIBS
+if test "x$with_only_headers" != "xyes"; then
+    AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
 AC_CYGWIN_INCLUDES
 
-if test "x$cross_compiling" != xyes; then
+if test "x$cross_compiling" != "xyes"; then
     AC_CONFIG_SUBDIRS([utils lsaauth])
 fi
 
diff --git a/winsup/cygserver/configure b/winsup/cygserver/configure
index a4feae1..dd8f4de 100755
--- a/winsup/cygserver/configure
+++ b/winsup/cygserver/configure
@@ -2106,7 +2106,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3382,6 +3381,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3400,6 +3400,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/cygserver/configure.ac b/winsup/cygserver/configure.ac
index 4e2cb45..d04c39f 100644
--- a/winsup/cygserver/configure.ac
+++ b/winsup/cygserver/configure.ac
@@ -9,9 +9,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin Cygserver], 0,
-	cygwin@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin Cygserver],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(cygserver.cc)
 AC_CONFIG_AUX_DIR(..)
 
@@ -19,7 +18,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -27,7 +26,9 @@ AC_PROG_CPP
 AC_LANG(C)
 
 AC_WINDOWS_HEADERS
+if test "x$with_only_headers" != "xyes"; then
 AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
@@ -66,4 +67,5 @@ esac
 ])
 
 AC_CONFIGURE_ARGS
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure
index 522fae6..4d6b449 100755
--- a/winsup/cygwin/configure
+++ b/winsup/cygwin/configure
@@ -2117,7 +2117,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3393,6 +3392,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3411,6 +3411,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/cygwin/configure.ac b/winsup/cygwin/configure.ac
index fc7697b..29b1e0c 100644
--- a/winsup/cygwin/configure.ac
+++ b/winsup/cygwin/configure.ac
@@ -10,9 +10,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin DLL], 0,
-	cygwin@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin DLL],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(Makefile.in)
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_AUX_DIR(..)
@@ -21,7 +20,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -29,7 +28,9 @@ AC_PROG_CPP
 AC_LANG(C)
 
 AC_WINDOWS_HEADERS
+if test "x$with_only_headers" != "xyes"; then
 AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
@@ -100,7 +101,7 @@ case "$target_cpu" in
 		DIN_FILE="x86_64.din"
 		TLSOFFSETS_H="tlsoffsets64.h"
 		;;
-   *)		AC_MSG_ERROR(Invalid target processor \"$target_cpu\") ;;
+   *)		AC_MSG_ERROR([Invalid target processor "$target_cpu"]) ;;
 esac
 
 AC_CONFIGURE_ARGS
@@ -110,4 +111,5 @@ AC_SUBST(DLL_ENTRY)
 AC_SUBST(DEF_DLL_ENTRY)
 AC_SUBST(DIN_FILE)
 AC_SUBST(TLSOFFSETS_H)
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 17:13         ` Corinna Vinschen
@ 2016-03-21 17:47           ` Peter Foley
  2016-03-21 18:09             ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 17:47 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 1:13 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> But we export these functions as fallback functions to the applications.
> See libstdcxx_wrapper.cc and the end of cxx.cc.  While the comment in
> cxx.cc claims that this should "not be used in practice", there might be
> c++14 code ending up with undefined references to the new delete
> operator, isn't it?
>
> https://cygwin.com/ml/cygwin-patches/2009-q3/msg00010.html outlines
> why these exports were necessary in the first place.

Ah, I'll look into updating those files as well then.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 17:47           ` Peter Foley
@ 2016-03-21 18:09             ` Corinna Vinschen
  2016-03-21 19:35               ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 18:09 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

On Mar 21 13:46, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 1:13 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > But we export these functions as fallback functions to the applications.
> > See libstdcxx_wrapper.cc and the end of cxx.cc.  While the comment in
> > cxx.cc claims that this should "not be used in practice", there might be
> > c++14 code ending up with undefined references to the new delete
> > operator, isn't it?
> >
> > https://cygwin.com/ml/cygwin-patches/2009-q3/msg00010.html outlines
> > why these exports were necessary in the first place.
> 
> Ah, I'll look into updating those files as well then.

I realized that your orignal patch isn't invalidated by this so I tried
to apply it and we could then add the other stuff later.  However, it
doesn't compile due to a warning, and since we're always building with
-Werror...

[...]/cxx.cc:33:1: error: ‘void operator delete(void*, size_t)’ is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Werror=c++14-compat]
 operator delete (void *p, size_t)
 ^
cc1plus: all warnings being treated as errors

I'm not sure it's the right thing to switch to C++14 by default using
gcc 5.3 yet.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2 3/5] Remove misleading indentation
  2016-03-21 17:16       ` [PATCH v2 3/5] " Peter Foley
@ 2016-03-21 19:17         ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:17 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

On Mar 21 13:15, Peter Foley wrote:
> GCC 6.0+ warns on misleading indentation, so fix it.
> 
> winsup/cygserver/ChangeLog
> * sysv_msg.cc (msgsnd): Fix misleading indentation.
> * sysv_msg.cc (msgrcv): Ditto.
> * sysv_sem.cc (semop): Ditto.

Patch applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 17:16 ` [PATCH 2/5] Link against libdnsapi to avoid undefined reference Peter Foley
@ 2016-03-21 19:25   ` Corinna Vinschen
  2016-03-21 19:46     ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:25 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On Mar 21 13:15, Peter Foley wrote:
> /home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
> undefined reference to `DnsFree'
> 
> winsup/cygwin/ChangeLog
> Makefile.in: Add libdnsapi to DLL_IMPORTS

Apart from the fact that this is wrong and DnsFree should be added to
autoload.cc instead, what exactly is that patch fixing?  DnsFree isn't
used anywhere in Cygwin.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2 1/5] Add nonnull annotation to posix_memalign.
  2016-03-21 17:16 [PATCH v2 1/5] Add nonnull annotation to posix_memalign Peter Foley
                   ` (3 preceding siblings ...)
  2016-03-21 17:16 ` [PATCH 5/5] Add with-only-headers Peter Foley
@ 2016-03-21 19:28 ` Corinna Vinschen
  2016-03-22  1:51 ` Yaakov Selkowitz
  5 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:28 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

On Mar 21 13:15, Peter Foley wrote:
> GCC 6.0+ asserts that the memptr argument to the builtin function
> posix_memalign is nonnull.
> Add the necessary annotation to the prototype and
> remove the now unnecessary check to fix a warning.
> 
> newlib/Changelog
> newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as
> non-null.
> 
> winsup/cygwin/ChangeLog
> malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-21 17:16 ` [PATCH 4/5] Don't build utils/lsaauth when cross compiling Peter Foley
@ 2016-03-21 19:30   ` Corinna Vinschen
  2016-03-21 19:52     ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:30 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On Mar 21 13:15, Peter Foley wrote:
> Don't require a mingw compiler when bootstrapping a cross toolchain.

I'm not sure this is the right thing to do.  I'm cross compiling
Cygwin all the time, and I certainly need the mingw compiler to
build the utils and lsaauth dir.  In what case do you not need them,
and shouldn't that bordercase(?) be handled by some configure option?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 18:09             ` Corinna Vinschen
@ 2016-03-21 19:35               ` Peter Foley
  2016-03-21 19:55                 ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 19:35 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 2:09 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> I realized that your orignal patch isn't invalidated by this so I tried
> to apply it and we could then add the other stuff later.  However, it
> doesn't compile due to a warning, and since we're always building with
> -Werror...
>
> [...]/cxx.cc:33:1: error: ‘void operator delete(void*, size_t)’ is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Werror=c++14-compat]
>  operator delete (void *p, size_t)
>  ^
> cc1plus: all warnings being treated as errors
>
> I'm not sure it's the right thing to switch to C++14 by default using
> gcc 5.3 yet.

Ah, in that case, a better solution might be to drop this patch and
add an explicit -std= to the Makefile.
In that case, Cygwin won't have any issues when the default changes to
c++14 in gcc 6.0
I'm not sure what level of -std would be appropriate by default though.

Thanks,

Peter Foley

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 19:25   ` Corinna Vinschen
@ 2016-03-21 19:46     ` Peter Foley
  2016-03-21 19:52       ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 19:46 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:24 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> On Mar 21 13:15, Peter Foley wrote:
>> /home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
>> undefined reference to `DnsFree'
>>
>> winsup/cygwin/ChangeLog
>> Makefile.in: Add libdnsapi to DLL_IMPORTS
>
> Apart from the fact that this is wrong and DnsFree should be added to
> autoload.cc instead, what exactly is that patch fixing?  DnsFree isn't
> used anywhere in Cygwin.

This fixes the above link error when building cygwin0.dll as part of a
cross toolchain.

The issue appears to be caused by this change in the mingw headers.
It probably won't show up for anybody not building against the latest
git version of mingw untill the next release.
https://github.com/mirror/mingw-w64/commit/38410a

I assume this function should still be added to autoload.cc, rather
then modifying DLL_IMPORTS.
I'll take a look at that.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 17:16 ` [PATCH 5/5] Add with-only-headers Peter Foley
@ 2016-03-21 19:48   ` Corinna Vinschen
  2016-03-21 19:59     ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:48 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

On Mar 21 13:15, Peter Foley wrote:
> When cross-compiling a toolchan targeting cygwin, building cygwin1.dll
> requires libstdc++v3 to be built.

Building cygwin1.dll doesn't require libstdc++-v3.  The Cygwin DLL is
never linked against it and never will be.  Only building the utils dir
requires libstdc++ and that would be fixed by not builing utils as in
your other patch, wouldn't it?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 05/11] A pointer to a pointer is nonnull.
  2016-03-21 16:38       ` Peter Rosin
@ 2016-03-21 19:49         ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:49 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

On Mar 21 17:37, Peter Rosin wrote:
> On 2016-03-20 12:15, Corinna Vinschen wrote:
> > On Mar 19 13:45, Peter Foley wrote:
> >> GCC 6.0+ can assert that this argument is nonnull.
> >> Remove the unnecessary check to fix a warning.
> >>
> >> winsup/cygwin/ChangeLog
> >> malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.
> > 
> > Eh, what?!?  How on earth can gcc assert memptr is always non-NULL?
> > An application can call posix_memalign(NULL, 4096, 4096) just fine,
> > can't it?  If so, *memptr = res crashes.
> 
> I think that passing NULL qualifies as undefined, in which case the
> crash is ok, no?
> 
> I'm sure it will misbehave if you pass (void **)1 too. So, some might
> argue that the business of special-casing NULL here is questionable.

You have a point there.  I applied v2 of Peter's patch so that
should be ok now.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 19:46     ` Peter Foley
@ 2016-03-21 19:52       ` Corinna Vinschen
  2016-03-21 20:04         ` Peter Foley
  2016-03-21 20:19         ` Peter Foley
  0 siblings, 2 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:52 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

On Mar 21 15:45, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 3:24 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > On Mar 21 13:15, Peter Foley wrote:
> >> /home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
> >> undefined reference to `DnsFree'
> >>
> >> winsup/cygwin/ChangeLog
> >> Makefile.in: Add libdnsapi to DLL_IMPORTS
> >
> > Apart from the fact that this is wrong and DnsFree should be added to
> > autoload.cc instead, what exactly is that patch fixing?  DnsFree isn't
> > used anywhere in Cygwin.
> 
> This fixes the above link error when building cygwin0.dll as part of a
> cross toolchain.
> 
> The issue appears to be caused by this change in the mingw headers.
> It probably won't show up for anybody not building against the latest
> git version of mingw untill the next release.
> https://github.com/mirror/mingw-w64/commit/38410a
> 
> I assume this function should still be added to autoload.cc, rather
> then modifying DLL_IMPORTS.
> I'll take a look at that.

While you're at it, ideally we make ourselves independent of the MingW
header version and use DnsFree directly, replacing DnsRecordListFree
in autoload.cc and libc/minires-os-if.c, no?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-21 19:30   ` Corinna Vinschen
@ 2016-03-21 19:52     ` Peter Foley
  2016-03-21 19:58       ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 19:52 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:30 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> I'm not sure this is the right thing to do.  I'm cross compiling
> Cygwin all the time, and I certainly need the mingw compiler to
> build the utils and lsaauth dir.  In what case do you not need them,
> and shouldn't that bordercase(?) be handled by some configure option?

The effect of this change is to not compile anything under the utils
or lsaauth directories when cross compiling.
The idea is that the code under these directories is unnecessary for a
cross toolchain, so if we only build those dirs
when compiling natively, then a mingw toolchain is no longer a
pre-requisite for building a cross Cygwin toolchain.
If there is an instance where you're building a cross toolchain, but
still want the utils, it might make sense to add a
flag, rather then checking $cross_compiling, but I can't think of one
off the top of my head.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 19:35               ` Peter Foley
@ 2016-03-21 19:55                 ` Corinna Vinschen
  2016-03-21 20:04                   ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:55 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]

On Mar 21 15:34, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 2:09 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > I realized that your orignal patch isn't invalidated by this so I tried
> > to apply it and we could then add the other stuff later.  However, it
> > doesn't compile due to a warning, and since we're always building with
> > -Werror...
> >
> > [...]/cxx.cc:33:1: error: ‘void operator delete(void*, size_t)’ is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Werror=c++14-compat]
> >  operator delete (void *p, size_t)
> >  ^
> > cc1plus: all warnings being treated as errors
> >
> > I'm not sure it's the right thing to switch to C++14 by default using
> > gcc 5.3 yet.
> 
> Ah, in that case, a better solution might be to drop this patch and
> add an explicit -std= to the Makefile.
> In that case, Cygwin won't have any issues when the default changes to
> c++14 in gcc 6.0

But using -std= when building Cygwin wouldn't change the fact that we
might need this delete anyway for applications built with -std=c++14
or do I miss something?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-21 19:52     ` Peter Foley
@ 2016-03-21 19:58       ` Corinna Vinschen
  2016-03-21 20:00         ` Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 19:58 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

On Mar 21 15:52, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 3:30 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > I'm not sure this is the right thing to do.  I'm cross compiling
> > Cygwin all the time, and I certainly need the mingw compiler to
> > build the utils and lsaauth dir.  In what case do you not need them,
> > and shouldn't that bordercase(?) be handled by some configure option?
> 
> The effect of this change is to not compile anything under the utils
> or lsaauth directories when cross compiling.

Again, I'm cross compiling all the time since I build Cygwin on Linux
for development and package building, and I'm certianly not the only
person doing that.  This is the default case.  Not building utils and
lsaauth is the exception.  Therefore this scenario should be handled
explicitely by a configure flag, not the other way around.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 19:48   ` Corinna Vinschen
@ 2016-03-21 19:59     ` Peter Foley
  2016-03-21 20:32       ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 19:59 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:47 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> On Mar 21 13:15, Peter Foley wrote:
>> When cross-compiling a toolchan targeting cygwin, building cygwin1.dll
>> requires libstdc++v3 to be built.
>
> Building cygwin1.dll doesn't require libstdc++-v3.  The Cygwin DLL is
> never linked against it and never will be.  Only building the utils dir
> requires libstdc++ and that would be fixed by not builing utils as in
> your other patch, wouldn't it?

Sorry for being unclear.
Building cygwin1.dll requires the *headers* from libstdc++-v3.
To run configure-target-libstdc++-v3 (which generates necessary headers
and is a prereq for install-target-libstdc++-v3 which installs those headers),
libgcc must be able to compile. For libgcc to compile, the cygwin headers
must be available.

To summarize, configure-target-libstdc++-v3 depends on all-target-libgcc.
And all-target-libgcc requires the headers from cygwin to be installed.

Hopefully that makes more sense.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-21 19:58       ` Corinna Vinschen
@ 2016-03-21 20:00         ` Peter Foley
  2016-03-22  1:49           ` Yaakov Selkowitz
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 20:00 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:58 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Again, I'm cross compiling all the time since I build Cygwin on Linux
> for development and package building, and I'm certianly not the only
> person doing that.  This is the default case.  Not building utils and
> lsaauth is the exception.  Therefore this scenario should be handled
> explicitely by a configure flag, not the other way around.

Alright, I'll rework this patch to that effect.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 19:52       ` Corinna Vinschen
@ 2016-03-21 20:04         ` Peter Foley
  2016-03-21 20:19         ` Peter Foley
  1 sibling, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-21 20:04 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:52 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> While you're at it, ideally we make ourselves independent of the MingW
> header version and use DnsFree directly, replacing DnsRecordListFree
> in autoload.cc and libc/minires-os-if.c, no?

Alright, I'll work on that.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 19:55                 ` Corinna Vinschen
@ 2016-03-21 20:04                   ` Peter Foley
  2016-03-23 11:07                     ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 20:04 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:55 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> But using -std= when building Cygwin wouldn't change the fact that we
> might need this delete anyway for applications built with -std=c++14
> or do I miss something?

This patch is specifically for building cygwin1.dll
I haven't tested building programs with -std=c++14, but that should
not be affected at all by this patch.
I believe the only reason this issue occurs at all is that cygwin1.dll
explicitly does not link with libstdc++.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 19:52       ` Corinna Vinschen
  2016-03-21 20:04         ` Peter Foley
@ 2016-03-21 20:19         ` Peter Foley
  2016-03-21 20:34           ` Corinna Vinschen
  1 sibling, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 20:19 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 3:52 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> While you're at it, ideally we make ourselves independent of the MingW
> header version and use DnsFree directly, replacing DnsRecordListFree
> in autoload.cc and libc/minires-os-if.c, no?

Hmm, it isn't immediately obvious as to the meaning of the 2nd (n)
parameter to LoadDLLfunc()
How would I go about finding the correct value for the DnsFree function?
Function documentation is at
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682011(v=vs.85).aspx

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 19:59     ` Peter Foley
@ 2016-03-21 20:32       ` Corinna Vinschen
  2016-03-21 20:35         ` Peter Foley
  2016-03-21 21:04         ` Peter Foley
  0 siblings, 2 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 20:32 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

On Mar 21 15:59, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 3:47 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > On Mar 21 13:15, Peter Foley wrote:
> >> When cross-compiling a toolchan targeting cygwin, building cygwin1.dll
> >> requires libstdc++v3 to be built.
> >
> > Building cygwin1.dll doesn't require libstdc++-v3.  The Cygwin DLL is
> > never linked against it and never will be.  Only building the utils dir
> > requires libstdc++ and that would be fixed by not builing utils as in
> > your other patch, wouldn't it?
> 
> Sorry for being unclear.
> Building cygwin1.dll requires the *headers* from libstdc++-v3.

Still hmm at this point.  AFAICS we only need the handful of definitions
for new and delete operators, nothing else.  Is there perhaps a way to
define this stuff by ourselves to avoid any requirement for libstdc++
headers for building the DLL?  Or is that just not feasible?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 2/5] Link against libdnsapi to avoid undefined reference
  2016-03-21 20:19         ` Peter Foley
@ 2016-03-21 20:34           ` Corinna Vinschen
  2016-03-21 20:41             ` [PATCH v2] Use DnsFree instead of deprecated DnsRecordListFree Peter Foley
  0 siblings, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-21 20:34 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

On Mar 21 16:19, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 3:52 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > While you're at it, ideally we make ourselves independent of the MingW
> > header version and use DnsFree directly, replacing DnsRecordListFree
> > in autoload.cc and libc/minires-os-if.c, no?
> 
> Hmm, it isn't immediately obvious as to the meaning of the 2nd (n)
> parameter to LoadDLLfunc()
> How would I go about finding the correct value for the DnsFree function?
> Function documentation is at
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms682011(v=vs.85).aspx

Number of arguments multiplied by 4.  That's just for the 32 bit
WINAPI.  LoadDLLfunc (DnsFree, 8, dnsapi) should do it.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 20:32       ` Corinna Vinschen
@ 2016-03-21 20:35         ` Peter Foley
  2016-03-21 21:04         ` Peter Foley
  1 sibling, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-21 20:35 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 4:32 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Still hmm at this point.  AFAICS we only need the handful of definitions
> for new and delete operators, nothing else.  Is there perhaps a way to
> define this stuff by ourselves to avoid any requirement for libstdc++
> headers for building the DLL?  Or is that just not feasible?

Dunno, I'll look into this a bit more.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH v2] Use DnsFree instead of deprecated DnsRecordListFree
  2016-03-21 20:34           ` Corinna Vinschen
@ 2016-03-21 20:41             ` Peter Foley
  2016-03-23 10:43               ` Corinna Vinschen
  0 siblings, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 20:41 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

The latest version of the mingw headers have been updated to make
DnsRecordListFree an alias of DnsFree when targeting Windows XP or later.
Use DnsFree directly, avoiding the wrapper function.

/home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
undefined reference to `DnsFree'

winsup/cygwin/ChangeLog
autoload.cc: Load DnsFree rather then DnsRecordListFree
libc/minires-os-if.cc (cygwin_query): Use DnsFree rather then DnsRecordListFree

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/autoload.cc          | 2 +-
 winsup/cygwin/libc/minires-os-if.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 422e2c98..9e6184f 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -583,7 +583,7 @@ LoadDLLfunc (AuthzInitializeContextFromToken, 32, authz)
 LoadDLLfunc (AuthzInitializeResourceManager, 24, authz)
 
 LoadDLLfunc (DnsQuery_A, 24, dnsapi)
-LoadDLLfunc (DnsRecordListFree, 8, dnsapi)
+LoadDLLfunc (DnsFree, 8, dnsapi)
 
 LoadDLLfunc (GetAdaptersAddresses, 20, iphlpapi)
 LoadDLLfunc (GetIfEntry, 4, iphlpapi)
diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c
index 8970e1a..5142e30 100644
--- a/winsup/cygwin/libc/minires-os-if.c
+++ b/winsup/cygwin/libc/minires-os-if.c
@@ -286,7 +286,7 @@ static int cygwin_query(res_state statp, const char * DomName, int Class, int Ty
     rr = rr->pNext;
   }
 
-  DnsRecordListFree(pQueryResultsSet, DnsFreeRecordList);
+  DnsFree(pQueryResultsSet, DnsFreeRecordList);
 
   len = ptr - AnsPtr;
 done:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 20:32       ` Corinna Vinschen
  2016-03-21 20:35         ` Peter Foley
@ 2016-03-21 21:04         ` Peter Foley
  2016-03-21 21:30           ` Peter Foley
  1 sibling, 1 reply; 77+ messages in thread
From: Peter Foley @ 2016-03-21 21:04 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 4:32 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Still hmm at this point.  AFAICS we only need the handful of definitions
> for new and delete operators, nothing else.  Is there perhaps a way to
> define this stuff by ourselves to avoid any requirement for libstdc++
> headers for building the DLL?  Or is that just not feasible?

Turns out that building libntdll.a and friends from mingw-w64 also
requires the cygwin headers to be installed.
So this patch is still necessary for configure-target-winsup to
succeed, as it currently requires libntdll.a to exist.
So even if the libstdc++v3 dependency is removed, we still have
mingw-crt depends on cygwin-headers
and cygwin-headers depends on mingw-crt in the current state.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 21:04         ` Peter Foley
@ 2016-03-21 21:30           ` Peter Foley
  2016-03-23 10:44             ` Corinna Vinschen
  2016-03-23 13:34             ` [PATCH 2/3] " Peter Foley
  0 siblings, 2 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-21 21:30 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 5:03 PM, Peter Foley <pefoley2@pefoley.com> wrote:
> On Mon, Mar 21, 2016 at 4:32 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
>> Still hmm at this point.  AFAICS we only need the handful of definitions
>> for new and delete operators, nothing else.  Is there perhaps a way to
>> define this stuff by ourselves to avoid any requirement for libstdc++
>> headers for building the DLL?  Or is that just not feasible?

It is possible to avoid including libstdc++ headers, but since
cygserver.exe links against
libstdc++, we'd still need to build libstdc++, and we still have the
mingw-crt headers dependency.
So I'm not sure there's really any point essentially in-lining part of
libstdc++'s new header so that we
can build without libstdc++.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-21 20:00         ` Peter Foley
@ 2016-03-22  1:49           ` Yaakov Selkowitz
  2016-03-22  4:04             ` Peter Foley
  2016-03-23 13:34             ` [PATCH v2 1/3] Add option to not build mingw programs " Peter Foley
  0 siblings, 2 replies; 77+ messages in thread
From: Yaakov Selkowitz @ 2016-03-22  1:49 UTC (permalink / raw)
  To: cygwin-patches

On 2016-03-21 15:00, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 3:58 PM, Corinna Vinschen wrote:
>> Again, I'm cross compiling all the time since I build Cygwin on Linux
>> for development and package building, and I'm certianly not the only
>> person doing that.  This is the default case.  Not building utils and
>> lsaauth is the exception.  Therefore this scenario should be handled
>> explicitely by a configure flag, not the other way around.
>
> Alright, I'll rework this patch to that effect.

I really don't see the point of this.  I maintain the pseudo-official 
cross toolchains for Cygwin, and I just remove what is not needed for 
cross-compiling from the DESTDIR after install.  This is also a fairly 
common step when building library packages for cross-compiler toolchains.

-- 
Yaakov

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2 1/5] Add nonnull annotation to posix_memalign.
  2016-03-21 17:16 [PATCH v2 1/5] Add nonnull annotation to posix_memalign Peter Foley
                   ` (4 preceding siblings ...)
  2016-03-21 19:28 ` [PATCH v2 1/5] Add nonnull annotation to posix_memalign Corinna Vinschen
@ 2016-03-22  1:51 ` Yaakov Selkowitz
  2016-03-23 10:46   ` Corinna Vinschen
  5 siblings, 1 reply; 77+ messages in thread
From: Yaakov Selkowitz @ 2016-03-22  1:51 UTC (permalink / raw)
  To: cygwin-patches

On 2016-03-21 12:15, Peter Foley wrote:
> GCC 6.0+ asserts that the memptr argument to the builtin function
> posix_memalign is nonnull.
> Add the necessary annotation to the prototype and
> remove the now unnecessary check to fix a warning.
>
> newlib/Changelog
> newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as
> non-null.
>
> winsup/cygwin/ChangeLog
> malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.
>
> Signed-off-by: Peter Foley <pefoley2@pefoley.com>
> ---
>   newlib/libc/include/stdlib.h    | 2 +-
>   winsup/cygwin/malloc_wrapper.cc | 3 +--
>   2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
> index f4b2626..7d4ae76 100644
> --- a/newlib/libc/include/stdlib.h
> +++ b/newlib/libc/include/stdlib.h
> @@ -253,7 +253,7 @@ int	_EXFUN(_unsetenv_r,(struct _reent *, const char *__string));
>
>   #ifdef __rtems__
>   #if __POSIX_VISIBLE >= 200112
> -int _EXFUN(posix_memalign,(void **, size_t, size_t));
> +int _EXFUN(__nonnull (1) posix_memalign,(void **, size_t, size_t));
>   #endif
>   #endif

Note the ifdef __rtems__ there; we have our own posix_memalign 
declaration in winsup/cygwin/include/cygwin/stdlib.h.  Perhaps these 
should be merged?

-- 
Yaakov

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 4/5] Don't build utils/lsaauth when cross compiling.
  2016-03-22  1:49           ` Yaakov Selkowitz
@ 2016-03-22  4:04             ` Peter Foley
  2016-03-23 13:34             ` [PATCH v2 1/3] Add option to not build mingw programs " Peter Foley
  1 sibling, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-22  4:04 UTC (permalink / raw)
  To: cygwin-patches

On Mon, Mar 21, 2016 at 9:49 PM, Yaakov Selkowitz <yselkowitz@cygwin.com> wrote:
> I really don't see the point of this.  I maintain the pseudo-official cross
> toolchains for Cygwin, and I just remove what is not needed for
> cross-compiling from the DESTDIR after install.  This is also a fairly
> common step when building library packages for cross-compiler toolchains.

The point is to allow building a cross-compiler without a hard
dependency on a existing
mingw cross toolchain.
Without this patch, you cannot successfully compile a cross cygwin
toolchain without a working
mingw cross-compiler.
I'll have a re-worked version at some point that is hopefully more acceptable.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2] Use DnsFree instead of deprecated DnsRecordListFree
  2016-03-21 20:41             ` [PATCH v2] Use DnsFree instead of deprecated DnsRecordListFree Peter Foley
@ 2016-03-23 10:43               ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-23 10:43 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 708 bytes --]

On Mar 21 16:41, Peter Foley wrote:
> The latest version of the mingw headers have been updated to make
> DnsRecordListFree an alias of DnsFree when targeting Windows XP or later.
> Use DnsFree directly, avoiding the wrapper function.
> 
> /home/peter/cross/src/cygwin/winsup/cygwin/libc/minires-os-if.c:289:
> undefined reference to `DnsFree'
> 
> winsup/cygwin/ChangeLog
> autoload.cc: Load DnsFree rather then DnsRecordListFree
> libc/minires-os-if.cc (cygwin_query): Use DnsFree rather then DnsRecordListFree

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 5/5] Add with-only-headers
  2016-03-21 21:30           ` Peter Foley
@ 2016-03-23 10:44             ` Corinna Vinschen
  2016-03-23 13:34             ` [PATCH 2/3] " Peter Foley
  1 sibling, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-23 10:44 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

On Mar 21 17:30, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 5:03 PM, Peter Foley <pefoley2@pefoley.com> wrote:
> > On Mon, Mar 21, 2016 at 4:32 PM, Corinna Vinschen
> > <corinna-cygwin@cygwin.com> wrote:
> >> Still hmm at this point.  AFAICS we only need the handful of definitions
> >> for new and delete operators, nothing else.  Is there perhaps a way to
> >> define this stuff by ourselves to avoid any requirement for libstdc++
> >> headers for building the DLL?  Or is that just not feasible?
> 
> It is possible to avoid including libstdc++ headers, but since
> cygserver.exe links against
> libstdc++, we'd still need to build libstdc++, and we still have the
> mingw-crt headers dependency.
> So I'm not sure there's really any point essentially in-lining part of
> libstdc++'s new header so that we
> can build without libstdc++.

Ok.  Thanks for checking.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2 1/5] Add nonnull annotation to posix_memalign.
  2016-03-22  1:51 ` Yaakov Selkowitz
@ 2016-03-23 10:46   ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-23 10:46 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]

On Mar 21 20:51, Yaakov Selkowitz wrote:
> On 2016-03-21 12:15, Peter Foley wrote:
> >GCC 6.0+ asserts that the memptr argument to the builtin function
> >posix_memalign is nonnull.
> >Add the necessary annotation to the prototype and
> >remove the now unnecessary check to fix a warning.
> >
> >newlib/Changelog
> >newlib/libc/include/stdlib.h: Annotate arg to posix_memalign as
> >non-null.
> >
> >winsup/cygwin/ChangeLog
> >malloc_wrapper.cc (posix_memalign): Remove always true nonnull check.
> >
> >Signed-off-by: Peter Foley <pefoley2@pefoley.com>
> >---
> >  newlib/libc/include/stdlib.h    | 2 +-
> >  winsup/cygwin/malloc_wrapper.cc | 3 +--
> >  2 files changed, 2 insertions(+), 3 deletions(-)
> >
> >diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
> >index f4b2626..7d4ae76 100644
> >--- a/newlib/libc/include/stdlib.h
> >+++ b/newlib/libc/include/stdlib.h
> >@@ -253,7 +253,7 @@ int	_EXFUN(_unsetenv_r,(struct _reent *, const char *__string));
> >
> >  #ifdef __rtems__
> >  #if __POSIX_VISIBLE >= 200112
> >-int _EXFUN(posix_memalign,(void **, size_t, size_t));
> >+int _EXFUN(__nonnull (1) posix_memalign,(void **, size_t, size_t));
> >  #endif
> >  #endif
> 
> Note the ifdef __rtems__ there; we have our own posix_memalign declaration
> in winsup/cygwin/include/cygwin/stdlib.h.  Perhaps these should be merged?

Definitely.  Thanks for catching.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 09/11] Add c++14 sized deallocation operator
  2016-03-21 20:04                   ` Peter Foley
@ 2016-03-23 11:07                     ` Corinna Vinschen
  0 siblings, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-23 11:07 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

On Mar 21 16:03, Peter Foley wrote:
> On Mon, Mar 21, 2016 at 3:55 PM, Corinna Vinschen
> <corinna-cygwin@cygwin.com> wrote:
> > But using -std= when building Cygwin wouldn't change the fact that we
> > might need this delete anyway for applications built with -std=c++14
> > or do I miss something?
> 
> This patch is specifically for building cygwin1.dll
> I haven't tested building programs with -std=c++14, but that should
> not be affected at all by this patch.
> I believe the only reason this issue occurs at all is that cygwin1.dll
> explicitly does not link with libstdc++.

I applied the original patch and added a diagnostic pragma to disable
the warning for now.

We definitely have keep in mind that we might have to export this
function at one point for C++14 applications playing dirty tricks.
I seriously wonder if we shoudn't do this proactively.  Again, see
https://cygwin.com/ml/cygwin-patches/2009-q3/msg00010.html for the
reasdon to export the functions at all.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH v2 1/3] Add option to not build mingw programs when cross compiling.
  2016-03-22  1:49           ` Yaakov Selkowitz
  2016-03-22  4:04             ` Peter Foley
@ 2016-03-23 13:34             ` Peter Foley
  2016-03-23 13:34               ` [PATCH 3/3] Use just-built gcc for windres Peter Foley
  2016-03-30 12:11               ` [PATCH v2 1/3] Add option to not build mingw programs when cross compiling Corinna Vinschen
  1 sibling, 2 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-23 13:34 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

Add an option to not require a mingw compiler when bootstrapping a cross toolchain.
Defaults to existing behavior.
Also update some obsolete macros.

winsup/ChangeLog
configure.ac: Add option to skip building programs that require mingw.
configure: Regenerate.

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/configure    | 22 +++++++++++++++++++---
 winsup/configure.ac | 17 +++++++++++------
 2 files changed, 30 insertions(+), 9 deletions(-)
 mode change 100755 => 100644 winsup/configure.ac

diff --git a/winsup/configure b/winsup/configure
index 0887d66..988ce54 100755
--- a/winsup/configure
+++ b/winsup/configure
@@ -665,6 +665,7 @@ target_builddir'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_mingw_progs
 with_windows_headers
 with_windows_libs
 '
@@ -680,7 +681,8 @@ CXX
 CXXFLAGS
 CCC
 CPP'
-ac_subdirs_all='cygwin utils cygserver lsaauth doc'
+ac_subdirs_all='utils lsaauth
+cygwin cygserver doc'
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -1293,6 +1295,8 @@ if test -n "$ac_init_help"; then
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --without-mingw-progs   do not build programs using the mingw toolchain
+                          (useful for cross-compiling)
   --with-windows-headers=DIR
                           specify where the windows includes are located
   --with-windows-libs=DIR specify where the windows libraries are located
@@ -2092,7 +2096,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3359,6 +3362,14 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+# Check whether --with-mingw-progs was given.
+if test "${with_mingw_progs+set}" = set; then :
+  withval=$with_mingw_progs;
+else
+  with_mingw_progs=yes
+fi
+
+
 
 
 # Check whether --with-windows-headers was given.
@@ -3433,9 +3444,14 @@ export CXX
 
 
 
+if test "x$with_mingw_progs" != xyes; then
+
 
+subdirs="$subdirs utils lsaauth"
+
+fi
 
-subdirs="$subdirs cygwin utils cygserver lsaauth doc"
+subdirs="$subdirs cygwin cygserver doc"
 
 INSTALL_LICENSE="install-license"
 
diff --git a/winsup/configure.ac b/winsup/configure.ac
old mode 100755
new mode 100644
index 43b95c5..afa0d42
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -10,9 +10,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin toplevel], 0,
-	cygwin@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin toplevel],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(Makefile.in)
 AC_CONFIG_AUX_DIR(..)
 
@@ -20,12 +19,13 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_CPP
 AC_LANG(C)
+AC_ARG_WITH([mingw-progs],[AS_HELP_STRING([--without-mingw-progs],[do not build programs using the mingw toolchain (useful for cross-compiling)])],[],[with_mingw_progs=yes])
 
 AC_WINDOWS_HEADERS
 AC_WINDOWS_LIBS
@@ -34,11 +34,16 @@ AC_LANG(C++)
 
 AC_CYGWIN_INCLUDES
 
-AC_CONFIG_SUBDIRS(cygwin utils cygserver lsaauth doc)
+if test "x$with_mingw_progs" != xyes; then
+    AC_CONFIG_SUBDIRS([utils lsaauth])
+fi
+
+AC_CONFIG_SUBDIRS(cygwin cygserver doc)
 INSTALL_LICENSE="install-license"
 
 AC_SUBST(INSTALL_LICENSE)
 
 AC_PROG_MAKE_SET
 
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 2/3] Add with-only-headers
  2016-03-21 21:30           ` Peter Foley
  2016-03-23 10:44             ` Corinna Vinschen
@ 2016-03-23 13:34             ` Peter Foley
  1 sibling, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-23 13:34 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

When cross-compiling a toolchan targeting cygwin, building cygwin1.dll
requires libstdc++v3 to be built.
However, building libstdc++v3 requires the cygwin headers to be
installed.
Work around this circular dependency by adding a --with-only-headers
configure option to only install the headers without trying to build any
libraries.

winsup/ChangeLog
Makefile.in: add special install target for with-only-headers
configure.ac: add with-only-headers option
configure: regenerate
winsup/cygserver/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-only-headers
configure: regenerate
winsup/cygwin/ChangeLog
configure.ac: don't check AC_WINDOWS_LIBS when using with-only-headers
configure: regenerate

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/Makefile.in            |  5 +++++
 winsup/configure              | 13 +++++++++++++
 winsup/configure.ac           |  6 +++++-
 winsup/cygserver/configure    |  3 ++-
 winsup/cygserver/configure.ac | 12 +++++++-----
 winsup/cygwin/configure       |  3 ++-
 winsup/cygwin/configure.ac    | 14 ++++++++------
 7 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/winsup/Makefile.in b/winsup/Makefile.in
index 1fdf93a..76da977 100644
--- a/winsup/Makefile.in
+++ b/winsup/Makefile.in
@@ -69,7 +69,12 @@ install-license: CYGWIN_LICENSE COPYING
 	  ${INSTALL} $$i $(DESTDIR)$(prefix)/share/doc/Cygwin ; \
 	done
 
+ifeq (@with_only_headers@,yes)
+install: Makefile
+	@${MAKE} -C cygwin install-headers
+else
 install: Makefile $(INSTALL_LICENSE) $(INSTALL_SUBDIRS)
+endif
 
 clean: $(CLEAN_SUBDIRS)
 
diff --git a/winsup/configure b/winsup/configure
index 988ce54..2cf3775 100755
--- a/winsup/configure
+++ b/winsup/configure
@@ -596,6 +596,7 @@ cygwin_headers
 newlib_headers
 windows_headers
 windows_libdir
+with_only_headers
 CPP
 ac_ct_CXX
 CXXFLAGS
@@ -666,6 +667,7 @@ ac_subst_files=''
 ac_user_opts='
 enable_option_checking
 with_mingw_progs
+with_only_headers
 with_windows_headers
 with_windows_libs
 '
@@ -1297,6 +1299,8 @@ Optional Packages:
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --without-mingw-progs   do not build programs using the mingw toolchain
                           (useful for cross-compiling)
+  --with-only-headers     only install headers for bootstraping a
+                          cross-compiler
   --with-windows-headers=DIR
                           specify where the windows includes are located
   --with-windows-libs=DIR specify where the windows libraries are located
@@ -3370,6 +3374,13 @@ else
 fi
 
 
+# Check whether --with-only-headers was given.
+if test "${with_only_headers+set}" = set; then :
+  withval=$with_only_headers;
+fi
+
+
+
 
 
 # Check whether --with-windows-headers was given.
@@ -3379,6 +3390,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3397,6 +3409,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/configure.ac b/winsup/configure.ac
index afa0d42..cc41d3f 100644
--- a/winsup/configure.ac
+++ b/winsup/configure.ac
@@ -26,9 +26,13 @@ AC_PROG_CXX
 AC_PROG_CPP
 AC_LANG(C)
 AC_ARG_WITH([mingw-progs],[AS_HELP_STRING([--without-mingw-progs],[do not build programs using the mingw toolchain (useful for cross-compiling)])],[],[with_mingw_progs=yes])
+AC_ARG_WITH([only-headers],[AS_HELP_STRING([--with-only-headers],[only install headers for bootstraping a cross-compiler])])
+AC_SUBST(with_only_headers)
 
 AC_WINDOWS_HEADERS
-AC_WINDOWS_LIBS
+if test "x$with_only_headers" != "xyes"; then
+    AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
diff --git a/winsup/cygserver/configure b/winsup/cygserver/configure
index a4feae1..dd8f4de 100755
--- a/winsup/cygserver/configure
+++ b/winsup/cygserver/configure
@@ -2106,7 +2106,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3382,6 +3381,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3400,6 +3400,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/cygserver/configure.ac b/winsup/cygserver/configure.ac
index 4e2cb45..d04c39f 100644
--- a/winsup/cygserver/configure.ac
+++ b/winsup/cygserver/configure.ac
@@ -9,9 +9,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin Cygserver], 0,
-	cygwin@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin Cygserver],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(cygserver.cc)
 AC_CONFIG_AUX_DIR(..)
 
@@ -19,7 +18,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -27,7 +26,9 @@ AC_PROG_CPP
 AC_LANG(C)
 
 AC_WINDOWS_HEADERS
+if test "x$with_only_headers" != "xyes"; then
 AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
@@ -66,4 +67,5 @@ esac
 ])
 
 AC_CONFIGURE_ARGS
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure
index 522fae6..4d6b449 100755
--- a/winsup/cygwin/configure
+++ b/winsup/cygwin/configure
@@ -2117,7 +2117,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3393,6 +3392,7 @@ if test "${with_windows_headers+set}" = set; then :
 fi
 
 
+if test "x$with_only_headers" != "xyes"; then
 
 
 # Check whether --with-windows-libs was given.
@@ -3411,6 +3411,7 @@ fi
 
 
 
+fi
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/winsup/cygwin/configure.ac b/winsup/cygwin/configure.ac
index fc7697b..29b1e0c 100644
--- a/winsup/cygwin/configure.ac
+++ b/winsup/cygwin/configure.ac
@@ -10,9 +10,8 @@ dnl details.
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-AC_PREREQ(2.59)dnl
-AC_INIT([Cygwin DLL], 0,
-	cygwin@cygwin.com, cygwin, https://cygwin.com)
+AC_PREREQ([2.59])
+AC_INIT([Cygwin DLL],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
 AC_CONFIG_SRCDIR(Makefile.in)
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_AUX_DIR(..)
@@ -21,7 +20,7 @@ AC_CONFIG_AUX_DIR(..)
 
 AC_PROG_INSTALL
 AC_NO_EXECUTABLES
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 AC_PROG_CC
 AC_PROG_CXX
@@ -29,7 +28,9 @@ AC_PROG_CPP
 AC_LANG(C)
 
 AC_WINDOWS_HEADERS
+if test "x$with_only_headers" != "xyes"; then
 AC_WINDOWS_LIBS
+fi
 
 AC_LANG(C++)
 
@@ -100,7 +101,7 @@ case "$target_cpu" in
 		DIN_FILE="x86_64.din"
 		TLSOFFSETS_H="tlsoffsets64.h"
 		;;
-   *)		AC_MSG_ERROR(Invalid target processor \"$target_cpu\") ;;
+   *)		AC_MSG_ERROR([Invalid target processor "$target_cpu"]) ;;
 esac
 
 AC_CONFIGURE_ARGS
@@ -110,4 +111,5 @@ AC_SUBST(DLL_ENTRY)
 AC_SUBST(DEF_DLL_ENTRY)
 AC_SUBST(DIN_FILE)
 AC_SUBST(TLSOFFSETS_H)
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 3/3] Use just-built gcc for windres
  2016-03-23 13:34             ` [PATCH v2 1/3] Add option to not build mingw programs " Peter Foley
@ 2016-03-23 13:34               ` Peter Foley
  2016-03-30 12:31                 ` Corinna Vinschen
  2016-03-30 15:07                 ` Corinna Vinschen
  2016-03-30 12:11               ` [PATCH v2 1/3] Add option to not build mingw programs when cross compiling Corinna Vinschen
  1 sibling, 2 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-23 13:34 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

When building cygwin in a combined tree with binutils,
the just-built windres cannot find the just-buit gcc automatically.
Parse the CC env variable to use the correct compiler, rather then
falling back to the build-system's gcc which does not define the proper
preprocessor macros.

winsup/cygwin/ChangeLog
mkvers.sh: Manually specify preprocessor based on $CC

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
---
 winsup/cygwin/mkvers.sh | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/mkvers.sh b/winsup/cygwin/mkvers.sh
index db39087..9136948 100755
--- a/winsup/cygwin/mkvers.sh
+++ b/winsup/cygwin/mkvers.sh
@@ -37,6 +37,25 @@ done
     echo "**** Couldn't open file '$incfile'.  Aborting."
 }
 
+function parse_preproc_flags() {
+  # Since we're manually specifying the preprocessor, pass the default flags normally defined.
+  ccflags="--preprocessor=$1 --preprocessor-arg=-E --preprocessor-arg=-xc-header --define=RC_INVOKED "
+  shift
+  while [ -n "$*" ]; do
+      case "$1" in
+          # We need to be able to find the just-built cc1 binary.
+          -B*)
+            ccflags="$ccflags --preprocessor-arg=$1"
+            ;;
+      esac
+      shift
+  done
+}
+
+parse_preproc_flags $CC
+
+
+
 #
 # Load the current date so we can work on individual fields
 #
@@ -166,4 +185,4 @@ fi
 
 echo "Version $cygwin_ver"
 set -$- $builddate
-$windres $iflags --define CYGWIN_BUILD_DATE="$1" --define CYGWIN_BUILD_TIME="$2" --define CYGWIN_BUILD_YEAR=$y --define CYGWIN_VERSION='"'"$cygwin_ver"'"' $rcfile winver.o
+$windres $iflags $ccflags --define CYGWIN_BUILD_DATE="$1" --define CYGWIN_BUILD_TIME="$2" --define CYGWIN_BUILD_YEAR=$y --define CYGWIN_VERSION='"'"$cygwin_ver"'"' $rcfile winver.o
-- 
2.7.4

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 06/11] Remove always true nonnull check on "this" pointer.
  2016-03-19 17:46   ` [PATCH 06/11] Remove always true nonnull check on "this" pointer Peter Foley
@ 2016-03-29 20:50     ` Peter Foley
  2016-03-30 11:24     ` Corinna Vinschen
  1 sibling, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-29 20:50 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Peter Foley

On Sat, Mar 19, 2016 at 1:45 PM, Peter Foley <pefoley2@pefoley.com> wrote:
> G++ 6.0 can assert that the this pointer is non-null for member functions.
>
> winsup/cygserver/ChangeLog
> process.cc (submission_loop::request_loop): Remove nonnull check on this.
> process.cc (sync_wait_array): Ditto.
> process.cc (check_and_remove_process): Ditto.
> threaded_queue.cc (add_submission_loop): Ditto.
> threaded_queue.cc (add): Ditto.
> threaded_queue.cc (start): Ditto.
> threaded_queue.cc (stop): Ditto.
>
> winsup/cygwin/ChangeLog
> fhandler_dsp.cc (Audio_out::buf_info): Remove nonnull check on this.
> fhandler_dsp.cc (Audio_in::buf_info): Ditto.
> path.cc (fcwd_access_t::Free): Ditto.
> pinfo.cc (_pinfo::exists): Ditto.
> pinfo.cc (_pinfo::commune_request): Ditto.
> pinfo.cc (_pinfo::pipe_fhandler): Ditto.
> pinfo.cc (_pinfo::fd): Ditto.
> pinfo.cc (_pinfo::fds): Ditto.
> pinfo.cc (_pinfo::root): Ditto.
> pinfo.cc (_pinfo::cwd): Ditto.
> pinfo.cc (_pinfo::cmdline): Ditto.
> signal.cc (_pinfo::kill): Ditto.
>
> Signed-off-by: Peter Foley <pefoley2@pefoley.com>
> ---
>  winsup/cygserver/process.cc        |  3 ---
>  winsup/cygserver/threaded_queue.cc |  4 ----
>  winsup/cygwin/fhandler_dsp.cc      |  4 ++--
>  winsup/cygwin/path.cc              |  2 +-
>  winsup/cygwin/pinfo.cc             | 16 ++++++++--------
>  winsup/cygwin/signal.cc            |  2 +-
>  6 files changed, 12 insertions(+), 19 deletions(-)

I got the copyright assignment form back, so this can now be reviewed
and hopefully merged.

Thanks,

Peter Foley

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 06/11] Remove always true nonnull check on "this" pointer.
  2016-03-19 17:46   ` [PATCH 06/11] Remove always true nonnull check on "this" pointer Peter Foley
  2016-03-29 20:50     ` Peter Foley
@ 2016-03-30 11:24     ` Corinna Vinschen
  2016-03-30 13:11       ` Peter Foley
  1 sibling, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-30 11:24 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 2619 bytes --]

Hi Peter,

On Mar 19 13:45, Peter Foley wrote:
> G++ 6.0 can assert that the this pointer is non-null for member functions.

Maybe, but if it compains, it's bound to find false positives...

> @@ -502,7 +502,7 @@ fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p,
>  				       int rate, int bits, int channels)
>  {
>    p->fragstotal = MAX_BLOCKS;
> -  if (this && dev_)
> +  if (dev_)
>      {
>        /* If the device is running we use the internal values,
>  	 possibly set from the wave file. */

This is wrong.  fhandler_dev_dsp::Audio_out::buf_info is called from
fhandler_dev_dsp::_ioctl.  An application can call ioctl without
an open audio channel.  If so, audio_out_ may be NULL and the
Audio_out::buf_info method is called with a NULL this pointer..

> @@ -959,7 +959,7 @@ fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p,
>  {
>    p->fragstotal = MAX_BLOCKS;
>    p->fragsize = blockSize (rate, bits, channels);
> -  if (this && dev_)
> +  if (dev_)

Ditto.

>      {
>        p->fragments = Qisr2app_->query ();
>        if (pHdr_ != NULL)
> diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
> index 20391bf..df09d70 100644
> --- a/winsup/cygwin/path.cc
> +++ b/winsup/cygwin/path.cc
> @@ -3937,7 +3937,7 @@ fcwd_access_t::Free (PVOID heap)
>  {
>    /* Decrement the reference count.  If it's down to 0, free
>       structure from heap. */
> -  if (this && InterlockedDecrement (&ReferenceCount ()) == 0)
> +  if (InterlockedDecrement (&ReferenceCount ()) == 0)

Very unlikely, but *fast_cwd_ptr *might be NULL.  Better save than sorry.

>      {
>        /* In contrast to pre-Vista, the handle on init is always a
>  	 fresh one and not the handle inherited from the parent
> diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
> index be32cfd..409a0b7 100644
> --- a/winsup/cygwin/pinfo.cc
> +++ b/winsup/cygwin/pinfo.cc
> @@ -514,7 +514,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
>  bool __reg1
>  _pinfo::exists ()
>  {
> -  return this && process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED));
> +  return process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED));

Assuming a pinfo constructor called like this:

  pinfo p (non_existent_pid);

then p->_procinfo is NULL.  Calling p->exists then calls _pinfo::exists
with a NULL this pointer.  Analog for the other _pinfo methods.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2 1/3] Add option to not build mingw programs when cross compiling.
  2016-03-23 13:34             ` [PATCH v2 1/3] Add option to not build mingw programs " Peter Foley
  2016-03-23 13:34               ` [PATCH 3/3] Use just-built gcc for windres Peter Foley
@ 2016-03-30 12:11               ` Corinna Vinschen
  2016-03-30 13:10                 ` Peter Foley
  1 sibling, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-30 12:11 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

On Mar 23 09:34, Peter Foley wrote:
> Add an option to not require a mingw compiler when bootstrapping a cross toolchain.
> Defaults to existing behavior.
> Also update some obsolete macros.

Applied with changes.  The below check was skewed.

> +if test "x$with_mingw_progs" != xyes; then
> +    AC_CONFIG_SUBDIRS([utils lsaauth])
> +fi

Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 3/3] Use just-built gcc for windres
  2016-03-23 13:34               ` [PATCH 3/3] Use just-built gcc for windres Peter Foley
@ 2016-03-30 12:31                 ` Corinna Vinschen
  2016-03-30 13:09                   ` Peter Foley
  2016-03-30 15:07                 ` Corinna Vinschen
  1 sibling, 1 reply; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-30 12:31 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 794 bytes --]

On Mar 23 09:34, Peter Foley wrote:
> When building cygwin in a combined tree with binutils,
> the just-built windres cannot find the just-buit gcc automatically.
> Parse the CC env variable to use the correct compiler, rather then
> falling back to the build-system's gcc which does not define the proper
> preprocessor macros.
> 
> winsup/cygwin/ChangeLog
> mkvers.sh: Manually specify preprocessor based on $CC

Are you sure this works as desired?  In my standard cross build
environment, the only -B option added here is

  --preprocessor-arg=-B/build/cygwin/x86_64/vanilla/x86_64-pc-cygwin/newlib/

?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 3/3] Use just-built gcc for windres
  2016-03-30 12:31                 ` Corinna Vinschen
@ 2016-03-30 13:09                   ` Peter Foley
  0 siblings, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-30 13:09 UTC (permalink / raw)
  To: cygwin-patches

On Wed, Mar 30, 2016 at 8:31 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Are you sure this works as desired?  In my standard cross build
> environment, the only -B option added here is
>
>   --preprocessor-arg=-B/build/cygwin/x86_64/vanilla/x86_64-pc-cygwin/newlib/

The only case in which -B is needed at all is for an in-tree build.
That is, gcc and winsup are in the same source tree, so CC is set to
something like ./gcc/xgcc.
In that case, the -B is necessary so that gcc knows where to find the
cc1 binary.
If gcc and winsup are built from separate source trees, it isn't an issue.

Thanks,

Peter

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH v2 1/3] Add option to not build mingw programs when cross compiling.
  2016-03-30 12:11               ` [PATCH v2 1/3] Add option to not build mingw programs when cross compiling Corinna Vinschen
@ 2016-03-30 13:10                 ` Peter Foley
  0 siblings, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-30 13:10 UTC (permalink / raw)
  To: cygwin-patches

On Wed, Mar 30, 2016 at 8:11 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Applied with changes.  The below check was skewed.
>
>> +if test "x$with_mingw_progs" != xyes; then
>> +    AC_CONFIG_SUBDIRS([utils lsaauth])
>> +fi

Whoops, good catch.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 06/11] Remove always true nonnull check on "this" pointer.
  2016-03-30 11:24     ` Corinna Vinschen
@ 2016-03-30 13:11       ` Peter Foley
  0 siblings, 0 replies; 77+ messages in thread
From: Peter Foley @ 2016-03-30 13:11 UTC (permalink / raw)
  To: cygwin-patches

On Wed, Mar 30, 2016 at 7:24 AM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Hi Peter,
>
> On Mar 19 13:45, Peter Foley wrote:
>> G++ 6.0 can assert that the this pointer is non-null for member functions.
>
> Maybe, but if it compains, it's bound to find false positives...
>

Alright, I'll take a closer look at this.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 3/3] Use just-built gcc for windres
  2016-03-23 13:34               ` [PATCH 3/3] Use just-built gcc for windres Peter Foley
  2016-03-30 12:31                 ` Corinna Vinschen
@ 2016-03-30 15:07                 ` Corinna Vinschen
  1 sibling, 0 replies; 77+ messages in thread
From: Corinna Vinschen @ 2016-03-30 15:07 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

On Mar 23 09:34, Peter Foley wrote:
> When building cygwin in a combined tree with binutils,
> the just-built windres cannot find the just-buit gcc automatically.
> Parse the CC env variable to use the correct compiler, rather then
> falling back to the build-system's gcc which does not define the proper
> preprocessor macros.
> 
> winsup/cygwin/ChangeLog
> mkvers.sh: Manually specify preprocessor based on $CC

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 77+ messages in thread

end of thread, other threads:[~2016-03-30 15:07 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-21 17:16 [PATCH v2 1/5] Add nonnull annotation to posix_memalign Peter Foley
2016-03-19 17:46 ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Peter Foley
2016-03-19 17:46   ` [PATCH 07/11] The address of an class always evaluates to true Peter Foley
2016-03-20 11:17     ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 02/11] Remove dead code from fhandler_console Peter Foley
2016-03-20 10:57     ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 11/11] respect datarootdir Peter Foley
2016-03-20 11:49     ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 10/11] Fix strict aliasing Peter Foley
2016-03-20 11:34     ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 05/11] A pointer to a pointer is nonnull Peter Foley
2016-03-20 11:16     ` Corinna Vinschen
2016-03-21 14:20       ` Peter Foley
2016-03-21 15:05         ` Corinna Vinschen
2016-03-21 15:52           ` Peter Foley
2016-03-21 16:38       ` Peter Rosin
2016-03-21 19:49         ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 04/11] Remove misleading indentation Peter Foley
2016-03-20 11:03     ` Corinna Vinschen
2016-03-21 17:16       ` [PATCH v2 3/5] " Peter Foley
2016-03-21 19:17         ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 08/11] Fix typoed comparison Peter Foley
2016-03-20 11:20     ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 09/11] Add c++14 sized deallocation operator Peter Foley
2016-03-20 11:28     ` Corinna Vinschen
2016-03-21 16:35       ` Peter Foley
2016-03-21 17:13         ` Corinna Vinschen
2016-03-21 17:47           ` Peter Foley
2016-03-21 18:09             ` Corinna Vinschen
2016-03-21 19:35               ` Peter Foley
2016-03-21 19:55                 ` Corinna Vinschen
2016-03-21 20:04                   ` Peter Foley
2016-03-23 11:07                     ` Corinna Vinschen
2016-03-19 17:46   ` [PATCH 06/11] Remove always true nonnull check on "this" pointer Peter Foley
2016-03-29 20:50     ` Peter Foley
2016-03-30 11:24     ` Corinna Vinschen
2016-03-30 13:11       ` Peter Foley
2016-03-19 17:46   ` [PATCH 03/11] Add necessary braces to if statements Peter Foley
2016-03-20 10:56     ` Corinna Vinschen
2016-03-20  9:56   ` [PATCH 01/11] Remove unused and unsafe call to __builtin_frame_address Corinna Vinschen
2016-03-21  1:44     ` Peter Foley
2016-03-20 10:54   ` Corinna Vinschen
2016-03-21 17:16 ` [PATCH 2/5] Link against libdnsapi to avoid undefined reference Peter Foley
2016-03-21 19:25   ` Corinna Vinschen
2016-03-21 19:46     ` Peter Foley
2016-03-21 19:52       ` Corinna Vinschen
2016-03-21 20:04         ` Peter Foley
2016-03-21 20:19         ` Peter Foley
2016-03-21 20:34           ` Corinna Vinschen
2016-03-21 20:41             ` [PATCH v2] Use DnsFree instead of deprecated DnsRecordListFree Peter Foley
2016-03-23 10:43               ` Corinna Vinschen
2016-03-21 17:16 ` [PATCH 4/5] Don't build utils/lsaauth when cross compiling Peter Foley
2016-03-21 19:30   ` Corinna Vinschen
2016-03-21 19:52     ` Peter Foley
2016-03-21 19:58       ` Corinna Vinschen
2016-03-21 20:00         ` Peter Foley
2016-03-22  1:49           ` Yaakov Selkowitz
2016-03-22  4:04             ` Peter Foley
2016-03-23 13:34             ` [PATCH v2 1/3] Add option to not build mingw programs " Peter Foley
2016-03-23 13:34               ` [PATCH 3/3] Use just-built gcc for windres Peter Foley
2016-03-30 12:31                 ` Corinna Vinschen
2016-03-30 13:09                   ` Peter Foley
2016-03-30 15:07                 ` Corinna Vinschen
2016-03-30 12:11               ` [PATCH v2 1/3] Add option to not build mingw programs when cross compiling Corinna Vinschen
2016-03-30 13:10                 ` Peter Foley
2016-03-21 17:16 ` [PATCH 5/5] Add with-only-headers Peter Foley
2016-03-21 19:48   ` Corinna Vinschen
2016-03-21 19:59     ` Peter Foley
2016-03-21 20:32       ` Corinna Vinschen
2016-03-21 20:35         ` Peter Foley
2016-03-21 21:04         ` Peter Foley
2016-03-21 21:30           ` Peter Foley
2016-03-23 10:44             ` Corinna Vinschen
2016-03-23 13:34             ` [PATCH 2/3] " Peter Foley
2016-03-21 19:28 ` [PATCH v2 1/5] Add nonnull annotation to posix_memalign Corinna Vinschen
2016-03-22  1:51 ` Yaakov Selkowitz
2016-03-23 10:46   ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).