Włączony parametr "-Werror" a wybrane warning jako warning a nie error

1

kompiluje z takimi parametrami: -Wall -Wextra -Werror -fPIC -Werror=return-type
chciałbym jednak aby dla funkcji zaznaczonych jako deprecated wyświetliły się warning a nie jako error

#include <iostream>

#pragma GCC diagnostic push
// #pragma nie wiem co ????

[[deprecated]]
void TriassicPeriod()
{
    std::clog << "Triassic Period: [251.9 - 208.5] million years ago.\n";
}
 
[[deprecated("Use NeogenePeriod() instead.")]]
void JurassicPeriod()
{
    std::clog << "Jurassic Period: [201.3 - 152.1] million years ago.\n";
}
 
[[deprecated("Use calcSomethingDifferently(int).")]]    
int calcSomething(int x)
{
    return x * 2;
}

#pragma GCC diagnostic pop

int main()
{
    TriassicPeriod();
    JurassicPeriod();
}

https://godbolt.org/z/fjf3h9Kb5

5

-Wno-error=deprecated-declarations
https://godbolt.org/z/5oaa9Er8G

Warning Options (Using the GNU Compiler Collection (GCC))

-Wno-attribute-warning

Do not warn about usage of functions (see Declaring Attributes of Functions) declared with warning attribute. By default, this warning is enabled. -Wno-attribute-warning can be used to disable the warning or -Wno-error=attribute-warning can be used to disable the error when compiled with -Werror flag.

0

Dziękuje , dokładnie tego szukałem !

1 użytkowników online, w tym zalogowanych: 0, gości: 1