jgoenetxea
2/13/2019 - 9:13 AM

How to remove warnings from dependencies

How to avoid warnings generated in depenencies

#pragma GCC diagnostic push
// save the current state for diagnostics

#pragma GCC diagnostic ignored "-Wunused-parameter"
// turn off diagnostic for "-Wunused-parameter"  

#include "some_header.h"
// note: some_header.h contains: 
// template < typename T > int foo( T arg_foo ) { return 0 ; }

#pragma GCC diagnostic pop
// restores the saved state for diagnostics (diagnostics as specified in the command line)  

template < typename T > int bar( T arg_bar ) { return 0 ; }

// compiled with: -std=c++11 -O2 -Wall -Wextra -pedantic-errors

int main()
{
    foo(100) ; 

    bar(100) ; // *** warning: unused parameter 'arg_bar' [-Wunused-parameter]|
}