<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - inconsistent handling of #pragma message"
   href="https://bugs.llvm.org/show_bug.cgi?id=51837">51837</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>inconsistent handling of #pragma message
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Wolfgang_Pieb@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// Given a simple source like
#pragma message("foobar")


we get a warning when compiled with no extra options, -Werror, or
-W#pragma-messages:

<span class="quote">> clang -c test2.cpp</span >
test2.cpp:1:9: warning: foobar [-W#pragma-messages]
#pragma message("foobar")
        ^
1 warning generated.

<span class="quote">> clang -c -Werror test2.cpp</span >
test2.cpp:1:9: warning: foobar [-W#pragma-messages]
#pragma message("foobar")
        ^
1 warning generated.

<span class="quote">> clang -c -W#pragma-messages test2.cpp</span >
test2.cpp:1:9: warning: foobar [-W#pragma-messages]
#pragma message("foobar")
        ^
1 warning generated.


However, when compiled with both -Werror and -W#pragma-messages we get an
error:
<span class="quote">> clang -c  -Werror  -W#pragma-messages test2.cpp</span >
test2.cpp:1:9: error: foobar [-Werror,-W#pragma-messages]
#pragma message("foobar")
        ^
1 error generated.

The reason seems to be that the "NoWarningAsError" flag (which is present in
the descriptor for the pragma messages warning) is dropped during warning
options processing (probably in DiagnosticsEngine::setSeverity()) or
thereabouts.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>