Patch #3496 2013-09-05 13:01

mojca

avoid clang compilation error in profiler
Download
3496-avoid_clang_co.patch (956 bytes)
Category
Plugin::Bugfix
Status
Accepted
Close date
2013-10-01 20:31
Assigned to
tpetrov
--- src/plugins/contrib/profiler/cbprofiler.cpp.orig
+++ src/plugins/contrib/profiler/cbprofiler.cpp
@@ -101,7 +101,7 @@ int CBProfiler::Execute()
     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 @@ int CBProfiler::Execute()
                                     _("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-05 13:03
Without this patch I end up with

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/opt/local/include -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT cbprofilerconfig.lo -MD -MP -MF .deps/cbprofilerconfig.Tpo -c cbprofilerconfig.cpp  -fno-common -DPIC -o .libs/cbprofilerconfig.o
cbprofiler.cpp:104:25: error: variable length array of non-POD element type 'wxString'
        wxString choices[project->GetBuildTargetsCount()];
                        ^
1 error generated.
make[5]: *** [cbprofiler.lo] Error 1
tpetrov 2013-10-01 18:21

Accepted with modifications