Patch #3498 2013-09-17 07:34

mojca

lib_finder: fix clang compile error
Download
3498-lib_finder_fix.patch (2.1 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2013-10-01 20:32
Assigned to
tpetrov
Index: src/plugins/contrib/lib_finder/librariesdlg.cpp
===================================================================
--- src/plugins/contrib/lib_finder/librariesdlg.cpp    (revision 9374)
+++ src/plugins/contrib/lib_finder/librariesdlg.cpp    (working copy)
@@ -14,6 +14,7 @@
 #include <wx/string.h>
 //*)
 
+#include <algorithm>
 #include <sdk.h>
 #include <manager.h>
 #include <configmanager.h>
@@ -90,7 +91,6 @@
 
 LibrariesDlg::LibrariesDlg(wxWindow* parent, TypedResults& knownLibraries)
     : m_KnownLibraries(knownLibraries)
-    , m_WorkingCopy(knownLibraries)
     , m_SelectedConfig(0)
     , m_WhileUpdating(false)
 {
@@ -124,6 +124,8 @@
     wxBoxSizer* BoxSizer3;
     wxStdDialogButtonSizer* StdDialogButtonSizer1;
 
+    std::copy(m_KnownLibraries, m_KnownLibraries+sizeof(m_WorkingCopy)/sizeof(m_WorkingCopy[0]), m_WorkingCopy);
+
     Create(parent, wxID_ANY, _("Registered libraries"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY"));
     BoxSizer1 = new wxBoxSizer(wxVERTICAL);
     BoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
Index: src/plugins/contrib/profiler/cbprofiler.cpp
===================================================================
--- src/plugins/contrib/profiler/cbprofiler.cpp    (revision 9374)
+++ src/plugins/contrib/profiler/cbprofiler.cpp    (working copy)
@@ -101,7 +101,7 @@
     if (project->GetBuildTargetsCount() > 1)
     {
         // more than one executable target? ask...
-        wxString choices[project->GetBuildTargetsCount()];
+        wxString *choices = new wxString[project->GetBuildTargetsCount()];
         wxString active_target = project->GetActiveBuildTarget();
         int selected = 0;
         for (int i=0; i<project->GetBuildTargetsCount(); ++i)
@@ -114,6 +114,7 @@
                                     _("Select the target you want to profile"),
                                     _("Select Target"),project->GetBuildTargetsCount(),choices);
         dialog.SetSelection(selected);
+        delete [] choices;
         if (dialog.ShowModal() != wxID_OK)
             return -1;
         int targetIndex = dialog.GetSelection();
mojca 2013-09-17 07:35

I initially submitted this as Bug #19111 and didn't know how to move it from bugs to patches, so I opened a new ticket.

Clang fails to compile the lib_finder module. The error is:

librariesdlg.cpp:93:7: error: array initializer must be an initializer list

, m_WorkingCopy(knownLibraries)

^

&#65279;&#65279;&#65279;Titus von Boxberg on the MacPorts mailing list contributed the attached patch.

I wasn't able to verify this on SVN trunk because the compilation fails a lot earlier there, but the patch worked with the released version (12.11).

Full error:

/bin/sh ../../../../libtool --tag=CXX --mode=compile /usr/bin/clang++ -DHAVE_CONFIG_H -I. -I../../../../src/include -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib/wx/include/gtk2-unicode-release-2.8 -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -I../../../../src/include -I../../../../src/sdk/wxscintilla/include -I./../wxContribItems/wxFlatNotebook/include -I../../../../src/include/scripting/include -I../../../../src/include/scripting/sqplus -I../../../../src/include/scripting/squirrel -I../../../../src/include/scripting/bindings -I../../../../src/include/mozilla_chardet -I/opt/local/include -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT projectmissinglibs.lo -MD -MP -MF .deps/projectmissinglibs.Tpo -c -o projectmissinglibs.lo projectmissinglibs.cpp

libtool: compile: /usr/bin/clang++ -DHAVE_CONFIG_H -I. -I../../../../src/include -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib/wx/include/gtk2-unicode-release-2.8 -I/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -I../../../../src/include -I../../../../src/sdk/wxscintilla/include -I./../wxContribItems/wxFlatNotebook/include -I../../../../src/include/scripting/include -I../../../../src/include/scripting/sqplus -I../../../../src/include/scripting/squirrel -I../../../../src/include/scripting/bindings -I../../../../src/include/mozilla_chardet -I/opt/local/include -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT projectmissinglibs.lo -MD -MP -MF .deps/projectmissinglibs.Tpo -c projectmissinglibs.cpp -fno-common -DPIC -o .libs/projectmissinglibs.o

librariesdlg.cpp:93:7: error: array initializer must be an initializer list

, m_WorkingCopy(knownLibraries)

^

1 error generated.

mojca 2013-10-01 09:36

The revised patch can be applied to trunk