In a project, I use (a somewhat old version of) VTK, which produces a deprecated warning on GCC:
In file included from <path STL>/backward/strstream:51:0,
from <path VTK>/vtkIOStream.h:112,
from <path VTK>/vtkSystemIncludes.h:40,
from <path VTK>/vtkIndent.h:24,
from <path VTK>/vtkObjectBase.h:43,
from <path VTK>/vtkSmartPointerBase.h:26,
from <path VTK>/vtkSmartPointer.h:23,
from <some file in my project>
<path STL>/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
I want to suppress that warning. What I tried so far was trying to use pragma directives along the culprit line:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wno-deprecated"
#include <vtkSmartPointer.h>
#pragma GCC diagnostic pop
as recommended in an answer to How to suppress several warnings but not all of them coming from libraries?
This however does not work because the command does not recognize my option:
warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
#pragma GCC diagnostic ignored "-Wno-deprecated"
I wanted to be specific here with what type of warning I disable. An answer that gives me a less specific option would also be welcome, though. I tried with it "-Wall", but that doesn't work either (recognized but does not suppress).
Compiling the whole project with -Wno-deprecated suppresses the warning, and this is my fallback option, but not one I like to go with.
Emphasis of mine is that it works under Linux with GCC. I have no administration rights, can't change the VTK version here or the version of GCC (4.8.5).