[cfe-dev] supress Clang deperecated header warning [gcc's -Wcpp]

Nico Weber thakis at chromium.org
Mon May 19 00:15:44 PDT 2014


This seems to do the trick over here:

$ cat CMakeLists.txt
project(test)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-#warnings" )
add_executable(foo foo.cc)


On Mon, May 19, 2014 at 12:07 AM, Rashad M <mohammedrashadkm at gmail.com>wrote:

> Thanks Nico. Indeed that supressed that warning.
>
> Now my issue happens to be with cmake which cannot add this flag. I had
> asked that question on cmake list.
>
> Maybe cmake is not able to parse warning flag with # symbol
>
>
> On Mon, May 19, 2014 at 8:40 AM, Nico Weber <thakis at chromium.org> wrote:
>
>> It looks like this is just a #warning, not a "real" deprecation warning
>> from looking at that source file.
>>
>> clang prints "./test.h:7:3: warning: "deprecated" [-W#warnings]" for me,
>> and passing -Wno-#warnings makes it go away.
>>
>>
>> On Sun, May 18, 2014 at 11:27 PM, Rashad M <mohammedrashadkm at gmail.com>wrote:
>>
>>>
>>> Hi all,
>>>
>>> For GNU C++ compiler i got warning deprecated header #Wcpp and I can
>>> easily turn off it using -Wno-cpp. The same flag does not have any effect
>>> on a clang compiler.
>>>
>>> gcc version: 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)
>>>
>>> clang version: 3.3 (tags/RELEASE_33/final)
>>>
>>> OS: Fedora 20 x86_64 Linux
>>>
>>> Does anybody know the correct flag and its usage.
>>>
>>> Warning output:
>>>
>>> vcl_deprecated_header.h:10:3: warning: #warning "deprecated" [-Wcpp] #
>>> warning "deprecated"
>>>
>>> I tried -Wno-deperecated but without any success. Removing the inclusion
>>> of the deprecated header is not something I want. This is because for some
>>> specific build for clang I want to disable this warning. But by default for
>>> anyone who compiles the warning should appear. And No, using -w to suppress
>>> everything is not something I want to do.
>>>
>>> In GCC, g++ i can disable it via -Wno-cpp and gcc says
>>>
>>> vcl_deprecated_header.h:10:3: warning: #warning "deprecated" [-Wcpp] #
>>> warning "-Wcpp"
>>>
>>> header source : vcl_deprecated.h<http://sourceforge.net/p/vxl/git/ci/master/tree/vcl/vcl_deprecated_header.h>
>>>
>>>
>>> Thanks for any help
>>>
>>> --
>>> Regards,
>>>    Rashad
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>
>>>
>>
>
>
> --
> Regards,
>    Rashad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140519/2190a691/attachment.html>


More information about the cfe-dev mailing list