[vtk-developers] void const TestVoidConstReturn() warning

Bill Lorensen bill.lorensen at gmail.com
Wed Dec 28 14:12:15 EST 2011


I think it is a valid warning and the code should be corrected by
removing the const in the code. I know that we remove these in itk.


On Wed, Dec 28, 2011 at 1:13 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> On Wed, Dec 28, 2011 at 10:21 AM, David Doria <daviddoria at gmail.com> wrote:
>> I missed some warnings on a recent patch because I turned off -Werror
>> because line 612 in TestCxxFeatures.cxx warns:
>>
>> // gcc>=4.3 says type qualifiers ignored on function return type
>> #if !defined(__HP_aCC)
>> void const TestVoidConstReturn() {}
>> #endif
>>
>> I am indeed using gcc >= 4.3 and I get (as it says in the comment) a warning
>> about the type qualifier being ignored. Is there anything that can be done
>> to suppress this warning on gcc >= 4.3?
>
> You should be able to suppress it with pragmas.
> Try adding this to TestCxxFeatures.cxx just before the test:
>
> #if defined(__GNUC__) && (__GNUC__ >= 4)
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wignored-qualifiers"
> #endif
>
> And this just after the test:
>
> #if defined(__GNUC__) && (__GNUC__ >= 4)
> #pragma GCC diagnostic pop
> #endif
>
> There are already suppressions in the file for several other compilers
> (clang, icc, msvc).
>
>  - David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



-- 
Unpaid intern in BillsBasement at noware dot com



More information about the vtk-developers mailing list