Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 9100 invoked from network); 24 Apr 2008 16:43:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2008 16:43:20 -0000 Received: (qmail 8563 invoked by uid 500); 24 Apr 2008 16:43:22 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 8552 invoked by uid 500); 24 Apr 2008 16:43:22 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 8541 invoked by uid 99); 24 Apr 2008 16:43:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 09:43:21 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Farid_Zaripov@epam.com designates 217.21.63.3 as permitted sender) Received: from [217.21.63.3] (HELO EPMSA009.epam.com) (217.21.63.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2008 16:42:30 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: [PATCH] Determine the sizeof (CRITICAL_SECTION) at configure step Date: Thu, 24 Apr 2008 19:42:49 +0300 Message-ID: <7BDB2168BEAEF14C98F1901FD2DE64380212658C@epmsa009.minsk.epam.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] Determine the sizeof (CRITICAL_SECTION) at configure step Thread-Index: AcimKjr861OvOAyDRr+kA6GITwusLg== From: "Farid Zaripov" To: X-Virus-Checked: Checked by ClamAV on apache.org The sizeof (CRITICAL_SECTION) equal to 24 on _WIN32 and 40 on _WIN64. But in rw/_mutex.h now used the hardcoded value equal to 24. This is not causes any problems because we #define _RWSTD_NO_FWD_DECLARATIONS in rw/_config_msvcrt.h for _WIN64. I have tried to comment the #define _RWSTD_NO_FWD_DECLARATIONS in rw/_config_msvcrt.h and build (with applied the patch below) the library, examples and tests and found no problems. Perhaps somebody remembers why we #define _RWSTD_NO_FWD_DECLARATIONS for _WIN64? ChangeLog: * etc/config/src/CRITICAL_SECTION.cpp: New config test to determine the size of CRITICAL_SECTION structure. * include/rw/_config-msvcrt.h [_WIN64]: Remove #define _RWSTD_NO_FWD_DECLARATIONS * include/rw/_mutex.h (__rw_critical_section): Use _RWSTD_CRITICAL_SECTION_SIZE config macro instead of hardcoded value. ------------------------ Index: etc/config/src/CRITICAL_SECTION.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- etc/config/src/CRITICAL_SECTION.cpp (revision 0) +++ etc/config/src/CRITICAL_SECTION.cpp (revision 0) @@ -0,0 +1,34 @@ +// checking for size of CRITICAL_SECTION=20 + +/********************************************************************** ***** + * + * 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. + * + * Copyright 1999-2007 Rogue Wave Software, Inc. + *=20 + ************************************************************************ **/ + +#include +#include + +int main () +{ + printf ("#define _RWSTD_CRITICAL_SECTION_SIZE %u\n", + unsigned (sizeof (CRITICAL_SECTION))); + + return 0; +} Property changes on: etc\config\src\CRITICAL_SECTION.cpp ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Index: include/rw/_config-msvcrt.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/rw/_config-msvcrt.h (revision 651205) +++ include/rw/_config-msvcrt.h (working copy) @@ -93,11 +93,6 @@ # define _RWSTD_LONG_LONG __int64 #endif // _MSC_VER <=3D 1300 || _RWSTD_NO_LONG_LONG =20 -#if defined (_WIN64) - // FIXME: handle by forward declaring fuctions in -# define _RWSTD_NO_FWD_DECLARATIONS -#endif // _WIN64 - #if defined (WIN32) && !defined(_WIN32) # define _WIN32 #endif Index: include/rw/_mutex.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- include/rw/_mutex.h (revision 651205) +++ include/rw/_mutex.h (working copy) @@ -153,10 +153,16 @@ =20 _RWSTD_NAMESPACE (__rw) {=20 =20 +# ifdef _RWSTD_NO_CRITICAL_SECTION + // use 32-bit Windows value by default +# define _RWSTD_CRITICAL_SECTION_SIZE 24 +# endif // _RWSTD_NO_CRITICAL_SECTION + // fake critical section type union __rw_critical_section { long _C_pad; // force alignment - char _C_buf [24 /* =3D=3D sizeof (_RTL_CRITICAL_SECTION) */]; + // _RWSTD_CRITICAL_SECTION_SIZE =3D=3D sizeof = (_RTL_CRITICAL_SECTION)=20 + char _C_buf [_RWSTD_CRITICAL_SECTION_SIZE]; }; =20 # define _RWSTD_MUTEX_T _RW::__rw_critical_section ------------------------ Farid.