如何摆脱财产电网警告?

时间:2016-12-21 14:09:15

标签: compiler-errors g++ wxwidgets compiler-warnings

我总是得到这个警告: https://gist.githubusercontent.com/jS5t3r/ccb8a6e3db18d5133d37986b8979baef/raw/f4750f5ac3211b0560d27b035d31542877669e07/warnings

我正在使用

  • ArchLinux的
  • gcc(GCC)6.2.1 20160830
  • wxwidget 3.0

我将这些标志用于compilng

WXWIDGETSFLAGS=`wx-config --gl-libs --cxxflags --libs std stc propgrid richtext` 

警告:

g++ `wx-config --gl-libs --cxxflags --libs std stc propgrid richtext`  -std=c++11 -Wall -Iinclude  source/wxwidget/GUIMemLayMgr.h source/wxwidget/gui.h source/wxwidget/GUIMemLayMgr.cpp source/wxwidget/gui.cpp  source/wxwidget/main.cpp -o output/wxwidget
In file included from /usr/include/wx-3.0/wx/propgrid/propgrid.h:26:0,
             from source/wxwidget/gui.h:31,
             from source/wxwidget/GUIMemLayMgr.h:9:
/usr/include/wx-3.0/wx/propgrid/property.h: In member function 'void  wxPGChoices::Set(const wxArrayString&, const wxArrayInt&)':
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
     if ( &values )
                  ^
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
In file included from /usr/include/wx-3.0/wx/propgrid/propgrid.h:26:0,
             from source/wxwidget/gui.h:31:
/usr/include/wx-3.0/wx/propgrid/property.h: In member function 'void wxPGChoices::Set(const wxArrayString&, const wxArrayInt&)':
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
     if ( &values )
                  ^
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
In file included from /usr/include/wx-3.0/wx/propgrid/propgrid.h:26:0,
             from source/wxwidget/gui.h:31,
             from source/wxwidget/GUIMemLayMgr.h:9,
             from source/wxwidget/GUIMemLayMgr.cpp:1:
/usr/include/wx-3.0/wx/propgrid/property.h: In member function 'void wxPGChoices::Set(const wxArrayString&, const wxArrayInt&)':
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler  can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
     if ( &values )
                  ^
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
In file included from /usr/include/wx-3.0/wx/propgrid/propgrid.h:26:0,
             from source/wxwidget/gui.h:31,
             from source/wxwidget/gui.cpp:8:
/usr/include/wx-3.0/wx/propgrid/property.h: In member function 'void   wxPGChoices::Set(const wxArrayString&, const wxArrayInt&)':
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the  compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
     if ( &values )
                  ^
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
In file included from /usr/include/wx-3.0/wx/propgrid/propgrid.h:26:0,
             from source/wxwidget/gui.h:31,
             from source/wxwidget/main.cpp:22:
/usr/include/wx-3.0/wx/propgrid/property.h: In member function 'void wxPGChoices::Set(const wxArrayString&, const wxArrayInt&)':
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]
     if ( &values )
                  ^
/usr/include/wx-3.0/wx/propgrid/property.h:1049:22: warning: the compiler can assume that the address of 'values' will always evaluate to 'true' [-Waddress]

2 个答案:

答案 0 :(得分:3)

这已在Optimize wxPGChoices::Set method提交中修复,该提交在3.0.2之后。要使用它,您需要从git或3.0版本获取最新的3.1.0分支 - 基本上是在提交之后的任何内容。

答案 1 :(得分:0)

我改变了

中的包含
#include <wx/propgrid/propgrid.h>

#include <wx-3.0/wx/propgrid/propgrid.h>

现在工作正常。