Allen Bierbaum wrote:
> [..]
>>   
>>> We need to clean up headers at some point anyway, I'm just trying to 
>>> think about a way to automate the discovery process (figuring all that 
>>> out manually will be painful...).
>>>     
>> I don't know if this is strictly related to cleaning up the headers, but I
>> have been making some changes today to silence unused variable warnings in
>> some .inl files. Warnings from OpenSG .h and .inl files are plentiful enough
>> that I needed to get the compiler to quiet down so that I could find error
>> messages. I could do some more work on this front and submit that patch if
>> there is interest.
>>   
> I am interested.  I hate warnings that can be ignored because the end up 
> making me ignore warnings that I should pay attention to. :)

Here is what I have. This patch allows PyOpenSG and OpenManip to build
without any warnings from OpenSG 2 code. I verified this by building both
with -Werror.

The convention I used for handling unused method parameters was to remove
the parameter name in .inl files and to comment out the name for inlined
functions in .h files. My thinking was that the information in the .h file
about the variable name would be important for understanding the intention
even though the inlined implementation did not use the variable(s).

 -Patrick


-- 
Patrick L. Hartling
VP Engineering, Infiscape Corp.
http://www.infiscape.com/
Index: 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h
===================================================================
--- 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h
 (revision 689)
+++ 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoIntegralProperty.h
 (working copy)
@@ -328,7 +328,7 @@
         return "TypedGeoIntegralProperty";  
     }
 
-    static void initMethod(InitPhase ePhase) {}
+    static void initMethod(InitPhase /* ePhase */) {}
 
     static UInt32         getStride    (void) { return 0; }
 
Index: 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h
===================================================================
--- 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h
   (revision 689)
+++ 
Source/System/NodeCores/Drawables/Geometry/Properties/OSGTypedGeoVectorProperty.h
   (working copy)
@@ -422,7 +422,7 @@
         return "TypedGeoVectorProperty";
     }
 
-    static void initMethod(InitPhase ePhase) {}
+    static void initMethod(InitPhase /* ePhase */) {}
 
     static UInt32             getStride    (void) { return 0;               }
 
@@ -449,7 +449,7 @@
         return "TypedNormGeoVectorProperty";
     }
 
-    static void initMethod(InitPhase ePhase) {}
+    static void initMethod(InitPhase /* ePhase */) {}
 
     static UInt32             getStride    (void) { return 0;               }
 
Index: Source/System/RenderingBackend/OSGStageValidator.inl
===================================================================
--- Source/System/RenderingBackend/OSGStageValidator.inl        (revision 689)
+++ Source/System/RenderingBackend/OSGStageValidator.inl        (working copy)
@@ -51,7 +51,7 @@
     if(iStageId < 0)
         return Self::Unknown;
 
-    if(_vStatusStore.size() <= iStageId)
+    if(_vStatusStore.size() <= static_cast<UInt32>(iStageId))
     {
         StageStatus tmpStat;
         
Index: Source/System/FieldContainer/Fields/OSGChangedFunctorMFields.h
===================================================================
--- Source/System/FieldContainer/Fields/OSGChangedFunctorMFields.h      
(revision 689)
+++ Source/System/FieldContainer/Fields/OSGChangedFunctorMFields.h      
(working copy)
@@ -56,7 +56,7 @@
 // there is no good way of comparing boost function objects
 template<> inline
 bool MField<ChangedFunctorCallback, 0>::operator ==(
-    const MField<ChangedFunctorCallback, 0> &source) const
+    const MField<ChangedFunctorCallback, 0> & /* source */) const
 {
     return false;
 }
Index: Source/System/FieldContainer/Fields/OSGFieldBundleFieldTraits.h
===================================================================
--- Source/System/FieldContainer/Fields/OSGFieldBundleFieldTraits.h     
(revision 689)
+++ Source/System/FieldContainer/Fields/OSGFieldBundleFieldTraits.h     
(working copy)
@@ -146,8 +146,8 @@
         return sizeof(UInt32) * uiNumObjects;
     }
 
-    static void copyToBin(      BinaryDataHandler  &pMem, 
-                          const ParentFieldBundleP &pObject)
+    static void copyToBin(      BinaryDataHandler  & /* pMem */,
+                          const ParentFieldBundleP & /* pObject */)
     {
     }
     static void copyToBin(      BinaryDataHandler  &pMem, 
@@ -160,13 +160,13 @@
         }
     }
 
-    static void copyFromBin(BinaryDataHandler  &pMem, 
-                            ParentFieldBundleP &pObject)
+    static void copyFromBin(BinaryDataHandler  & /* pMem */,
+                            ParentFieldBundleP & /* pObject */)
     {
     }
-    static void copyFromBin(BinaryDataHandler  &pMem, 
-                            ParentFieldBundleP *pObjectStore,
-                            UInt32              uiNumObjects)
+    static void copyFromBin(BinaryDataHandler  & /* pMem */,
+                            ParentFieldBundleP * /* pObjectStore */,
+                            UInt32               /* uiNumObjects */)
     {
     }
 };
Index: Source/System/FieldContainer/Mixins/OSGSimpleAttachment.inl
===================================================================
--- Source/System/FieldContainer/Mixins/OSGSimpleAttachment.inl (revision 689)
+++ Source/System/FieldContainer/Mixins/OSGSimpleAttachment.inl (working copy)
@@ -105,11 +105,11 @@
 #ifdef OSG_MT_FIELDCONTAINERPTR
 template <class AttachmentDescT> inline
 void SimpleAttachment<AttachmentDescT>::execSync(      
-          SimpleAttachment   *pFrom,
-          ConstFieldMaskArg   whichField,
-          ConstFieldMaskArg   syncMode  ,
-    const UInt32              uiSyncInfo,
-          UInt32              uiCopyOffset)
+          SimpleAttachment   *,
+          ConstFieldMaskArg   ,
+          ConstFieldMaskArg   ,
+    const UInt32              ,
+          UInt32              )
 {
 }
 
@@ -233,8 +233,8 @@
 
 template <class AttachmentDescT> inline
 void SimpleAttachment<AttachmentDescT>::dump(
-          UInt32    uiIndent, 
-    const BitVector bvFlags) const
+          UInt32    , 
+    const BitVector ) const
 {
 }
 
Index: Source/System/FieldContainer/Base/OSGReflexiveContainer.inl
===================================================================
--- Source/System/FieldContainer/Base/OSGReflexiveContainer.inl (revision 689)
+++ Source/System/FieldContainer/Base/OSGReflexiveContainer.inl (working copy)
@@ -179,7 +179,7 @@
 }
 
 inline
-ReflexiveContainer::ReflexiveContainer(const ReflexiveContainer &source) :
+ReflexiveContainer::ReflexiveContainer(const ReflexiveContainer &) :
     _bvChanged        (TypeTraits<BitVector>::BitsClear),
     _pContainerChanges(NULL                            )
 {
@@ -199,7 +199,7 @@
 
 
 inline
-void ReflexiveContainer::initMethod(InitPhase ePhase)
+void ReflexiveContainer::initMethod(InitPhase)
 {
 }
 
@@ -214,8 +214,8 @@
 }
 
 inline
-void ReflexiveContainer::onDestroyAspect(UInt32 uiContainerId,
-                                         UInt32 uiAspect     )
+void ReflexiveContainer::onDestroyAspect(UInt32 ,
+                                         UInt32 )
 {
 }
 
Index: Source/System/FieldContainer/Base/OSGFieldContainer.inl
===================================================================
--- Source/System/FieldContainer/Base/OSGFieldContainer.inl     (revision 689)
+++ Source/System/FieldContainer/Base/OSGFieldContainer.inl     (working copy)
@@ -36,6 +36,8 @@
  *                                                                           *
 \*---------------------------------------------------------------------------*/
 
+#include <boost/concept_check.hpp>
+
 OSG_BEGIN_NAMESPACE
 
 /*-------------------------------------------------------------------------*/
@@ -61,7 +63,7 @@
 
 inline
 void FieldContainer::changed(ConstFieldMaskArg whichField, 
-                             UInt32            origin    )
+                             UInt32                      )
 {
     callChangedFunctors(whichField);
 }
@@ -370,7 +372,7 @@
 }
 
 inline
-void FieldContainer::onCreate(const FieldContainer *source)
+void FieldContainer::onCreate(const FieldContainer *)
 {
     registerChangedContainer();
     
@@ -387,6 +389,8 @@
     _pAspectStore->removePtrForAspect(Thread::getCurrentAspect());
 
     OSG::subRef(_pAspectStore);
+#else
+    boost::ignore_unused_variable_warning(uiContainerId);
 #endif
 }
 
Index: Source/System/FieldContainer/Base/OSGFieldBundle.inl
===================================================================
--- Source/System/FieldContainer/Base/OSGFieldBundle.inl        (revision 689)
+++ Source/System/FieldContainer/Base/OSGFieldBundle.inl        (working copy)
@@ -39,7 +39,7 @@
 OSG_BEGIN_NAMESPACE
 
 inline
-void FieldBundle::editSField(ConstFieldMaskArg whichField)
+void FieldBundle::editSField(ConstFieldMaskArg /*whichField*/)
 {
 #if 0
     if(_bvChanged == TypeTraits<BitVector>::BitsClear)
Index: Source/System/Statistics/Base/OSGStatCollector.h
===================================================================
--- Source/System/Statistics/Base/OSGStatCollector.h    (revision 689)
+++ Source/System/Statistics/Base/OSGStatCollector.h    (working copy)
@@ -217,25 +217,25 @@
         return 0;
     }
 
-    static void copyToBin(      BinaryDataHandler &pMem,
-                          const StatCollectorP    &oObject)
+    static void copyToBin(      BinaryDataHandler & /* pMem */,
+                          const StatCollectorP    & /* oObject */)
     {
     }
 
-    static void copyToBin(      BinaryDataHandler &pMem,
-                          const StatCollectorP    *pObjectStore,
-                                UInt32             uiNumObjects)
+    static void copyToBin(      BinaryDataHandler & /* pMem */,
+                          const StatCollectorP    * /* pObjectStore */,
+                                UInt32              /* uiNumObjects */)
     {
     }
 
-    static void copyFromBin(BinaryDataHandler &pMem,
-                            StatCollectorP    &oObject)
+    static void copyFromBin(BinaryDataHandler & /* pMem */,
+                            StatCollectorP    & /* oObject */)
     {
     }
 
-    static void copyFromBin(BinaryDataHandler &pMem,
-                            StatCollectorP    *pObjectStore,
-                            UInt32             uiNumObjects)
+    static void copyFromBin(BinaryDataHandler & /* pMem */,
+                            StatCollectorP    * /* pObjectStore */,
+                            UInt32              /* uiNumObjects */)
     {
     }
 };
Index: Source/Base/Field/OSGMFieldVector.inl
===================================================================
--- Source/Base/Field/OSGMFieldVector.inl       (revision 689)
+++ Source/Base/Field/OSGMFieldVector.inl       (working copy)
@@ -155,7 +155,7 @@
 
 template <> inline
 void MFieldVector<UInt32>::dump(      UInt32    uiIndent,
-                                const BitVector bvFlags ) const
+                                const BitVector         ) const
 {
     for(UInt32 i = 0; i < uiIndent; ++i)
         fprintf(stderr, " ");
Index: Source/Base/Threading/OSGCondVar.inl
===================================================================
--- Source/Base/Threading/OSGCondVar.inl        (revision 689)
+++ Source/Base/Threading/OSGCondVar.inl        (working copy)
@@ -63,17 +63,13 @@
 inline
 void PThreadCondVarBase::signal()
 {
-    const int result = pthread_cond_signal(&(_pLowLevelCondVar));
-    //assert(result == 0);
-    //boost::ignore_unused_variable_warning(result);
+    pthread_cond_signal(&(_pLowLevelCondVar));
 }
 
 inline
 void PThreadCondVarBase::broadcast()
 {
-    const int result = pthread_cond_broadcast(&(_pLowLevelCondVar));
-    //assert(result == 0);
-    //boost::ignore_unused_variable_warning(result);
+    pthread_cond_broadcast(&(_pLowLevelCondVar));
 }
 
 #endif /* OSG_USE_PTHREADS */
Index: Source/Base/Threading/OSGLockPolicies.inl
===================================================================
--- Source/Base/Threading/OSGLockPolicies.inl   (revision 689)
+++ Source/Base/Threading/OSGLockPolicies.inl   (working copy)
@@ -137,12 +137,14 @@
 bool SingleStaticInitLockPolicy::init(void)
 {
     _pLock = Lock::create();
+    return true;
 }
 
 inline
 bool SingleStaticInitLockPolicy::shutdown(void)
 {
     OSG::clearRef(_pLock);
+    return true;
 }
 
 inline
Index: Source/Base/Base/OSGFixed.inl
===================================================================
--- Source/Base/Base/OSGFixed.inl       (revision 689)
+++ Source/Base/Base/OSGFixed.inl       (working copy)
@@ -312,7 +312,7 @@
 }
 
 inline
-std::ostream &operator << (std::ostream &os, Fixed32 fVal)
+std::ostream &operator << (std::ostream &os, Fixed32)
 {
     return os;
 }
Index: Source/Base/Base/OSGBaseTypeTraits.h
===================================================================
--- Source/Base/Base/OSGBaseTypeTraits.h        (revision 689)
+++ Source/Base/Base/OSGBaseTypeTraits.h        (working copy)
@@ -1139,7 +1139,7 @@
 
 
     static Fixed32 getFromCString   (const Char8 * pData,
-                                           Char8 *&pDataEnd)
+                                           Char8 *& /* pDataEnd */)
     {
         if(pData != NULL)
         {
@@ -1158,8 +1158,8 @@
         return getFromCString(pData, pDataEnd);
     }
 
-    static void putToString(const Fixed32      val,
-                                  std::string &out)
+    static void putToString(const Fixed32       /* val */,
+                                  std::string & /* out */)
     {
 /*
         Char8 buffer[20];

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to