This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Why does -pedantic make long long an error in C++?


I just tracked down a build failure in mozilla 1.4.  It has an autoconf
test that does:

$ g++ -o conftest -O -DDEBIAN -fshort-wchar -pthread -pipe  -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -pedantic   -I/usr/X11R6/include  conftest.C -ldl -lm
conftest.C: In function `int main()':
conftest.C:6: error: ISO C++ does not support `long long'

(the code in question is the trivial:

int main () {
        if (sizeof(long long) != 8) {
                return 1;
        }
        return 0;
} 
)

My question is: Why is this an error rather than a warning?

The manual says: "to obtain all the diagnostics required by the
standard, you should also specify `-pedantic' (or `-pedantic-errors' if
you want them to be errors rather than warnings)."

So I could make this an error if I wanted to, but I can't make it a warning.
-Wno-error doesn't make it a warning, -Wno-long-long turns off the diagnostic.

gcc (rather than g++) emits this as a warning:

conftest.c:6: warning: ISO C90 does not support `long long'

Surely it's only a matter of time until the ISO C++ committee adds
"long long" to the language anyway?  This seems like a pretty obnoxious
thing to be inflicting on users.

Oh, and I'm using Debian's GCC 3.3.1.

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]