RE: [VOTE] Retirement of stdcxx to the 'Attic'?

2012-02-07 Thread Scott Zhong
I'm voting to keeping this project active.

Scott

-Original Message-
From: William A. Rowe Jr. [mailto:wr...@rowe-clan.net] 
Sent: Thursday, February 02, 2012 9:04 AM
To: dev@stdcxx.apache.org
Subject: [VOTE] Retirement of stdcxx to the 'Attic'?

Fans and contributors,

it appears that the stdcxx project is entirely dormant.  The ASF has launched a 
new 'Attic' project over the past two years, to neatly retire dormant works 
until and unless a community comes along who wishes to revive the effort.

As a simple formality your votes please;

 [ ] +1 - stdcxx committee should be retired, with code sent to the Attic

 [x] -1 - No, stdcxx should not fold, I am still contributing, and
  [would serve|am serving] on its project management committee

The results of this vote will be taken up by the ASF Board of Directors at 
their 15 Feb meeting.


RE: [PATCH] STDCXX-401 test suite should honor TMPDIR

2008-10-21 Thread Scott Zhong
I think I'll use this email [EMAIL PROTECTED]

 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 20, 2008 10:58 PM
 To: dev@stdcxx.apache.org
 Subject: Re: [PATCH] STDCXX-401 test suite should honor TMPDIR
 
 Scott Zhong wrote:
  Changelog:
 
  * tests/src/file.cpp (rw_tmpnam): use TMPDIR variable from
environment
  if defined.
 
 Okay, thanks. Patch committed here:
http://svn.apache.org/viewvc?rev=706515view=rev
 
 FYI: I used your Rogue Wave email address to complete your change
 comment. If that's not what you want listed in the ChangeLog please
 provide an alternate address.
 
 Martin
 
 
  here is the patch:
 
  Index: tests/src/file.cpp
  ===
  --- tests/src/file.cpp  (revision 702657)
  +++ tests/src/file.cpp  (working copy)
  @@ -208,8 +208,13 @@
   #ifndef _RWSTD_NO_MKSTEMP
   #  define TMP_TEMPLATE  tmpfile-XX
 
  +const char *tmpdir = getenv (TMPDIR);
  +if (tmpdir == NULL) {
  +tmpdir = P_tmpdir;
  +}
  +
   if (!buf) {
  -static char fname_buf [sizeof (P_tmpdir) + sizeof
  (TMP_TEMPLATE)];
  +static char fname_buf [PATH_MAX];
 
   buf = fname_buf;
   *buf = '\0';
  @@ -217,13 +222,13 @@
 
   if ('\0' == *buf) {
   // copy the template to the buffer; make sure there is
exactly
  -// one path separator character between P_tmpdir and the
file
  +// one path separator character between tmpdir and the file
   // name template (it doesn't really matter how many there
are
   // as long as it's at least one, but one looks better than
two
   // in diagnostic messages)
  -size_t len = sizeof (P_tmpdir) - 1;
  +size_t len = strlen (tmpdir) - 1;
 
  -memcpy (buf, P_tmpdir, len);
  +memcpy (buf, tmpdir, len);
   if (_RWSTD_PATH_SEP != buf [len - 1])
   buf [len++] = _RWSTD_PATH_SEP;
 
  @@ -251,7 +256,7 @@
   #  ifdef _WIN32
 
   // create a temporary file name
  -char* fname = tempnam (P_tmpdir, .rwtest-tmp);
  +char* fname = tempnam (tmpdir, .rwtest-tmp);
 
   if (fname) {
 
  @@ -272,7 +277,7 @@
   else {
   fprintf (stderr, %s:%d: tempnam(\%s\, \%s\) failed:
%s\n,
__FILE__, __LINE__,
  - P_tmpdir, .rwtest-tmp, strerror (errno));
  + tmpdir, .rwtest-tmp, strerror (errno));
   }
 
   #  else
 



RE: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should honor TMPDIR environment variable

2008-10-14 Thread Scott Zhong
Hi Martin, 

  There are two different file that happens to have the same name that
are affected by my patch. One resides under stdcxx/src/file.cpp and
the other is stdcxx/tests/src/file.cpp. The patch for this issue
resides under the former.  I'll update STDCXX-1019 with this.

http://svn.apache.org/repos/asf/stdcxx/branches/4.2.x/src/file.cpp
http://svn.apache.org/repos/asf/stdcxx/branches/4.2.x/tests/src/file.cpp

I'm not a committer. I don't believe I am able to send the change log.  

 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED]
 Sent: Saturday, October 11, 2008 4:19 PM
 To: dev@stdcxx.apache.org
 Subject: Re: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should honor
 TMPDIR environment variable
 
 Scott Zhong wrote:
  Fix to fnamebuf array size and invoke getenv only once.
 
 The fix looks good to me but I'm having trouble applying the patch.
 You are changing the definition of something called fnamebuf around
 line 260 but there's no string fnamebuf in the file, either on
 trunk or on branches/4.2.x:
 
 $ svn cat

http://svn.apache.org/repos/asf/stdcxx/branches/4.2.x/tests/src/file.cpp
 http://svn.apache.org/repos/asf/stdcxx/trunk/tests/src/file.cpp | grep
 fnamebuf || echo NOT FOUND
 NOT FOUND
 
 Could also send your change log entry with the final patch?
 
 Thanks
 Martin
 
 
  Index: src/file.cpp
  ===
  --- src/file.cpp(revision 702657)
  +++ src/file.cpp(working copy)
  @@ -42,6 +42,7 @@
   #include stdio.h// for P_tmpdir, std{err,in,out}, tmpnam()
   #include stdlib.h   // for mkstemp(), strtoul(), size_t
   #include ctype.h// for isalpha(), isspace(), toupper()
  +#include string.h   // for memcpy()
 
 
   #if defined (_WIN32)  !defined (__CYGWIN__)
  @@ -58,6 +59,9 @@
   #  define _BINARY 0
   #endif
 
  +#ifndef PATH_MAX
  +#  define PATH_MAX   1024
  +#endif
 
   #include rw/_file.h
   #include rw/_defs.h
  @@ -257,8 +261,18 @@
   #define P_tmpdir /tmp
   #  endif   // P_tmpdir
 
  -char fnamebuf[] = P_tmpdir /.rwtmpXX;
  +const char *tmpdir = getenv (TMPDIR);
  +if (tmpdir == NULL) {
  +tmpdir = P_tmpdir;
  +}
 
  +char fnamebuf [PATH_MAX];
  +
  +size_t len = strlen (tmpdir) - 1;
  +
  +memcpy (fnamebuf, tmpdir, len);
  +memcpy (fnamebuf+len, /.rwtmpXX, sizeof
(/.rwtmpXX));
  +
   fd = mkstemp (fnamebuf);
 
   if (fd = 0)
  @@ -294,7 +308,7 @@
   // names that have no extension. tempnam uses malloc to
allocate
   // space for the filename; the program is responsible for
freeing
   // this space when it is no longer needed.
  -char* const fname = tempnam (P_tmpdir, .rwtmp);
  +char* const fname = tempnam (tmpdir, .rwtmp);
 
   if (!fname)
   return -1;
 
  -Original Message-
  From: Scott Zhong [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 08, 2008 11:03 AM
  To: dev@stdcxx.apache.org
  Subject: RE: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should
honor
  TMPDIR environment variable
 
  Posted wrong diff. here is the correct diff
 
  Index: src/file.cpp
  ===
  --- src/file.cpp(revision 702657)
  +++ src/file.cpp(working copy)
  @@ -42,6 +42,7 @@
   #include stdio.h// for P_tmpdir, std{err,in,out}, tmpnam()
   #include stdlib.h   // for mkstemp(), strtoul(), size_t
   #include ctype.h// for isalpha(), isspace(), toupper()
  +#include string.h   // for memcpy()
 
 
   #if defined (_WIN32)  !defined (__CYGWIN__)
  @@ -257,8 +258,15 @@
   #define P_tmpdir /tmp
   #  endif   // P_tmpdir
 
  -char fnamebuf[] = P_tmpdir /.rwtmpXX;
  +char *tmpdir = getenv (TMPDIR) == NULL ? P_tmpdir : getenv
  (TMPDIR);
 
  +char fnamebuf [sizeof (tmpdir) + sizeof (/.rwtmpXX)];
  +
  +size_t len = sizeof (tmpdir) - 1;
  +
  +memcpy (fnamebuf, tmpdir, len);
  +memcpy (fnamebuf+len, /.rwtmpXX, sizeof
(/.rwtmpXX));
  +
   fd = mkstemp (fnamebuf);
 
   if (fd = 0)
  @@ -294,7 +302,7 @@
   // names that have no extension. tempnam uses malloc to
allocate
   // space for the filename; the program is responsible for
freeing
   // this space when it is no longer needed.
  -char* const fname = tempnam (P_tmpdir, .rwtmp);
  +char* const fname = tempnam (tmpdir, .rwtmp);
 
   if (!fname)
   return -1;
 
  -Original Message-
  From: Scott Zhong [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 08, 2008 10:15 AM
  To: dev@stdcxx.apache.org
  Subject: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should honor
  TMPDIR
  environment variable
 
  https://issues.apache.org/jira/browse/STDCXX-1019
 
  file affected: stdcxx/src/file.cpp
 
  Index: src/file.cpp
 
===
  --- src/file.cpp(revision 702657)
  +++ src/file.cpp(working copy)
  @@ -257,7

RE: [PATCH] STDCXX-401 test suite should honor TMPDIR

2008-10-09 Thread Scott Zhong
Hi Farid, thanks for the quick response, here is the new version with
the changes suggested.

Index: tests/src/file.cpp
===
--- tests/src/file.cpp  (revision 702657)
+++ tests/src/file.cpp  (working copy)
@@ -208,8 +208,13 @@
 #ifndef _RWSTD_NO_MKSTEMP
 #  define TMP_TEMPLATE  tmpfile-XX
 
+const char *tmpdir = getenv (TMPDIR);
+if (tmpdir == NULL) { 
+tmpdir = const_castchar(P_tmpdir);
+}
+
 if (!buf) {
-static char fname_buf [sizeof (P_tmpdir) + sizeof
(TMP_TEMPLATE)];
+static char fname_buf [strlen (tmpdir) + sizeof
(TMP_TEMPLATE)];
 
 buf = fname_buf;
 *buf = '\0';
@@ -217,13 +222,13 @@
 
 if ('\0' == *buf) {
 // copy the template to the buffer; make sure there is exactly
-// one path separator character between P_tmpdir and the file
+// one path separator character between tmpdir and the file
 // name template (it doesn't really matter how many there are
 // as long as it's at least one, but one looks better than two
 // in diagnostic messages)
-size_t len = sizeof (P_tmpdir) - 1;
+size_t len = strlen (tmpdir) - 1;
 
-memcpy (buf, P_tmpdir, len);
+memcpy (buf, tmpdir, len);
 if (_RWSTD_PATH_SEP != buf [len - 1])
 buf [len++] = _RWSTD_PATH_SEP;
 
@@ -251,7 +256,7 @@
 #  ifdef _WIN32
 
 // create a temporary file name
-char* fname = tempnam (P_tmpdir, .rwtest-tmp);
+char* fname = tempnam (tmpdir, .rwtest-tmp);
 
 if (fname) {
 
@@ -272,7 +277,7 @@
 else {
 fprintf (stderr, %s:%d: tempnam(\%s\, \%s\) failed: %s\n,
  __FILE__, __LINE__,
- P_tmpdir, .rwtest-tmp, strerror (errno));
+ tmpdir, .rwtest-tmp, strerror (errno));
 }
 
 #  else

 -Original Message-
 From: Farid Zaripov [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 09, 2008 2:20 AM
 To: dev@stdcxx.apache.org
 Subject: Re: [PATCH] STDCXX-401 test suite should honor TMPDIR
 
 Hi Scott.
 
  Index: file.cpp
  ===
  --- file.cpp(revision 702657)
  +++ file.cpp(working copy)
  @@ -208,8 +208,10 @@
   #ifndef _RWSTD_NO_MKSTEMP
   #  define TMP_TEMPLATE  tmpfile-XX
 
  +char *tmpdir = getenv (TMPDIR) == NULL ? P_tmpdir : getenv
 (TMPDIR);
 
   tmpdir might be const char*. And why getenv(TMPDIR) is called
twice?
 
  +
   if (!buf) {
  -static char fname_buf [sizeof (P_tmpdir) + sizeof
 (TMP_TEMPLATE)];
  +static char fname_buf [sizeof (tmpdir) + sizeof
 (TMP_TEMPLATE)];
 
   Here sizeof (tmpdir) != strlen (tmpdir). I think that using here
 PATH_MAX is ok.
 
 [...]
  -size_t len = sizeof (P_tmpdir) - 1;
  +size_t len = sizeof (tmpdir) - 1;
 
   Same.
 
 Farid.


RE: [PATCH] STDCXX-401 test suite should honor TMPDIR

2008-10-09 Thread Scott Zhong
That const_cast isn't suppose to be there.  Here is the correct version:

Index: tests/src/file.cpp
===
--- tests/src/file.cpp  (revision 702657)
+++ tests/src/file.cpp  (working copy)
@@ -208,8 +208,13 @@
 #ifndef _RWSTD_NO_MKSTEMP
 #  define TMP_TEMPLATE  tmpfile-XX
 
+const char *tmpdir = getenv (TMPDIR);
+if (tmpdir == NULL) { 
+tmpdir = P_tmpdir;
+}
+
 if (!buf) {
-static char fname_buf [sizeof (P_tmpdir) + sizeof
(TMP_TEMPLATE)];
+static char fname_buf [strlen (tmpdir) + sizeof
(TMP_TEMPLATE)];
 
 buf = fname_buf;
 *buf = '\0';
@@ -217,13 +222,13 @@
 
 if ('\0' == *buf) {
 // copy the template to the buffer; make sure there is exactly
-// one path separator character between P_tmpdir and the file
+// one path separator character between tmpdir and the file
 // name template (it doesn't really matter how many there are
 // as long as it's at least one, but one looks better than two
 // in diagnostic messages)
-size_t len = sizeof (P_tmpdir) - 1;
+size_t len = strlen (tmpdir) - 1;
 
-memcpy (buf, P_tmpdir, len);
+memcpy (buf, tmpdir, len);
 if (_RWSTD_PATH_SEP != buf [len - 1])
 buf [len++] = _RWSTD_PATH_SEP;
 
@@ -251,7 +256,7 @@
 #  ifdef _WIN32
 
 // create a temporary file name
-char* fname = tempnam (P_tmpdir, .rwtest-tmp);
+char* fname = tempnam (tmpdir, .rwtest-tmp);
 
 if (fname) {
 
@@ -272,7 +277,7 @@
 else {
 fprintf (stderr, %s:%d: tempnam(\%s\, \%s\) failed: %s\n,
  __FILE__, __LINE__,
- P_tmpdir, .rwtest-tmp, strerror (errno));
+ tmpdir, .rwtest-tmp, strerror (errno));
 }
 
 #  else

 -Original Message-
 From: Scott Zhong [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 09, 2008 9:25 AM
 To: dev@stdcxx.apache.org
 Subject: RE: [PATCH] STDCXX-401 test suite should honor TMPDIR
 
 Hi Farid, thanks for the quick response, here is the new version with
 the changes suggested.
 
 Index: tests/src/file.cpp
 ===
 --- tests/src/file.cpp  (revision 702657)
 +++ tests/src/file.cpp  (working copy)
 @@ -208,8 +208,13 @@
  #ifndef _RWSTD_NO_MKSTEMP
  #  define TMP_TEMPLATE  tmpfile-XX
 
 +const char *tmpdir = getenv (TMPDIR);
 +if (tmpdir == NULL) {
 +tmpdir = const_castchar(P_tmpdir);
 +}
 +
  if (!buf) {
 -static char fname_buf [sizeof (P_tmpdir) + sizeof
 (TMP_TEMPLATE)];
 +static char fname_buf [strlen (tmpdir) + sizeof
 (TMP_TEMPLATE)];
 
  buf = fname_buf;
  *buf = '\0';
 @@ -217,13 +222,13 @@
 
  if ('\0' == *buf) {
  // copy the template to the buffer; make sure there is
exactly
 -// one path separator character between P_tmpdir and the file
 +// one path separator character between tmpdir and the file
  // name template (it doesn't really matter how many there are
  // as long as it's at least one, but one looks better than
two
  // in diagnostic messages)
 -size_t len = sizeof (P_tmpdir) - 1;
 +size_t len = strlen (tmpdir) - 1;
 
 -memcpy (buf, P_tmpdir, len);
 +memcpy (buf, tmpdir, len);
  if (_RWSTD_PATH_SEP != buf [len - 1])
  buf [len++] = _RWSTD_PATH_SEP;
 
 @@ -251,7 +256,7 @@
  #  ifdef _WIN32
 
  // create a temporary file name
 -char* fname = tempnam (P_tmpdir, .rwtest-tmp);
 +char* fname = tempnam (tmpdir, .rwtest-tmp);
 
  if (fname) {
 
 @@ -272,7 +277,7 @@
  else {
  fprintf (stderr, %s:%d: tempnam(\%s\, \%s\) failed:
%s\n,
   __FILE__, __LINE__,
 - P_tmpdir, .rwtest-tmp, strerror (errno));
 + tmpdir, .rwtest-tmp, strerror (errno));
  }
 
  #  else
 
  -Original Message-
  From: Farid Zaripov [mailto:[EMAIL PROTECTED]
  Sent: Thursday, October 09, 2008 2:20 AM
  To: dev@stdcxx.apache.org
  Subject: Re: [PATCH] STDCXX-401 test suite should honor TMPDIR
 
  Hi Scott.
 
   Index: file.cpp
  
===
   --- file.cpp(revision 702657)
   +++ file.cpp(working copy)
   @@ -208,8 +208,10 @@
#ifndef _RWSTD_NO_MKSTEMP
#  define TMP_TEMPLATE  tmpfile-XX
  
   +char *tmpdir = getenv (TMPDIR) == NULL ? P_tmpdir : getenv
  (TMPDIR);
 
tmpdir might be const char*. And why getenv(TMPDIR) is called
 twice?
 
   +
if (!buf) {
   -static char fname_buf [sizeof (P_tmpdir) + sizeof
  (TMP_TEMPLATE)];
   +static char fname_buf [sizeof (tmpdir) + sizeof
  (TMP_TEMPLATE)];
 
Here sizeof (tmpdir) != strlen (tmpdir). I think that using here
  PATH_MAX is ok.
 
  [...]
   -size_t len = sizeof (P_tmpdir) - 1;
   +size_t len = sizeof (tmpdir

RE: [PATCH] STDCXX-401 test suite should honor TMPDIR

2008-10-09 Thread Scott Zhong
We need to use PATH_MAX for the fname_buf array size.

Index: tests/src/file.cpp
===
--- tests/src/file.cpp  (revision 702657)
+++ tests/src/file.cpp  (working copy)
@@ -208,8 +208,13 @@
 #ifndef _RWSTD_NO_MKSTEMP
 #  define TMP_TEMPLATE  tmpfile-XX
 
+const char *tmpdir = getenv (TMPDIR);
+if (tmpdir == NULL) { 
+tmpdir = P_tmpdir;
+}
+
 if (!buf) {
-static char fname_buf [sizeof (P_tmpdir) + sizeof
(TMP_TEMPLATE)];
+static char fname_buf [PATH_MAX];
 
 buf = fname_buf;
 *buf = '\0';
@@ -217,13 +222,13 @@
 
 if ('\0' == *buf) {
 // copy the template to the buffer; make sure there is exactly
-// one path separator character between P_tmpdir and the file
+// one path separator character between tmpdir and the file
 // name template (it doesn't really matter how many there are
 // as long as it's at least one, but one looks better than two
 // in diagnostic messages)
-size_t len = sizeof (P_tmpdir) - 1;
+size_t len = strlen (tmpdir) - 1;
 
-memcpy (buf, P_tmpdir, len);
+memcpy (buf, tmpdir, len);
 if (_RWSTD_PATH_SEP != buf [len - 1])
 buf [len++] = _RWSTD_PATH_SEP;
 
@@ -251,7 +256,7 @@
 #  ifdef _WIN32
 
 // create a temporary file name
-char* fname = tempnam (P_tmpdir, .rwtest-tmp);
+char* fname = tempnam (tmpdir, .rwtest-tmp);
 
 if (fname) {
 
@@ -272,7 +277,7 @@
 else {
 fprintf (stderr, %s:%d: tempnam(\%s\, \%s\) failed: %s\n,
  __FILE__, __LINE__,
- P_tmpdir, .rwtest-tmp, strerror (errno));
+ tmpdir, .rwtest-tmp, strerror (errno));
 }
 
 #  else

 -Original Message-
 From: Scott Zhong [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 09, 2008 9:31 AM
 To: dev@stdcxx.apache.org
 Subject: RE: [PATCH] STDCXX-401 test suite should honor TMPDIR
 
 That const_cast isn't suppose to be there.  Here is the correct
version:
 
 Index: tests/src/file.cpp
 ===
 --- tests/src/file.cpp  (revision 702657)
 +++ tests/src/file.cpp  (working copy)
 @@ -208,8 +208,13 @@
  #ifndef _RWSTD_NO_MKSTEMP
  #  define TMP_TEMPLATE  tmpfile-XX
 
 +const char *tmpdir = getenv (TMPDIR);
 +if (tmpdir == NULL) {
 +tmpdir = P_tmpdir;
 +}
 +
  if (!buf) {
 -static char fname_buf [sizeof (P_tmpdir) + sizeof
 (TMP_TEMPLATE)];
 +static char fname_buf [strlen (tmpdir) + sizeof
 (TMP_TEMPLATE)];
 
  buf = fname_buf;
  *buf = '\0';
 @@ -217,13 +222,13 @@
 
  if ('\0' == *buf) {
  // copy the template to the buffer; make sure there is
exactly
 -// one path separator character between P_tmpdir and the file
 +// one path separator character between tmpdir and the file
  // name template (it doesn't really matter how many there are
  // as long as it's at least one, but one looks better than
two
  // in diagnostic messages)
 -size_t len = sizeof (P_tmpdir) - 1;
 +size_t len = strlen (tmpdir) - 1;
 
 -memcpy (buf, P_tmpdir, len);
 +memcpy (buf, tmpdir, len);
  if (_RWSTD_PATH_SEP != buf [len - 1])
  buf [len++] = _RWSTD_PATH_SEP;
 
 @@ -251,7 +256,7 @@
  #  ifdef _WIN32
 
  // create a temporary file name
 -char* fname = tempnam (P_tmpdir, .rwtest-tmp);
 +char* fname = tempnam (tmpdir, .rwtest-tmp);
 
  if (fname) {
 
 @@ -272,7 +277,7 @@
  else {
  fprintf (stderr, %s:%d: tempnam(\%s\, \%s\) failed:
%s\n,
   __FILE__, __LINE__,
 - P_tmpdir, .rwtest-tmp, strerror (errno));
 + tmpdir, .rwtest-tmp, strerror (errno));
  }
 
  #  else
 
  -Original Message-
  From: Scott Zhong [mailto:[EMAIL PROTECTED]
  Sent: Thursday, October 09, 2008 9:25 AM
  To: dev@stdcxx.apache.org
  Subject: RE: [PATCH] STDCXX-401 test suite should honor TMPDIR
 
  Hi Farid, thanks for the quick response, here is the new version
with
  the changes suggested.
 
  Index: tests/src/file.cpp
  ===
  --- tests/src/file.cpp  (revision 702657)
  +++ tests/src/file.cpp  (working copy)
  @@ -208,8 +208,13 @@
   #ifndef _RWSTD_NO_MKSTEMP
   #  define TMP_TEMPLATE  tmpfile-XX
 
  +const char *tmpdir = getenv (TMPDIR);
  +if (tmpdir == NULL) {
  +tmpdir = const_castchar(P_tmpdir);
  +}
  +
   if (!buf) {
  -static char fname_buf [sizeof (P_tmpdir) + sizeof
  (TMP_TEMPLATE)];
  +static char fname_buf [strlen (tmpdir) + sizeof
  (TMP_TEMPLATE)];
 
   buf = fname_buf;
   *buf = '\0';
  @@ -217,13 +222,13 @@
 
   if ('\0' == *buf) {
   // copy the template to the buffer; make sure there is
 exactly
  -// one path

RE: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should honor TMPDIR environment variable

2008-10-09 Thread Scott Zhong
Fix to fnamebuf array size and invoke getenv only once.

Index: src/file.cpp
===
--- src/file.cpp(revision 702657)
+++ src/file.cpp(working copy)
@@ -42,6 +42,7 @@
 #include stdio.h// for P_tmpdir, std{err,in,out}, tmpnam()
 #include stdlib.h   // for mkstemp(), strtoul(), size_t
 #include ctype.h// for isalpha(), isspace(), toupper()
+#include string.h   // for memcpy()
 
 
 #if defined (_WIN32)  !defined (__CYGWIN__)
@@ -58,6 +59,9 @@
 #  define _BINARY 0
 #endif
 
+#ifndef PATH_MAX
+#  define PATH_MAX   1024
+#endif
 
 #include rw/_file.h
 #include rw/_defs.h
@@ -257,8 +261,18 @@
 #define P_tmpdir /tmp
 #  endif   // P_tmpdir
 
-char fnamebuf[] = P_tmpdir /.rwtmpXX;
+const char *tmpdir = getenv (TMPDIR);
+if (tmpdir == NULL) { 
+tmpdir = P_tmpdir;
+}
 
+char fnamebuf [PATH_MAX];
+
+size_t len = strlen (tmpdir) - 1;
+ 
+memcpy (fnamebuf, tmpdir, len);
+memcpy (fnamebuf+len, /.rwtmpXX, sizeof (/.rwtmpXX));
+
 fd = mkstemp (fnamebuf);
 
 if (fd = 0)
@@ -294,7 +308,7 @@
 // names that have no extension. tempnam uses malloc to allocate
 // space for the filename; the program is responsible for freeing
 // this space when it is no longer needed. 
-char* const fname = tempnam (P_tmpdir, .rwtmp);
+char* const fname = tempnam (tmpdir, .rwtmp);
 
 if (!fname)
 return -1;

 -Original Message-
 From: Scott Zhong [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 08, 2008 11:03 AM
 To: dev@stdcxx.apache.org
 Subject: RE: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should honor
 TMPDIR environment variable
 
 Posted wrong diff. here is the correct diff
 
 Index: src/file.cpp
 ===
 --- src/file.cpp(revision 702657)
 +++ src/file.cpp(working copy)
 @@ -42,6 +42,7 @@
  #include stdio.h// for P_tmpdir, std{err,in,out}, tmpnam()
  #include stdlib.h   // for mkstemp(), strtoul(), size_t
  #include ctype.h// for isalpha(), isspace(), toupper()
 +#include string.h   // for memcpy()
 
 
  #if defined (_WIN32)  !defined (__CYGWIN__)
 @@ -257,8 +258,15 @@
  #define P_tmpdir /tmp
  #  endif   // P_tmpdir
 
 -char fnamebuf[] = P_tmpdir /.rwtmpXX;
 +char *tmpdir = getenv (TMPDIR) == NULL ? P_tmpdir : getenv
 (TMPDIR);
 
 +char fnamebuf [sizeof (tmpdir) + sizeof (/.rwtmpXX)];
 +
 +size_t len = sizeof (tmpdir) - 1;
 +
 +memcpy (fnamebuf, tmpdir, len);
 +memcpy (fnamebuf+len, /.rwtmpXX, sizeof (/.rwtmpXX));
 +
  fd = mkstemp (fnamebuf);
 
  if (fd = 0)
 @@ -294,7 +302,7 @@
  // names that have no extension. tempnam uses malloc to allocate
  // space for the filename; the program is responsible for freeing
  // this space when it is no longer needed.
 -char* const fname = tempnam (P_tmpdir, .rwtmp);
 +char* const fname = tempnam (tmpdir, .rwtmp);
 
  if (!fname)
  return -1;
 
  -Original Message-
  From: Scott Zhong [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 08, 2008 10:15 AM
  To: dev@stdcxx.apache.org
  Subject: [PATCH] STDCXX-1019 __rw_mkstemp in file.cpp should honor
 TMPDIR
  environment variable
 
  https://issues.apache.org/jira/browse/STDCXX-1019
 
  file affected: stdcxx/src/file.cpp
 
  Index: src/file.cpp
  ===
  --- src/file.cpp(revision 702657)
  +++ src/file.cpp(working copy)
  @@ -257,7 +257,9 @@
   #define P_tmpdir /tmp
   #  endif   // P_tmpdir
 
  -char fnamebuf[] = P_tmpdir /.rwtmpXX;
  +char *tmpdir = getenv (TMPDIR) == NULL ? P_tmpdir : getenv
  (TMPDIR);
  +
  +char fnamebuf[] = tmpdir /.rwtmpXX;
 
   fd = mkstemp (fnamebuf);
 
  @@ -294,7 +296,7 @@
   // names that have no extension. tempnam uses malloc to
allocate
   // space for the filename; the program is responsible for
freeing
   // this space when it is no longer needed.
  -char* const fname = tempnam (P_tmpdir, .rwtmp);
  +char* const fname = tempnam (tmpdir, .rwtmp);
 
   if (!fname)
   return -1;


[PATCH] STDCXX-1020 memchk in utility should honor TMPDIR variable

2008-10-08 Thread Scott Zhong
https://issues.apache.org/jira/browse/STDCXX-1020

Index: util/memchk.cpp
===
--- util/memchk.cpp (revision 702657)
+++ util/memchk.cpp (working copy)
@@ -116,9 +116,11 @@
 // operation away (as SunOS does, for instance)
 // fd = open (/dev/null, O_WRONLY);
 
+ char *tmpdir = getenv (TMPDIR) == NULL ? P_tmpdir : getenv
(TMPDIR);
+
 #ifdef _WIN32
 
-char* const fname = tempnam (P_tmpdir, .rwmemchk.tmp);
+char* const fname = tempnam (tmpdir, .rwmemchk.tmp);
 
 if (!fname)
 return size_t (-1);
@@ -137,10 +139,13 @@
 
 #else   // !_WIN32
 
-#  define TMP_TEMPLATE P_tmpdir /rwmemchk-XX
+char fname_buf [sizeof (tmpdir) + sizeof (/rwmemchk-XX)];
 
-char fname_buf [] = TMP_TEMPLATE;
+size_t len = sizeof (tmpdir) - 1;
 
+memcpy (fname_buf, tmpdir, len);
+memcpy (fname_buf+len, /rwmemchk-XX, sizeof
(/rwmemchk-XX));
+
 fd = mkstemp (fname_buf);
 
 if (fd  0) {


RE: nightly results still out of date

2008-10-01 Thread Scott Zhong
That's incorrect; all the runs have been running just that the stdcxx
results web page hasn't been updated yet. We'll have to wait for the
next nightly builds to finish in order for the stdcxx result web page to
update.

 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, October 01, 2008 10:46 AM
 To: dev@stdcxx.apache.org
 Subject: Re: nightly results still out of date
 
 Looks like results for at least some platforms are coming in again,
 but there are few, including HP-UX/PA and Intel C++ 9.1, and some
 others, that haven't produced any results in almost a month.
 
 Scott, can you please check the page below to see what the problem
 might be?
 
 http://stdcxx.apache.org/builds/4.2.x/
 
 Thanks
 Martin
 
 Martin Sebor wrote:
  Andrew Black wrote:
  Greetings Martin
 
  Is the export script being run with some kind of resource limit
set?
  I've dug into the log files from when the export is run, and it
appears
  that the output is being abruptly truncated for no apparent reason.
To
  me, the most likely culprit of this sort of behavior would be
ulimit.
  If there are resource limits being set, try re-running the export
  manually without setting any.  It's been long enough since we had a
  'good' export that you'll end up dumping essentially all the
current
  results from the system.
 
  Ugh. It could be my quota. I was trying to copy a compiler
  for our IT to install a few weeks ago and ran out of quota.
  The partially copied file was still in my home directory,
  so maybe that was the problem. I deleted the file and some
  other junk from my HOME so hopefully that'll fix it. We'll
  see tomorrow. Thanks for your help!
 
  Martin
 
 
  --Andrew Black
 
  Martin Sebor wrote:
  It looks like the vast majority of our nightly results are
  still out of date. Andrew, I know you fixed the issue with
  the server name. Is there anything else that you can think
  of that might need to change to get them updated?
 
  Martin
 
 
 



RE: Nightly testing stalled?

2008-09-17 Thread Scott Zhong
http://svn.apache.org/repos/asf/stdcxx/branches/4.2.x not changed since
694682

stdcxx 4.2.x nightly builds only occur when a change has occurred over
the last run.

Scott Z.

 -Original Message-
 From: Farid Zaripov [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 17, 2008 7:23 AM
 To: dev@stdcxx.apache.org
 Subject: Nightly testing stalled?
 
   The latest build results on 4.2.x branch generated at Mon Sep 8
 15:00:25...
 
 Farid.


RE: Nightly testing stalled?

2008-09-17 Thread Scott Zhong
It could also be that Martin is out until mid next week and the scripts
that generate the build page haven't been run yet.

Scott Z.

 -Original Message-
 From: Scott Zhong [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 17, 2008 8:25 AM
 To: dev@stdcxx.apache.org
 Subject: RE: Nightly testing stalled?
 
 http://svn.apache.org/repos/asf/stdcxx/branches/4.2.x not changed
since
 694682
 
 stdcxx 4.2.x nightly builds only occur when a change has occurred over
 the last run.
 
 Scott Z.
 
  -Original Message-
  From: Farid Zaripov [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, September 17, 2008 7:23 AM
  To: dev@stdcxx.apache.org
  Subject: Nightly testing stalled?
 
The latest build results on 4.2.x branch generated at Mon Sep 8
  15:00:25...
 
  Farid.


RE: tags/4.2.1-rc-1 results

2008-04-10 Thread Scott Zhong
Martin, do I need to switch to the new tags to do nightly testing?

 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
 Sent: Thursday, April 10, 2008 4:30 PM
 To: dev@stdcxx.apache.org
 Subject: tags/4.2.1-rc-1 results
 
 Nightly build results for tags/4.2.1-rc-1 are available at:
 
http://people.apache.org/~sebor/stdcxx-4.2.1-rc-1/results/

http://people.apache.org/~sebor/stdcxx-4.2.1-rc-1/results/builds.html
 
 The stdcxx-4.2.1 link I mentioned in my earlier post points
 to 4.2.1-rc-1. I'll re-point it to the results for the next
 release candidate as soon as we create it.


[PATCH] STDCXX-423 LIMITS.cpp assumes integers with no padding bits

2008-04-03 Thread Scott Zhong
Changes made:

* fix a bug (not filed) that would potentially access an array using
negative index
* add function compute_type_bits to calculate the number of bits in the
value representation of type T.
* add a check that would only define exact width integer type if the
system supports two's complement
* add a check to ensure that the number of bits in the value
representation and the number of bits in the object representation are
the same before defining exact integer width types. 

Index: LIMITS.cpp
===
--- LIMITS.cpp  (revision 639462)
+++ LIMITS.cpp  (working copy)
@@ -80,7 +80,7 @@
 '0','1','2','3','4','5','6','7','8','9', 'a', 'b', 'c', 'd',
'e', 'f'
 };
 
-if (is_max || n = zero) {
+if (n = zero) {
 
 T tnstr = n;
 
@@ -224,6 +224,19 @@
 }
 
 
+template class T
+unsigned compute_type_bits()
+{
+T max = T (one);
+T current = T(one);
+int bits = 1;
+ 
+for (; T (current * 2)  max; current *=2, max *= 2, bits++) { }
+
+return bits;
+}
+
+
 // used to compute the size of a pointer to a member function
 struct EmptyStruct { };
 
@@ -397,6 +410,12 @@
 // 1 for a 16-bit integer, etc)
 int width_bits = 0;
 
+// store exact bit size of each type
+int ushort_bits = compute_type_bitsunsigned short ();
+int uint_bits = compute_type_bitsunsigned int ();
+int ulong_bits = compute_type_bitsunsigned long ();
+int ullong_bits = compute_type_bitsunsigned LLong ();
+
#define PRINT_SPECIFIC(width, least, type)
\
 do {
\
 /* avoid warnings about expression being constant */
\
@@ -406,7 +425,7 @@
 #define _RWSTD_UINT_LEAST%d_T %s  _RWSTD_U%s_T\n,
\
 width, width  10 ?   : , type,
\
 width, width  10 ?   : , type);
\
-else
\
+else if (!no_twos_complement)
\
 printf (#define _RWSTD_INT%d_T %s  signed %s\n
\
 #define _RWSTD_UINT%d_T %s unsigned %s\n,
\
 width, width  10 ?   : , type,
\
@@ -430,59 +449,59 @@
 PRINT_SPECIFIC (64, , char);
 }
 
-if (16 == char_bits * sizeof (short)  !(width_bits  2)) {
+if (16 == char_bits * sizeof (short)  16 == ushort_bits 
!(width_bits  2)) {
 width_bits |= 2;
 PRINT_SPECIFIC (16, , short);
 }
-else if (32 == char_bits * sizeof (short)  !(width_bits  4)) {
+else if (32 == char_bits * sizeof (short)  32 == ushort_bits 
!(width_bits  4)) {
 width_bits |= 4;
 PRINT_SPECIFIC (32, , short);
 }
-else if (64 == char_bits * sizeof (short)  !(width_bits  8)) {
+else if (64 == char_bits * sizeof (short)  64 == ushort_bits 
!(width_bits  8)) {
 width_bits |= 8;
 PRINT_SPECIFIC (64, , short);
 }
-else if (128 == char_bits * sizeof (short)  !(width_bits  16)) {
+else if (128 == char_bits * sizeof (short)  128 == ushort_bits 
!(width_bits  16)) {
 width_bits |= 16;
 PRINT_SPECIFIC (128, , short);
 }
 
-if (32 == char_bits * sizeof (int)  !(width_bits  4)) {
+if (32 == char_bits * sizeof (int)  32 == uint_bits 
!(width_bits  4)) {
 width_bits |= 4;
 PRINT_SPECIFIC (32, , int);
 }
-else if (64 == char_bits * sizeof (int)  !(width_bits  8)) {
+else if (64 == char_bits * sizeof (int)  64 == uint_bits 
!(width_bits  8)) {
 width_bits |= 8;
 PRINT_SPECIFIC (64, , int);
 }
-else if (128 == char_bits * sizeof (int)  !(width_bits  16)) {
+else if (128 == char_bits * sizeof (int)  128 == uint_bits 
!(width_bits  16)) {
 width_bits |= 16;
 PRINT_SPECIFIC (128, , int);
 }
 
-if (32 == char_bits * sizeof (long)  !(width_bits  4)) {
+if (32 == char_bits * sizeof (long)  32 == ulong_bits 
!(width_bits  4)) {
 width_bits |= 4;
 PRINT_SPECIFIC (32, , long);
 }
-else if (64 == char_bits * sizeof (long)  !(width_bits  8)) {
+else if (64 == char_bits * sizeof (long)  64 == ulong_bits 
!(width_bits  8)) {
 width_bits |= 8;
 PRINT_SPECIFIC (64, , long);
 }
-else if (128 == char_bits * sizeof (long)  !(width_bits  16)) {
+else if (128 == char_bits * sizeof (long)  128 == ulong_bits 
!(width_bits  16)) {
 width_bits |= 16;
 PRINT_SPECIFIC (128, , long);
 }
 
-if (32 == char_bits * sizeof (LLong)  !(width_bits  4)) {
+if (32 == char_bits * sizeof (LLong)  32 == ullong_bits 
!(width_bits  4)) {
 width_bits |= 4;
 PRINT_SPECIFIC (32, , llong_name);
 }
-else if (64 == char_bits * sizeof (LLong)  !(width_bits  8)) {
+else if (64 == char_bits * sizeof (LLong)  64 == ullong_bits 
!(width_bits  8)) {
 width_bits |= 8;
 PRINT_SPECIFIC (64, , llong_name);
 
 }
-else if (128 == char_bits * sizeof (LLong)  !(width_bits  16)) {
+else if (128 == char_bits * sizeof (LLong)  128 == ullong_bits 

nightly build errors 4/2/08

2008-04-02 Thread Scott Zhong
Some platforms are going to show up as ERROR / DATA today and tomorrow
due to code changes in the infrastructure.  This issue is being looked
at and hopefully be fix by today.


RE: [PATCH] STDCXX-423 LIMITS.cpp assumes integers with no padding bits

2008-04-02 Thread Scott Zhong


 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
 Sent: Saturday, March 22, 2008 4:47 PM
 To: dev@stdcxx.apache.org
 Subject: Re: [PATCH] STDCXX-423 LIMITS.cpp assumes integers with no
 padding bits
 
 Sorry Scott, I'm still not sure this is completely correct.
 
 According to 7.18.1.1 of C99, The typedef name intN_t designates
 a signed integer type with width N, no padding bits, and a two's
 complement representation.
 
 Can you point me to the part of the patch that checks that each
 of the exact-width types has no padding bits and that it uses
 a two's complement representation?
 
 A few more comments are inline...
 
 Scott Zhong wrote:
  Index: LIMITS.cpp
  ===
  --- LIMITS.cpp  (revision 638996)
  +++ LIMITS.cpp  (working copy)
  @@ -223,7 +223,19 @@
   return bits;
   }
 
  +template class T
  +unsigned compute_type_bits()
  +{
  +T max = T (one);
  +T current = T(one);
  +int bits = 1;
 
  +for (; T (current * 2)  max; current *=2, max *= 2, bits++) {
}
  +
  +return bits;
  +}
 
 This function computes the number of bits in the value representation
 of the type T. We also need to compute the number of bits in the
object
 representation of the type (i.e., sizeof(T) * CHAR_BIT). Only if the
 two match, and when (no_twos_complement == 0) holds can we define
 the exact-width types.
 
  +
  +
   // used to compute the size of a pointer to a member function
   struct EmptyStruct { };
 
  @@ -397,6 +409,12 @@
   // 1 for a 16-bit integer, etc)
   int width_bits = 0;
 
  +// store exact bit size of each type
  +int ushort_bits = compute_type_bitsunsigned short ();
  +int uint_bits = compute_type_bitsunsigned int ();
  +int ulong_bits = compute_type_bitsunsigned long ();
  +int ullong_bits = compute_type_bitsunsigned LLong ();
 
 The last line needs to be guarded in case long long is not
 recognized as a type (e.g., EDG eccp in strict mode).
 
 Martin
 

Martin, the macro LLong already takes care of this.


RE: [aCC 6.05] too many warnings

2008-04-01 Thread Scott Zhong
No, not currently, it is within the function that saves the log that
throw an exception.   

 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 01, 2008 10:06 AM
 To: dev@stdcxx.apache.org
 Subject: Re: [aCC 6.05] too many warnings
 
 Scott Zhong wrote:
  In the debug build of aCC 6.05 for stdcxx trunk, there are too many
  warnings that made the build log file to be larger than what the
nightly
  build infrastructure could handle.  This is causing debug builds to
show
  up as DATA in the results page.
 
 Thanks for the heads up. Is there any way to get a partial log
 so we can tell which warnings are generating the most noise and
 silence them?
 
 Martin


build error 3/31/08

2008-03-31 Thread Scott Zhong
OS: win_xp-2-x86   compiler: icl-9.1 

The reason for this failure is because of the windows nightly build
machine failure.

OS: all windowscompiler: MSVC-9.0

The reason for this failure is the scripts used to parse the results are
parsing incorrectly.  This issue is being looked at and will be fix at a
later date.


[TESTCASE] STDCXX-750 [HP aCC 6.16] Potential null pointer dereference in aliases.cpp

2008-03-20 Thread Scott Zhong
cat /build/scottz/t2.cpp  aCC -V  aCC -c  +w  /build/scottz/t2.cpp 
#include cstdlib

int main()
{
  static char * test = 0;
  if (!test) {
 test = (char *)std::malloc (12345);
 *test = '\0';
  }

  return 0;
}
aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
/build/scottz/t2.cpp, line 8, procedure main: warning #20200-D:
Potential
  null pointer dereference through test is detected (null
  definition:/build/scottz/t2.cpp, line 7)

this test case shows that the warning is bogus because the pointer
test is pointing to a valid location in memory after std::malloc is
performed.


RE: [TESTCASE] STDCXX-750 [HP aCC 6.16] Potential null pointer dereference in aliases.cpp

2008-03-20 Thread Scott Zhong
Martin, would you suggest that there should be a check after malloc and
throw bad_alloc?

 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
 Sent: Thursday, March 20, 2008 12:02 PM
 To: dev@stdcxx.apache.org
 Subject: Re: [TESTCASE] STDCXX-750 [HP aCC 6.16] Potential null
pointer
 dereference in aliases.cpp
 
 I was going to say this is the same bug as STDCXX-764:
http://issues.apache.org/jira/browse/STDCXX-764
 but after looking at it more closely I believe the compiler
 is correct in this case because malloc() returns 0 when it
 fails to allocate memory. The warning could be clearer about
 it.
 
 Martin
 
 Scott Zhong wrote:
  cat /build/scottz/t2.cpp  aCC -V  aCC -c  +w
/build/scottz/t2.cpp
  #include cstdlib
 
  int main()
  {
static char * test = 0;
if (!test) {
   test = (char *)std::malloc (12345);
   *test = '\0';
}
 
return 0;
  }
  aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
  /build/scottz/t2.cpp, line 8, procedure main: warning #20200-D:
  Potential
null pointer dereference through test is detected (null
definition:/build/scottz/t2.cpp, line 7)
 
  this test case shows that the warning is bogus because the pointer
  test is pointing to a valid location in memory after std::malloc
is
  performed.
 



RE: [PATCH] STDCXX-423

2008-03-13 Thread Scott Zhong
 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 13, 2008 12:32 PM
 To: dev@stdcxx.apache.org
 Subject: RE: [PATCH] STDCXX-423
 
 
 Okay, so this function seems to correctly compute the number of bytes
 in the value representation of the object. Remind me, where do we need
 it in the rest of LIMITS.cpp again? I.e., what does the patch look
 like?
 
 Thanks
 Martin
 

The patch looks like the following; it replaces SIZEOF macro on int
types with CALC_SIZEOF macro. The CALC_SIZEOF macro expends to
compute_byte_size function.

--- LIMITS.cpp  (revision 624452)
+++ LIMITS.cpp  (working copy)
@@ -223,13 +223,27 @@
 return bits;
 }
 
+template class T
+unsigned compute_byte_size()
+{
+T max = T (one);
+T current = T(one);
+unsigned byte = 1;
+for (int i = 1; T (current * 2)  max; current *=2, max *= 2, i++)
{
+if (i  8) { byte++; i=1; }
+}
+return byte;
+}

+ 
 // used to compute the size of a pointer to a member function  struct
EmptyStruct { };
 
 
 // to silence printf() format comaptibility warnings
 #define SIZEOF(T)   unsigned (sizeof (T))
+ 
+// to not include possible bit padding
+#define CALC_SIZEOF(T)  compute_byte_sizeT()
 
 
 int main ()
@@ -243,17 +257,17 @@
 
 #ifndef _RWSTD_NO_BOOL
 printf (#define _RWSTD_BOOL_SIZE   %2u /* sizeof (bool) */\n,
-SIZEOF (bool));
+CALC_SIZEOF (bool));
 #endif   // _RWSTD_NO_BOOL
 
 printf (#define _RWSTD_CHAR_SIZE   %2u /* sizeof (char) */\n,
-SIZEOF (char));
+CALC_SIZEOF (char));
 printf (#define _RWSTD_SHRT_SIZE   %2u /* sizeof (short) */\n,
-SIZEOF (short));
+CALC_SIZEOF (short));
 printf (#define _RWSTD_INT_SIZE%2u /* sizeof (int) */\n,
-SIZEOF (int));
+CALC_SIZEOF (int));
 printf (#define _RWSTD_LONG_SIZE   %2u /* sizeof (long) */\n,
-SIZEOF (long));
+CALC_SIZEOF (long));
 
 printf (#define _RWSTD_FLT_SIZE%2u /* sizeof (float) */\n,
 SIZEOF (float));
@@ -319,7 +333,7 @@
 
 #define LLong long long
 
-printf (#define _RWSTD_LLONG_SIZE  %2u\n, SIZEOF (LLong));
+printf (#define _RWSTD_LLONG_SIZE  %2u\n, CALC_SIZEOF (LLong));
 
 const char llong_name[] = long long;
 
@@ -332,7 +346,7 @@
 
 #define LLong __int64
 
-printf (#define _RWSTD_LLONG_SIZE  %2u\n, SIZEOF (LLong));
+printf (#define _RWSTD_LLONG_SIZE  %2u\n, CALC_SIZEOF (LLong));
 
 const char llong_name[] = __int64;
 
@@ -352,7 +366,7 @@
 #ifndef _RWSTD_NO_WCHAR_T
 
 printf (#define _RWSTD_WCHAR_SIZE  %2u /* sizeof (wchar_t) */\n,
-SIZEOF (wchar_t));
+CALC_SIZEOF (wchar_t));
 
 const char *suffix = U;
 if ((wchar_t)~0  (wchar_t)0)




[PATCH] STDCXX-401 part 2

2008-03-11 Thread Scott Zhong
http://issues.apache.org/jira/browse/STDCXX-401

Title: test suite should honor TMPDIR

stdcxx-401 patch part 1 is in 

http://mail-archives.apache.org/mod_mbox/stdcxx-dev/200803.mbox/%3cCFFDD
[EMAIL PROTECTED]

stdcxx-401 patch part 2 affects:

./src/file.cpp
./util/memchk.cpp
./bin/xbuildgen
./etc/config/makefile.rules
./etc/config/run_locale_utils.sh

Patch link:

http://www.fileden.com/files/2008/1/30/1729926/patch.stdcxx-401.diff



RE: STDCXX-401

2008-03-10 Thread Scott Zhong


 -Original Message-
 From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
 Sent: Monday, March 10, 2008 3:39 PM
 To: dev@stdcxx.apache.org
 Subject: Re: STDCXX-401
 
 Thanks for the patch, Scott! I think this a start, but suspect
 there are a few other places in the test suite that might need
 to be changed as well (the locale tests?)
 

The only function I saw that needed this change was
rw_tmpnam()(implemented in file.cpp), I believe locale test uses
rw_tmpnam to create the temporary file.

 Let me take this opportunity to ask you to please review our
 guidelines for Submitting Patches and the expected Patch Format:
 
http://stdcxx.apache.org/bugs.html#patches
http://stdcxx.apache.org/bugs.html#patch_format
 
 Specifically, the string [PATCH] in the subject line is helpful
 in identifying patches among other discussions on the list (and
 in setting up mail filters for such things). Unless the patch is
 entirely trivial, we also need some narrative to go with it. For
 simple patches a Change Log entry usually does the job (see bullet
 3). For anything even moderately involved, a description of what
 the patch actually does is recommended (bullet 1).
 
 Finally, while we don't have a style document for stdcxx (yet) we
 do follow pretty consistent formatting style. To make integrating
 your patches easier for us please take a look at nearby code and
 try to follow the same style especially WRT braces and whitespace
 usage.
 
 Martin
 

Sorry Martin, I follow the guidelines more closely.  Since there are 2
more files with this patch, are subtasks needed?



[PATCH] STDCXX-563

2008-02-12 Thread Scott Zhong
Split _mutex.h into

_mutex-aix.h
_mutex-deccxx.h
_mutex.h
_mutex-i386gcc.h
_mutex-ia64-x86-64.h
_mutex-parisc.h
_mutex-sgi.h
_mutex-sparc.h

http://www.fileden.com/files/2008/1/30/1729926/patch.stdcxx-563.tar


[PATCH] STDCXX-423

2008-02-12 Thread Scott Zhong
--- LIMITS.cpp  (revision 624452)
+++ LIMITS.cpp  (working copy)
@@ -223,13 +223,27 @@
 return bits;
 }
 
+template class T
+unsigned compute_byte_size()
+{
+T max = T (one);
+unsigned byte = 1;
+for (int i = 1; T (max * two)  max; max *= two, i++) { 
+if (i  8 ) {byte++; i = 1; } 
+}
+return byte; 
+}
 
+
 // used to compute the size of a pointer to a member function
 struct EmptyStruct { };
 
 
 // to silence printf() format comaptibility warnings
 #define SIZEOF(T)   unsigned (sizeof (T))
+ 
+// to not include possible bit padding
+#define CALC_SIZEOF(T)  compute_byte_sizeT()
 
 
 int main ()
@@ -243,17 +257,17 @@
 
 #ifndef _RWSTD_NO_BOOL
 printf (#define _RWSTD_BOOL_SIZE   %2u /* sizeof (bool) */\n,
-SIZEOF (bool));
+CALC_SIZEOF (bool));
 #endif   // _RWSTD_NO_BOOL
 
 printf (#define _RWSTD_CHAR_SIZE   %2u /* sizeof (char) */\n,
-SIZEOF (char));
+CALC_SIZEOF (char));
 printf (#define _RWSTD_SHRT_SIZE   %2u /* sizeof (short) */\n,
-SIZEOF (short));
+CALC_SIZEOF (short));
 printf (#define _RWSTD_INT_SIZE%2u /* sizeof (int) */\n,
-SIZEOF (int));
+CALC_SIZEOF (int));
 printf (#define _RWSTD_LONG_SIZE   %2u /* sizeof (long) */\n,
-SIZEOF (long));
+CALC_SIZEOF (long));
 
 printf (#define _RWSTD_FLT_SIZE%2u /* sizeof (float) */\n,
 SIZEOF (float));
@@ -319,7 +333,7 @@
 
 #define LLong long long
 
-printf (#define _RWSTD_LLONG_SIZE  %2u\n, SIZEOF (LLong));
+printf (#define _RWSTD_LLONG_SIZE  %2u\n, CALC_SIZEOF (LLong));
 
 const char llong_name[] = long long;
 
@@ -332,7 +346,7 @@
 
 #define LLong __int64
 
-printf (#define _RWSTD_LLONG_SIZE  %2u\n, SIZEOF (LLong));
+printf (#define _RWSTD_LLONG_SIZE  %2u\n, CALC_SIZEOF (LLong));
 
 const char llong_name[] = __int64;
 
@@ -352,7 +366,7 @@
 #ifndef _RWSTD_NO_WCHAR_T
 
 printf (#define _RWSTD_WCHAR_SIZE  %2u /* sizeof (wchar_t) */\n,
-SIZEOF (wchar_t));
+CALC_SIZEOF (wchar_t));
 
 const char *suffix = U;
 if ((wchar_t)~0  (wchar_t)0)


HP-UX link warnings when linking in with -lstd

2008-02-11 Thread Scott Zhong
Hi All,

I had finally found the source of the link warnings: it is occurring
because in the linker we use relative path in the library lookup -L
relative path which confuses the linker as to which stdcxx library to
use.  This is because the compiler comes with a version of the stdcxx
library: libstd.sl. This might be a compiler bug. I do not know how to
proceed from here, do we do nothing and leave the linker warnings and
submit the bug to HP? do we require absolute pathing to the stdcxx
library? Do we have the user set an environment variable that would
point to the stdcxx library? Any suggestions would help greatly. 

Thanks


RE: [PATCH] STDCXX-705

2008-01-30 Thread Scott Zhong
Actually ( 0x0 - 1 ) is going to give a misalign address, so we would
want 0x0 - sizeof(size_t) instead

Index: 0.printf.cpp
===
--- 0.printf.cpp(revision 616446)
+++ 0.printf.cpp(working copy)
@@ -165,15 +165,7 @@
 ++addr;
 }
 else {
-
-#ifndef _RWSTD_OS_HP_UX
-// the first page is usually unmapped
-addr = (char*)32;
-#else
-// the first page on HP-UX is readable, this might work
-addr = (char*)(void*)bad_address + 1024 * 1024 * 16;
-#endif   // _RWSTD_OS_HP_UX
-
+addr = (char*)(void*)(0x0 - sizeof(size_t));
 }
 
 return addr;

-Original Message-
From: Scott Zhong [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 29, 2008 2:49 PM
To: dev@stdcxx.apache.org
Subject: RE: [PATCH] STDCXX-705

I tried to access the red zone and a seg fault didn't occur but when
trying to access the kernel address space it does cause a seg fault. I
propose to change 0.printf.cpp to the following:

Index: 0.printf.cpp
===
--- 0.printf.cpp(revision 616446)
+++ 0.printf.cpp(working copy)
@@ -165,15 +165,7 @@
 ++addr;
 }
 else {
-
-#ifndef _RWSTD_OS_HP_UX
-// the first page is usually unmapped
-addr = (char*)32;
-#else
-// the first page on HP-UX is readable, this might work
-addr = (char*)(void*)bad_address + 1024 * 1024 * 16;
-#endif   // _RWSTD_OS_HP_UX
-
+addr = (char*)(void*)(0x0 - 1);
 }
 
 return addr;

-Original Message-
From: Martin Sebor [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 29, 2008 2:14 PM
To: dev@stdcxx.apache.org
Subject: Re: [PATCH] STDCXX-705

Scott Zhong wrote:
 Could 
 
 addr = (char*)(void*)size_t(-1);
 
 Be a better choice for a bad address? 

I'm not sure.

The weird looking expression in the function tries to compute
an address that's beyond the last text segment page, or 16MB
past the address of the bad_address function. It was just
a wild guess that this address wouldn't be mapped. To get a
more reliable value we'll need to take a loot at the address
space layout of an HP-UX process. On IPF, it looks like there
are (at least) four possible layouts:
http://h21007.www2.hp.com/portal/download/files/unprot/Itanium/aas_white
_paper.pdf

 From the white paper it looks like (void*)-1 might be a valid
address in the 32-bit SHARE-MAGIC address space where the top
of the address space is used for shared data. I suspect it
would be an invalid (inaccessible) address in the 64-bit MGAS
and MPAS models where the top is reserved for the kernel. In
the 32-bit MPAS model the address is part of the stack so it
would be valid if the stack grows down from it.

But I think the safest bet on 64-bit HP-UX/IPF is to use the
beginning of one of the two Red Zones for a bad address, or
0xa000   .

On 32-bit HP-UX where the Red Zone isn't at any fixed location
we might need to compute a bad address, e.g., as the next page
after the top of the heap. Calling sbrk(0) should return the
top of the process heap, so assuming the process doesn't
allocate any private maps (0.printf shouldn't) any address
pointing into the next page should be invalid.

Do you want to verify that? :)

Martin

 
 -Original Message-
 From: Scott Zhong [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 29, 2008 1:22 PM
 To: [EMAIL PROTECTED]
 Subject: [PATCH] STDCXX-705
 
 the default page size can vary depending on the OS and can be changed
 with chatr.  Currently the test assumes the page size is 16kb which is
 not the case on this platform thus causes the assertions to occur.
For
 the short term, we can adjust the multiplier to 64 instead of 16.  For
 the long term, we need a better method to create a bad address.
 
 
 Index: 0.printf.cpp
 ===
 --- 0.printf.cpp(revision 616446)
 +++ 0.printf.cpp(working copy)
 @@ -171,7 +171,7 @@
  addr = (char*)32;
  #else
  // the first page on HP-UX is readable, this might work
 -addr = (char*)(void*)bad_address + 1024 * 1024 * 16;
 +addr = (char*)(void*)bad_address + 1024 * 1024 * 64;
  #endif   // _RWSTD_OS_HP_UX
  
  }



RE: [PATCH] STDCXX-705

2008-01-29 Thread Scott Zhong
I tried to access the red zone and a seg fault didn't occur but when
trying to access the kernel address space it does cause a seg fault. I
propose to change 0.printf.cpp to the following:

Index: 0.printf.cpp
===
--- 0.printf.cpp(revision 616446)
+++ 0.printf.cpp(working copy)
@@ -165,15 +165,7 @@
 ++addr;
 }
 else {
-
-#ifndef _RWSTD_OS_HP_UX
-// the first page is usually unmapped
-addr = (char*)32;
-#else
-// the first page on HP-UX is readable, this might work
-addr = (char*)(void*)bad_address + 1024 * 1024 * 16;
-#endif   // _RWSTD_OS_HP_UX
-
+addr = (char*)(void*)(0x0 - 1);
 }
 
 return addr;

-Original Message-
From: Martin Sebor [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 29, 2008 2:14 PM
To: dev@stdcxx.apache.org
Subject: Re: [PATCH] STDCXX-705

Scott Zhong wrote:
 Could 
 
 addr = (char*)(void*)size_t(-1);
 
 Be a better choice for a bad address? 

I'm not sure.

The weird looking expression in the function tries to compute
an address that's beyond the last text segment page, or 16MB
past the address of the bad_address function. It was just
a wild guess that this address wouldn't be mapped. To get a
more reliable value we'll need to take a loot at the address
space layout of an HP-UX process. On IPF, it looks like there
are (at least) four possible layouts:
http://h21007.www2.hp.com/portal/download/files/unprot/Itanium/aas_white
_paper.pdf

 From the white paper it looks like (void*)-1 might be a valid
address in the 32-bit SHARE-MAGIC address space where the top
of the address space is used for shared data. I suspect it
would be an invalid (inaccessible) address in the 64-bit MGAS
and MPAS models where the top is reserved for the kernel. In
the 32-bit MPAS model the address is part of the stack so it
would be valid if the stack grows down from it.

But I think the safest bet on 64-bit HP-UX/IPF is to use the
beginning of one of the two Red Zones for a bad address, or
0xa000   .

On 32-bit HP-UX where the Red Zone isn't at any fixed location
we might need to compute a bad address, e.g., as the next page
after the top of the heap. Calling sbrk(0) should return the
top of the process heap, so assuming the process doesn't
allocate any private maps (0.printf shouldn't) any address
pointing into the next page should be invalid.

Do you want to verify that? :)

Martin

 
 -Original Message-
 From: Scott Zhong [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 29, 2008 1:22 PM
 To: [EMAIL PROTECTED]
 Subject: [PATCH] STDCXX-705
 
 the default page size can vary depending on the OS and can be changed
 with chatr.  Currently the test assumes the page size is 16kb which is
 not the case on this platform thus causes the assertions to occur.
For
 the short term, we can adjust the multiplier to 64 instead of 16.  For
 the long term, we need a better method to create a bad address.
 
 
 Index: 0.printf.cpp
 ===
 --- 0.printf.cpp(revision 616446)
 +++ 0.printf.cpp(working copy)
 @@ -171,7 +171,7 @@
  addr = (char*)32;
  #else
  // the first page on HP-UX is readable, this might work
 -addr = (char*)(void*)bad_address + 1024 * 1024 * 16;
 +addr = (char*)(void*)bad_address + 1024 * 1024 * 64;
  #endif   // _RWSTD_OS_HP_UX
  
  }