http://llvm.org/bugs/show_bug.cgi?id=22691

            Bug ID: 22691
           Summary: Incompatible behavior and warning for '#pragma GCC
                    diagnostic pop' with no corresponding push
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html states that "if a
pop has no matching push, the command-line options are restored". This matches
the actual behavior for GCC (provided you extend it to also mean that defaults
are restored for things not specified on the command-line, which makes sense).

In clang, a pop without a corresponding push generates a warning and does not
seem to restore warnings.

Test case:

void f(void) {
#pragma GCC diagnostic ignored "-Wunused-value"
    0;
#pragma GCC diagnostic pop
    0;
}

GCC generates a warning for the second '0;'. clang only generates a "warning:
pragma diagnostic pop could not pop, no matching push".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to