clang fails to build khtml

Milian Wolff mail at milianw.de
Wed Feb 26 21:43:31 UTC 2014


Hey all,

apparently noone is trying to build khtml with clang. I spotted this one:

    src/misc/AtomicString.cpp:175:28: error: non-constant-expression
     cannot be narrowed from type 'int' to 'unsigned int' in initializer
     list [-Wc++11-narrowing]
        UCharBuffer buf = { s, length };
                               ^~~~~~
    src/misc/AtomicString.cpp:175:28: note: override this message by
     inserting an explicit cast
        UCharBuffer buf = { s, length };
                               ^~~~~~
                               static_cast<unsigned int>( )

Which seems easy enough to fix. I'll put it up on review board.

But what about this:

In file included from src/ecma/kjs_traversal.cpp:21:
src/kjs_traversal.lut.h:49:18: error: constant expression evaluates to 
4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
   { "SHOW_ALL", DOM::NodeFilter::SHOW_ALL, KJS::DontDelete|KJS::ReadOnly, 0, 
0 } ,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
src/kjs_traversal.lut.h:49:18: note: override this message by inserting an 
explicit cast
   { "SHOW_ALL", DOM::NodeFilter::SHOW_ALL, KJS::DontDelete|KJS::ReadOnly, 0, 
0 } ,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
                 static_cast<int>(        )

this actually sounds pretty dangerous to me. Anyone with knowledge around who 
knows what to do here?

There are also tons of warnings like this:

src/xml/dom_stringimpl.h:60:13: warning: cast from 'char *' to 'QChar *' 
increases required alignment from 1 to 2 [-Wcast-align]
        s = (QChar*) new char[ sizeof(QChar)*( havestr ? len : 1 ) ];
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These can afaik also be "fixed" by using explicit static_casts. Is that OK?

What about this one:

src/frameworks/khtml/src/imload/decoders/jpegloader.cpp:430:29: warning: cast 
from 'uchar *' (aka 'unsigned char *') to 'QRgb *' (aka 'unsigned int *') 
increases required alignment from 1 to 4 [-Wcast-align]
                QRgb *out = (QRgb *)scanline;
                            ^~~~~~~~~~~~~~~~
Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de


More information about the Kde-frameworks-devel mailing list