stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r674550 - in /stdcxx/branches/4.2.x: include/ansi/limits.h tests/regress/18.c.limits.stdcxx-988.cpp
Date Mon, 07 Jul 2008 16:41:53 GMT
Author: sebor
Date: Mon Jul  7 09:41:50 2008
New Revision: 674550

URL: http://svn.apache.org/viewvc?rev=674550&view=rev
Log:
2008-07-07  Martin Sebor  <sebor@roguewave.com>

	STDCXX-988
	* include/ansi/limits.h [__GNUG__]: Used #include_next twice to coax
	gcc's <limits.h> to pull in the system <limits.h> in order to #define
	POSIX ans system macros.
	* tests/regress/18.c.limits.stdcxx-988.cpp: Regression test for
	STDCXX-988. Tested with gcc 4.1.2 and EDG eccp 3.9 on Fedora 8.

Added:
    stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp   (with props)
Modified:
    stdcxx/branches/4.2.x/include/ansi/limits.h

Modified: stdcxx/branches/4.2.x/include/ansi/limits.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/ansi/limits.h?rev=674550&r1=674549&r2=674550&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/ansi/limits.h (original)
+++ stdcxx/branches/4.2.x/include/ansi/limits.h Mon Jul  7 09:41:50 2008
@@ -107,7 +107,12 @@
 #  endif
 
 #  ifdef __GNUC__
-     // use the gcc extension to #include the compiler's limits.h
+     // use the gcc extension to #include the compiler's <limits.h>
+#    include_next <limits.h>
+
+     // include the same file again to get it to #include the system
+     // <limits.h> (presumably residing /usr/include/)
+#    define _GCC_NEXT_LIMITS_H
 #    include_next <limits.h>
 #  else
 #    include _RWSTD_ANSI_C_LIMITS_H

Added: stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp?rev=674550&view=auto
==============================================================================
--- stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp (added)
+++ stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp Mon Jul  7 09:41:50 2008
@@ -0,0 +1,163 @@
+/************************************************************************
+ *
+ * 18.c.limits.stdcxx-988.cpp - regression test for STDCXX-988
+ *
+ * http://issues.apache.org/jira/browse/STDCXX-988
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software  Foundation (ASF) under one or more
+ * contributor  license agreements.  See  the NOTICE  file distributed
+ * with  this  work  for  additional information  regarding  copyright
+ * ownership.   The ASF  licenses this  file to  you under  the Apache
+ * License, Version  2.0 (the  "License"); you may  not use  this file
+ * except in  compliance with the License.   You may obtain  a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the  License is distributed on an  "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
+ * implied.   See  the License  for  the  specific language  governing
+ * permissions and limitations under the License.
+ * 
+ **************************************************************************/
+
+#include <cassert>
+#include <limits.h>
+
+int main ()
+{
+#if    (defined __unix__ || defined __unix || defined unix) \
+    && !defined _RWSTD_EDG_ECCP
+
+    // According to POSIX (SUSv3), the following macros are required
+    // to be defined in <limits.h> (others, such as OPEN_MAX) are
+    // optional):
+    // http://www.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
+
+    // Runtime Increasable Values
+
+    // The magnitude limitations in the following list shall be fixed
+    // by specific implementations. An application should assume that
+    // the value supplied by <limits.h> in a specific implementation
+    // is the minimum that pertains whenever the application is run
+    // under that implementation. A specific instance of a specific
+    // implementation may increase the value relative to that supplied
+    // by <limits.h> for that implementation. The actual value supported
+    // by a specific instance shall be provided by the sysconf() function.
+
+    assert (BC_BASE_MAX        != 0 /* >= _POSIX2_BC_BASE_MAX */ );
+    assert (BC_DIM_MAX         != 0 /* >= _POSIX2_BC_DIM_MAX */ );
+    assert (BC_SCALE_MAX       != 0 /* >= _POSIX2_BC_SCALE_MAX */ );
+    assert (BC_STRING_MAX      != 0 /* >= _POSIX2_BC_STRING_MAX */ );
+    assert (CHARCLASS_NAME_MAX != 0 /* >= _POSIX2_CHARCLASS_NAME_MAX */ );
+    assert (COLL_WEIGHTS_MAX   != 0 /* >= _POSIX2_COLL_WEIGHTS_MAX */ );
+    assert (EXPR_NEST_MAX      != 0 /* >= _POSIX2_EXPR_NEST_MAX */ );
+    assert (LINE_MAX           != 0 /* >= _POSIX2_LINE_MAX */ );
+    assert (NGROUPS_MAX        != 0 /* >= _POSIX_NGROUPS_MAX */ );
+    assert (RE_DUP_MAX         != 0 /* >= _POSIX2_RE_DUP_MAX */ );
+
+    // Minimum Values
+
+    // The symbolic constants in the following list shall be defined
+    // in <limits.h> with the values shown. These are symbolic names
+    // for the most restrictive value for certain features on an
+    // implementation conforming to this volume of IEEE Std 1003.1-2001.
+    // Related symbolic constants are defined elsewhere in this volume
+    // of IEEE Std 1003.1-2001 which reflect the actual implementation
+    // and which need not be as restrictive. A conforming implementation
+    // shall provide values at least this large. A strictly conforming
+    // application must not require a larger value for correct operation.
+
+    assert (_POSIX_ARG_MAX        ==  4096);
+    assert (_POSIX_CHILD_MAX      ==    25);
+    assert (_POSIX_HOST_NAME_MAX  ==   255);
+    assert (_POSIX_LINK_MAX       ==     8);
+    assert (_POSIX_LOGIN_NAME_MAX ==     9);
+    assert (_POSIX_MAX_CANON      ==   255);
+    assert (_POSIX_MAX_INPUT      ==   255);
+    assert (_POSIX_NAME_MAX       ==    14);
+    assert (_POSIX_NGROUPS_MAX    ==     8);
+    assert (_POSIX_OPEN_MAX       ==    20);
+    assert (_POSIX_PATH_MAX       ==   256);
+    assert (_POSIX_PIPE_BUF       ==   512);
+    assert (_POSIX_RE_DUP_MAX     ==   255);
+    assert (_POSIX_SSIZE_MAX      == 32767);
+    assert (_POSIX_STREAM_MAX     ==     8);
+    assert (_POSIX_SYMLINK_MAX    ==   255);
+    assert (_POSIX_SYMLOOP_MAX    ==     8);
+    assert (_POSIX_TTY_NAME_MAX   ==     9);
+    assert (_POSIX_TZNAME_MAX     ==     6);
+
+#  ifdef _POSIX2_VERSION
+
+    assert (_POSIX2_BC_BASE_MAX        ==   99);
+    assert (_POSIX2_BC_DIM_MAX         == 2048);
+    assert (_POSIX2_BC_SCALE_MAX       ==   99);
+    assert (_POSIX2_BC_STRING_MAX      == 1000);
+    assert (_POSIX2_CHARCLASS_NAME_MAX ==   14);
+    assert (_POSIX2_COLL_WEIGHTS_MAX   ==    2);
+    assert (_POSIX2_EXPR_NEST_MAX      ==   32);
+    assert (_POSIX2_LINE_MAX           == 2048);
+    assert (_POSIX2_RE_DUP_MAX         ==  255);
+
+#  endif   // _POSIX2_VERSION
+
+#endif   // UNIX && !EDG eccp
+
+    // Numerical Limits
+
+    // The values in the following lists shall be defined in <limits.h>
+    // and are constant expressions suitable for use in #if preprocessing
+    // directives. Moreover, except for {CHAR_BIT}, {DBL_DIG}, {DBL_MAX},
+    // {FLT_DIG}, {FLT_MAX}, {LONG_BIT}, {WORD_BIT}, and {MB_LEN_MAX},
+    // the symbolic names are defined as expressions of the correct type.
+
+    // If the value of an object of type char is treated as a signed
+    // integer when used in an expression, the value of {CHAR_MIN} is
+    // the same as that of {SCHAR_MIN} and the value of {CHAR_MAX} is
+    // the same as that of {SCHAR_MAX}. Otherwise, the value of
+    // {CHAR_MIN} is 0 and the value of {CHAR_MAX} is the same as that
+    // of {UCHAR_MAX}.
+
+    assert (CHAR_BIT   == 8);
+    assert (CHAR_MAX   == UCHAR_MAX || CHAR_MAX == SCHAR_MAX);
+    assert (CHAR_MIN   == SCHAR_MIN || CHAR_MIN == 0);
+    assert (INT_MAX    >= 2147483647);
+    assert (LONG_MAX   >= +2147483647);
+    assert (MB_LEN_MAX >= 1);
+    assert (SCHAR_MAX  == +127);
+    assert (SHRT_MAX   >= +32767);
+
+#ifndef _RWSTD_EDG_ECCP
+
+    // avoid exercising with the EDG eccp front end (strict mode)
+    assert (LONG_BIT   >= 32);
+    assert (SSIZE_MAX  >= _POSIX_SSIZE_MAX);
+    assert (WORD_BIT   >= 32);
+
+#endif   // EDG eccp
+
+    assert (UCHAR_MAX  >= 255);
+    assert (UINT_MAX   >= 4294967295);
+    assert (ULONG_MAX  >= 4294967295);
+    assert (USHRT_MAX  >= 65535);
+    assert (INT_MIN    <= -2147483647);
+    assert (LONG_MIN   != 0);
+    assert (SCHAR_MIN  == -128);
+    assert (SHRT_MIN   != 0);
+
+#ifndef _RWSTD_NO_LONG_LONG
+
+    assert (LLONG_MIN  != 0);
+    assert (LLONG_MAX  >= +9223372036854775807LL);
+    assert (ULLONG_MAX >= 18446744073709551615ULL);
+
+#endif   // _RWSTD_NO_LONG_LONG
+
+    return 0;
+}

Propchange: stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: stdcxx/branches/4.2.x/tests/regress/18.c.limits.stdcxx-988.cpp
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message