[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: warning: overflow in implicit constant conversion shown while buildi

From: Thomas Dickey
Subject: Re: warning: overflow in implicit constant conversion shown while building kakoune on ubuntu 18.04
Date: Sat, 13 Oct 2018 19:32:09 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Oct 10, 2018 at 08:22:40AM +0200, Johannes Hoffmann wrote:
> here is the output:
> g++ -DKAK_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw 
> -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder 
> -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unknown-attributes 
> -Wno-unknown-warning-option -MD -MP -MF .ncurses_ui.debug.d -c -o 
> .ncurses_ui.debug.o ncurses_ui.cc
> In file included from ncurses_ui.cc:14:0:
> ncurses_ui.cc: In member function ‘void
> Kakoune::NCursesUI::set_face(Kakoune::NCursesWin*, Kakoune::Face, const 
> Kakoune::Face&)’:
> /usr/include/ncursesw/ncurses.h:1097:63: warning: overflow in implicit 
> constant conversion [-Woverflow]
> #define   NCURSES_BITS(mask,shift)   (NCURSES_CAST(chtype,(mask)) << ((shift) 
> ^
> /usr/include/ncursesw/ncurses.h:1120:18:  note:  in expansion of macro 
> #define A_ITALIC NCURSES_BITS(1UL,23) /* ncurses extension */
> ^~~~~~~~~~~~
> ncurses_ui.cc:217:27: note: in expansion of macro ‘A_ITALIC’
> set_attribute(window, A_ITALIC, face.attributes & Attribute::Italic);
> ^~~~~~~~
> At global scope:
> cc1plus:  warning:  unrecognized command line option 
> ‘-Wno-unknown-warning-option’
> cc1plus:  warning:  unrecognized command line option ‘-Wno-unknown-attributes’
> g++ -DKAK_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw 
> -pedantic -std=gnu++14 -g -Wall -Wextra -Wno-unused-parameter -Wno-reorder 
> -Wno-sign-compare -Wno-address -Wno-noexcept-type -Wno-unknown-attributes 
> -Wno-unknown-warning-option -MD -MP -MF .normal.debug.d -c -o .normal.debug.o 
> normal.cc
> hope this is of use to you

Sorry, but it is not.  Making a long story short, Debian (and Ubuntu)
use a configuration which makes everything long.  Even for 64-bit

That's because back in 2005, my configure script did not enforce 32-bits
for chtype's (one couldn't write portable code using uint32_t at that
point in time).

Because Debian had already started making packages with this, the
package maintainer refused to consider making chtype's 32-bits.

The package maintainer at the time did agree to changing it on the next
release, but package maintainers move on (that issue seems to have been
neglected), and what you have is the best compromise that I could see
within the constraints of binary compatibility.  It's a warning, but no
actual overflow:  the result uses exactly 32-bits of data, which is
stored in an unsigned long.

A smarter compiler would notice that the "overflow" is all-zero bits,
and that the value being shifted is unsigned.  (I will consider
suggestions for improving this, but binary compatibility is the rule).

I don't use that configuration in development, of course.  No warnings
for my builds, from _that_ issue.

Start here, looking for LP64:


(by the way, html mail is awkward for replies)

Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]