https://bugs.llvm.org/show_bug.cgi?id=51837

            Bug ID: 51837
           Summary: inconsistent handling of #pragma message
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

// Given a simple source like
#pragma message("foobar")


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

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

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

> clang -c -W#pragma-messages test2.cpp
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:
> clang -c  -Werror  -W#pragma-messages test2.cpp
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to