------- Comment #8 from manu at gcc dot gnu dot org 2008-03-20 23:54 ------- OK. I see now what the problem is: -pedantic nothing, -pedantic-errors gives an error. The pedantic warning is in a system header, so it doesn't get emitted. When using -pedantic-errors, it is an error, so it gets through. This is an issue also for the C front-end that nobody noticed until now. The problem is in diagnostics.c (diagnostic_report_diagnostic) which tests for DK_WARNING whether they are inhibited by -w or within system headers, while pedwarn() is passing a DK_ERROR when -pedantic-errors is enabled.
In my opinion, neither should give diagnostics for system headers unless requested (so I would add -Wsystem-headers to your testcases). The fix is that pedwarn() always passes a DK_WARNING type, while -pedantic-errors reclassifies -pedantic warnings to emit errors. In other words, -pedantic-errors would behave internally like -Werror=pedantic. I don't have time to work on this (or anything else in GCC) at the moment but I will keep it in my TODO list. Again, I would recommend adding -Wsystem-headers to your testcases to get diagnostics about system headers. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35637