News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

warning: "nullptr" redefined when compile sdk\mozilla_chardet\src\nsSBCSGroupPro

Started by ollydbg, December 25, 2013, 03:36:37 AM

Previous topic - Next topic

ollydbg


-------------- Build: sdk in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

[ 50.0%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Woverloaded-virtual -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI -iquote.objs\include -I.objs\include -I. -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\include -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude -Iinclude\tinyxml -Iinclude\scripting\bindings -Iinclude\scripting\include -Iinclude\scripting\sqplus -Iinclude\mozilla_chardet -Iinclude\mozilla_chardet\mfbt -Iinclude\mozilla_chardet\nsprpub\pr\include -Iinclude\mozilla_chardet\xpcom -Iinclude\mozilla_chardet\xpcom\base -Iinclude\mozilla_chardet\xpcom\glue -Isdk\wxpropgrid\include -c sdk\mozilla_chardet\src\nsSBCSGroupProber.cpp -o .objs\sdk\mozilla_chardet\src\nsSBCSGroupProber.o
In file included from include/sdk_events.h:12:0,
                 from include/manager.h:21,
                 from include/configmanager.h:17,
                 from sdk\mozilla_chardet\src\nsSBCSGroupProber.cpp:10:
include/prep.h:41:0: warning: "nullptr" redefined [enabled by default]
In file included from sdk\mozilla_chardet\src\nsSBCSGroupProber.cpp:8:0:
include\mozilla_chardet\mfbt/mozilla/NullPtr.h:40:0: note: this is the location of the previous definition



When look at this code in nsSBCSGroupProber.cpp

#include <stdio.h>
#include "prmem.h"
#include "mozilla/NullPtr.h"

#include "configmanager.h"

#include "nsSBCharSetProber.h"
#include "nsSBCSGroupProber.h"


In mozilla/NullPtr.h, it has:

#ifndef MOZ_HAVE_CXX11_NULLPTR
#  if defined(__GNUC__)
#    define nullptr __null   //******************** line 40
#  elif defined(_WIN64)
#    define nullptr 0LL
#  else
#    define nullptr 0L
#  endif
#endif





If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

MortenMacFly

I wouldn't touch that now if not absolutely needed. I've an update for the Mozilla component after 13/12. hen we'll see if this is still an issue...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

ollydbg

Quote from: MortenMacFly on December 25, 2013, 10:51:17 AM
I wouldn't touch that now if not absolutely needed. I've an update for the Mozilla component after 13/12. hen we'll see if this is still an issue...

It's still an issue. (I build the latest svn head rev 9544, against wx30 C::B project, MinGW-Build GCC 4.7.3dw2)

Also, some other warnings like:

[ 29.8%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DNOPCH -DwxUSE_UNICODE -Woverloaded-virtual -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI -IE:\code\wx\wxWidgets-3.0.0\include -IE:\code\wx\wxWidgets-3.0.0\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Iinclude\tinyxml -Iinclude -Iinclude\tinyxml -Iinclude\scripting\bindings -Iinclude\scripting\include -Iinclude\scripting\sqplus -Iinclude\mozilla_chardet -Iinclude\mozilla_chardet\mfbt -Iinclude\mozilla_chardet\nsprpub\pr\include -Iinclude\mozilla_chardet\xpcom -Iinclude\mozilla_chardet\xpcom\base -Iinclude\mozilla_chardet\xpcom\glue -c sdk\editorbase.cpp -o .objs30\sdk\editorbase.o
In file included from include/cbauibook.h:10:0,
                from sdk\editorbase.cpp:26:
E:\code\wx\wxWidgets-3.0.0\include/wx/aui/auibook.h:349:18: warning: 'virtual bool wxAuiNotebook::AddPage(wxWindow*, const wxString&, bool, int)' was hidden [-Woverloaded-virtual]
In file included from sdk\editorbase.cpp:26:0:
include/cbauibook.h:132:14: warning:   by 'bool cbAuiNotebook::AddPage(wxWindow*, const wxString&, bool, const wxBitmap&)' [-Woverloaded-virtual]
In file included from include/cbauibook.h:10:0,
                from sdk\editorbase.cpp:26:
E:\code\wx\wxWidgets-3.0.0\include/wx/aui/auibook.h:352:18: warning: 'virtual bool wxAuiNotebook::InsertPage(size_t, wxWindow*, const wxString&, bool, int)' was hidden [-Woverloaded-virtual]
In file included from sdk\editorbase.cpp:26:0:
include/cbauibook.h:147:14: warning:   by 'bool cbAuiNotebook::InsertPage(size_t, wxWindow*, const wxString&, bool, const wxBitmap&)' [-Woverloaded-virtual]
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

MortenMacFly

OK, then we probably should sure that MOZ_HAVE_CXX11_NULLPTR is defined:

Either by locking what leads to the fact it is not and adjusting it
...or by simply defining it. :-)

Thats the relvant part:
#elif defined(__GNUC__)
#  if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
#    if MOZ_GCC_VERSION_AT_LEAST(4, 6, 0)
#      define MOZ_HAVE_CXX11_NULLPTR
#    endif
#  endif
#elif defined(_MSC_VER) && _MSC_VER >= 1600


...one condition is false. The question is: Which one?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

stahta01

This line is likely false under Windows cbp compiles.


if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L


Are we allowed to set a -std=gnu++11 to fix the problem under windows.
I ask because I read that we were NOT going to a higher C++ Standard under Linux.

Note: Using "-std=gnu++11" results in a even more annoying warning.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

stahta01

Quote from: oBFusCATed on January 08, 2014, 07:35:36 PM
No, you're not allowed, yet.
Also -std=c++11 is the correct option.

IIRC, CB Will NOT compile (on windows using MinGW TDM) with -std=c++11 because that hides too many things like _popen last time I tried about 4 months ago.

Possible patch; but, I am coughing and sneezing too much to test it.

Index: src/include/mozilla_chardet/mfbt/mozilla/NullPtr.h
===================================================================
--- src/include/mozilla_chardet/mfbt/mozilla/NullPtr.h (revision 9544)
+++ src/include/mozilla_chardet/mfbt/mozilla/NullPtr.h (working copy)
@@ -12,6 +12,9 @@
#ifndef mozilla_NullPtr_h
#define mozilla_NullPtr_h

+// C::B patch: to fix multiple defines of nullptr
+#include "prep.h"  // C::B Header that defines nullptr
+
#include "mozilla/Compiler.h"

#if defined(__clang__)
Index: src/include/prep.h
===================================================================
--- src/include/prep.h (revision 9544)
+++ src/include/prep.h (working copy)
@@ -39,6 +39,7 @@
        const nullptr_t& operator=(const nullptr_t&);
    } nullptr_;
    #define nullptr nullptr_
+    #define MOZ_HAVE_CXX11_NULLPTR  // prevents mozilla/NullPtr.h from defining nullptr.

    template<typename T> inline bool operator==(const nullptr_t& lhs, T const& rhs) { return  lhs.equals(rhs); }
    template<typename T> inline bool operator==(T const& lhs, const nullptr_t& rhs) { return  rhs.equals(lhs); }


Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

scarphin


ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.