#15660 closed build error (fixed)

wxXLocale initialization build error

Reported by: hiroyuki-nagata Owned by:
Priority: normal Milestone:
Component: base Version: 3.0.0-rc2
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

I built wxWidgets-3.0.0-rc2 in FreeBSD(9.1-RELEASE) with clang-3.1
wxWidgets build config is below

../wxWidgets/configure CXXFLAGS="-stdlib=libc++ -std=c++11" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" \
CPPFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" CXX=clang++ CXXCPP="clang++ -E" CC=clang CPP="clang -E" --enable-unicode \ 
--enable-debug --enable-gdb-debug --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin \ 
--with-zlib=builtin --with-expat=builtin --enable-std_containers --enable-std_iostreams --enable-std_string

build error message is below

/usr/home/hiroyuki/git/wxWidgets-3.0.0-rc2/bk-deps clang++ -c -o basedll_xlocale.o -I./.pch/wxprec_basedll -D__WXGTK__        -DWXBUILDING -I/usr/home/hiroyuki/git/wxWidgets-3.0.0-rc2/src/tiff/libtiff  -I../wxWidgets/src/tiff/libtiff -I../wxWidgets/src/jpeg -I../wxWidgets/src/png -I../wxWidgets/src/zlib  -I../wxWidgets/src/regex -I../wxWidgets/src/expat/lib -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE  -DwxUSE_BASE=1 -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/usr/home/hiroyuki/git/wxWidgets-3.0.0-rc2/lib/wx/include/gtk2-unicode-3.0 -I../wxWidgets/include -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/gstreamer-0.10 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -stdlib=libc++ -I/usr/local/include/webkit-1.0 -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include/libsoup-2.4 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/libxml2 -I/usr/local/include -DWX_PRECOMP -pthread -D_THREAD_SAFE -g -O0 -I/usr/local/include -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/gtk-unix-print-2.0 -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/freetype2 -I/usr/local/include -stdlib=libc++ -std=c++11 ../wxWidgets/src/common/xlocale.cpp
../wxWidgets/src/common/xlocale.cpp:81:37: error: reinterpret_cast from 'nullptr_t' to 'wxXLocaleCTag *' is not allowed
        gs_cLocale = new wxXLocale( reinterpret_cast<wxXLocaleCTag *>(NULL) );
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
*** [basedll_xlocale.o] Error code 1

Location of compilation error is here

// Get the C locale
wxXLocale& wxXLocale::GetCLocale()
{
    if ( !gs_cLocale )
    {
        // NOTE: bcc551 has trouble doing static_cast with incomplete
        //       type definition. reinterpret_cast used as workaround
        gs_cLocale = new wxXLocale( reinterpret_cast<wxXLocaleCTag *>(NULL) );
    }

    return *gs_cLocale;
}

I think no need to use reinterpret_cast. Simply, to be modified as follows is OK ?

        gs_cLocale = new wxXLocale();

Attachments (1)

mypatch.patch download (1.0 KB) - added by hiroyuki-nagata 11 months ago.
#15660 patch

Download all attachments as: .zip

Change History (4)

comment:1 Changed 11 months ago by hiroyuki-nagata

Similar errors

/usr/home/hiroyuki/git/wxWidgets-3.0.0-rc2/bk-deps clang++ -c -o advdll_datavcmn.o -I./.pch/wxprec_advdll -D__WXGTK__        -DWXBUILDING -I/usr/home/hiroyuki/git/wxWidgets-3.0.0-rc2/src/tiff/libtiff -I../wxWidgets/src/tiff/libtiff  -I../wxWidgets/src/jpeg -I../wxWidgets/src/png -I../wxWidgets/src/zlib -I../wxWidgets/src/regex  -I../wxWidgets/src/expat/lib -DWXUSINGDLL -DWXMAKINGDLL_ADV -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual  -D_FILE_OFFSET_BITS=64 -I/usr/home/hiroyuki/git/wxWidgets-3.0.0-rc2/lib/wx/include/gtk2-unicode-3.0 -I../wxWidgets/include -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/gstreamer-0.10 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include -stdlib=libc++ -I/usr/local/include/webkit-1.0 -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/local/include/libsoup-2.4 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/libxml2 -I/usr/local/include -DWX_PRECOMP -pthread -D_THREAD_SAFE -g -O0 -I/usr/local/include -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/gtk-unix-print-2.0 -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/freetype2 -I/usr/local/include -stdlib=libc++ -std=c++11 ../wxWidgets/src/common/datavcmn.cpp
../wxWidgets/src/common/datavcmn.cpp:1804:23: error: static_cast from 'nullptr_t' to 'wxUIntPtr' (aka 'unsigned long') is not allowed
    if (!line) return static_cast<wxUIntPtr>(NULL);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
*** [advdll_datavcmn.o] Error code 1

Changed 11 months ago by hiroyuki-nagata

#15660 patch

comment:2 Changed 11 months ago by hiroyuki-nagata

  • Patch set

Could you confirm patch ?

Hiroyuki

comment:3 Changed 11 months ago by PC

  • Resolution set to fixed
  • Status changed from new to closed

(In [75162]) avoid NULL casts, clang says casting nullptr_t is not allowed
closes #15660

Note: See TracTickets for help on using tickets.