[vtk-developers] void const TestVoidConstReturn() warning

David Cole david.cole at kitware.com
Wed Dec 28 14:23:43 EST 2011


David G. is correct, and the "void const" should be left in this file,
with the very nice set of self-documenting ifdefs surrounding it...
:-)


On Wed, Dec 28, 2011 at 2:18 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi Bill,
>
> The key is where the error appears: in TestCxxFeatures.cxx
> This file is there specifically to keep track of which compilers
> produce certain code warnings/errors.
>
> The pragmas in this file only suppress the warning in this file.
> These pragmas, if fact, serve as a reminder that a specific compiler
> will emit a certain warning when it runs across a certain construct.
>
> If a "void const" return is used anywhere else in VTK, the warning
> will still appear (as it should).
>
>  - David
>
>
> On Wed, Dec 28, 2011 at 12:12 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>> 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
> _______________________________________________
> 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
>



More information about the vtk-developers mailing list