[LLVMbugs] [Bug 22691] New: Incompatible behavior and warning for '#pragma GCC diagnostic pop' with no corresponding push

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 25 01:24:31 PST 2015


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: unassignedclangbugs at nondot.org
          Reporter: ulfalizer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150225/c4894bb1/attachment.html>


More information about the llvm-bugs mailing list