Ignore system headers in clang-tidy : <p><strong>tldr;> How do I hide warnings from system headers in clang-tidy?</strong></p>

<p>I have the following minimal example source file, which triggers a clang-tidy warning in the system headers:</p>

<pre><code>#include &lt;future&gt;

int main() {
  std::promise&lt;int&gt; p;
  p.set_value(3);
}
</code></pre>

<p>Calling it with libstdc++ 7.0.1 using clang-tidy 4.0.0 on Ubuntu 17.04:</p>

<pre><code>$ clang-tidy main.cpp -extra-arg=-std=c++14
</code></pre>

<p>yields</p>

<pre><code>Running without flags.
1 warning generated.
/usr/lib/gcc/x86_64-linux-gnu/7.0.1/../../../../include/c++/7.0.1/mutex:693:5: warning: Address of stack memory associated with local variable '__callable' is still referred to by the global variable '__once_callable' upon returning to the caller.  This will be a dangling reference [clang-analyzer-core.StackAddressEscape]
    }
    ^
/home/user/main.cpp:5:3: note: Calling 'promise::set_value'
  p.set_value(3);
  ^
/usr/lib/gcc/x86_64-linux-gnu/7.0.1/../../../../include/c++/7.0.1/future:1094:9: note: Calling '_State_baseV2::_M_set_result'
      { _M_future-&gt;_M_set_result(_State::__setter(this, std::move(__r))); }
        ^
/usr/lib/gcc/x86_64-linux-gnu/7.0.1/../../../../include/c++/7.0.1/future:401:2: note: Calling 'call_once'
        call_once(_M_once, &amp;_State_baseV2::_M_do_set, this,
        ^
/usr/lib/gcc/x86_64-linux-gnu/7.0.1/../../../../include/c++/7.0.1/mutex:691:11: note: Assuming '__e' is 0
      if (__e)
          ^
/usr/lib/gcc/x86_64-linux-gnu/7.0.1/../../../../include/c++/7.0.1/mutex:691:7: note: Taking false branch
      if (__e)
      ^
/usr/lib/gcc/x86_64-linux-gnu/7.0.1/../../../../include/c++/7.0.1/mutex:693:5: note: Address of stack memory associated with local variable '__callable' is still referred to by the global variable '__once_callable' upon returning to the caller.  This will be a dangling reference
    }
</code></pre>

<p>I want to hide warnings in system headers. I tried the following:</p>

<pre><code>$ clang-tidy -extra-arg=-std=c++14 main.cpp -header-filter=$(realpath .) -system-headers=0
</code></pre>

<p>but the warning still shows.</p>
