stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r465641 - in /incubator/stdcxx/trunk/tests: include/driver.h src/driver.cpp src/opt_trace.cpp src/opt_trace.h
Date Thu, 19 Oct 2006 14:15:57 GMT
Author: faridz
Date: Thu Oct 19 07:15:56 2006
New Revision: 465641

URL: http://svn.apache.org/viewvc?view=rev&rev=465641
Log:
2006-10-19 Farid Zaripov <faridz@kyiv.vdiweb.com>

	* driver.h (rw_enable): New function to enable/disable
	specified diagnostics
	* driver.cpp (rw_enable): New function to enable/disable
	specified diagnostics
	(_rw_vdiag): Added checking whether the diagnostic
	is enabled or disabled
	* opt_trace.h: Added declaration of the _rw_diag_ignore variable
	* opt_trace.cpp: Added definition of the _rw_diag_ignore variable

Modified:
    incubator/stdcxx/trunk/tests/include/driver.h
    incubator/stdcxx/trunk/tests/src/driver.cpp
    incubator/stdcxx/trunk/tests/src/opt_trace.cpp
    incubator/stdcxx/trunk/tests/src/opt_trace.h

Modified: incubator/stdcxx/trunk/tests/include/driver.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/include/driver.h?view=diff&rev=465641&r1=465640&r2=465641
==============================================================================
--- incubator/stdcxx/trunk/tests/include/driver.h (original)
+++ incubator/stdcxx/trunk/tests/include/driver.h Thu Oct 19 07:15:56 2006
@@ -6,16 +6,23 @@
  *
  ***************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed 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.
+ * 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 1994-2005 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -150,5 +157,15 @@
  */
 _TEST_EXPORT int
 rw_info (int, const char*, int, const char*, ...);
+
+/**
+* Enable/disable the specified diagnostics
+*
+* Example:
+*   rw_enable (rw_error, false); // disable all rw_error diagnostics
+*   rw_enable (rw_error);        // enable all rw_error diagnostics
+*/
+_TEST_EXPORT void
+rw_enable (int (*) (int, const char*, int, const char*, ...), bool = true);
 
 #endif   // RW_DRIVER_H_INCLUDED

Modified: incubator/stdcxx/trunk/tests/src/driver.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/driver.cpp?view=diff&rev=465641&r1=465640&r2=465641
==============================================================================
--- incubator/stdcxx/trunk/tests/src/driver.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/driver.cpp Thu Oct 19 07:15:56 2006
@@ -6,23 +6,24 @@
  *
  ************************************************************************
  *
- * Copyright 2005-2006 The Apache Software Foundation or its licensors,
- * as applicable.
+ * 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
  *
- * Copyright 2005-2006 Rogue Wave Software.
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Licensed 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
+ * 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.
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * Copyright 2005-2006 Rogue Wave Software.
  *
- * 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.
- * 
  **************************************************************************/
 
 // expand _TEST_EXPORT macros
@@ -1378,6 +1379,10 @@
 _rw_vdiag (diag_t diag, int severity, const char *file, int line,
            const char *fmt, va_list va)
 {
+    // ignore this diagnostic if it's present in _rw_diag_ignore
+    if (_rw_diag_ignore & (1 << diag))
+        return;
+
     CHECK_INIT (true, "_rw_vdiag()");
 
     // check if the diagnostic is expected
@@ -1534,4 +1539,35 @@
     va_end (va);
 
     return success;
+}
+
+/************************************************************************/
+
+_TEST_EXPORT void
+rw_enable (int (*fun) (int, const char*, int, const char*, ...), bool enable)
+{
+    diag_t diag;
+
+    if (&rw_fatal == fun)
+        diag = diag_fatal;
+    else if (&rw_error == fun)
+        diag = diag_error;
+    else if (&rw_assert == fun)
+        diag = diag_assert;
+    else if (&rw_warn == fun)
+        diag = diag_warn;
+    else if (&rw_note == fun)
+        diag = diag_note;
+    else if (&rw_info == fun)
+        diag = diag_info;
+    else {
+        RW_ASSERT (!"Invalid function in rw_enable");
+        return;
+    }
+
+    // if (enable)
+    //     _rw_diag_ignore &= ~(1 << diag);
+    // else
+    //     _rw_diag_ignore |= 1 << diag;
+    _rw_diag_ignore ^= ((enable - 1) ^ _rw_diag_ignore) & (1 << diag);
 }

Modified: incubator/stdcxx/trunk/tests/src/opt_trace.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/opt_trace.cpp?view=diff&rev=465641&r1=465640&r2=465641
==============================================================================
--- incubator/stdcxx/trunk/tests/src/opt_trace.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/opt_trace.cpp Thu Oct 19 07:15:56 2006
@@ -2,20 +2,27 @@
  *
  * opt_trace.cpp - definitions of tracing option handlers
  *
- * $Id:$
+ * $Id$
  *
  ************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed 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.
+ * 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 1994-2005 Rogue Wave Software.
  *
  **************************************************************************/
 
@@ -32,6 +39,9 @@
 
 // masked diagnostics (those that shouldn't be issued)
 int _rw_diag_mask = 1 << diag_trace;
+
+// bitmap of diagnostics to ignore
+int _rw_diag_ignore = 0;
 
 
 int

Modified: incubator/stdcxx/trunk/tests/src/opt_trace.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/opt_trace.h?view=diff&rev=465641&r1=465640&r2=465641
==============================================================================
--- incubator/stdcxx/trunk/tests/src/opt_trace.h (original)
+++ incubator/stdcxx/trunk/tests/src/opt_trace.h Thu Oct 19 07:15:56 2006
@@ -2,20 +2,27 @@
  *
  * opt_trace.h - declarations of tracing option handlers
  *
- * $Id:$
+ * $Id$
  *
  ************************************************************************
  *
- * Copyright (c) 1994-2005 Quovadx,  Inc., acting through its  Rogue Wave
- * Software division. Licensed 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.
+ * 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 1994-2005 Rogue Wave Software.
  *
  **************************************************************************/
 
@@ -29,6 +36,10 @@
 // diagnostics enabled by defaults
 extern int
 _rw_diag_mask;
+
+// ignored diagnostics bitmap
+extern int
+_rw_diag_ignore;
 
 
 int



Mime
View raw message