User forums > Help

-std=c++11 not working (CB12.11)

<< < (6/7) > >>

osdt:

--- Quote from: MortenMacFly on April 23, 2013, 08:31:28 am ---I'm afraid osdt still fails to see the full picture:
if you hit OK and "-Wall" in the checkable list is off, but you have -Wall in "other options" defined to be "on", then you tell C::B on the one hand "do not use -Wall" and on the other hand "do use -Wall".

And we do no magi here at all - we just decided that the checkable list over-rules "other options". It has been like that since the beginning and only a very few people complained. Most were happy when we told how it is working behind the scenes. So I still don't see any need for change here, sorry.

--- End quote ---
I don't think so. But I get your point: "checkable compiler switches over-rule the other options" generally!
You forget completly that the user don't have switched some option off, its off by default. So it's not the user's intention to switch it off, right? Nobody will turn '-Wall' off explicitly and then add '-Wall' to 'other options'. Would make no sense, right?


--- Quote from: scarphin on April 23, 2013, 09:32:55 am ---I have a different case here. First of all I didn't know there was a flag for '-std=c++11' in 'compiler flags'. What I did was to read gcc documentation, decide that I need a '-std=c++11' option and add it to 'other options'. So I DIDN'T tell cb to disable '-std=c++11' in the 'compiler flags ...

--- End quote ---

@MortenMacFly: What was the intention by adding '-std=c++11' to 'other options'? Think about it, please!

As I've stated earlier: If '-fexceptions' becomes a switch some day, CB will silently remove it from 'other options' the first time the user modfies the project's build-options.

- osdt

MortenMacFly:

--- Quote from: osdt on April 23, 2013, 07:33:47 pm ---As I've stated earlier: If '-fexceptions' becomes a switch some day, CB will silently remove it from 'other options' the first time the user modfies the project's build-options.

--- End quote ---
That is plain wrong, as I mentioned already. Nothing will get lost it will work as expected.

osdt:

--- Quote from: MortenMacFly on April 23, 2013, 08:29:02 pm ---
--- Quote from: osdt on April 23, 2013, 07:33:47 pm ---If '-fexceptions' becomes a switch some day, CB will silently remove it from 'other options' the first time the user modfies the project's build-options.

--- End quote ---
That is plain wrong, as I mentioned already. Nothing will get lost it will work as expected.

--- End quote ---
You are right, my apologies for that!

I was of the opinion that 'Other options' are stored separately and then handled exactly as in the GUI (remove -fexceptions without to turn the switch on). But thats clearly not the case.

- osdt

osdt:

--- Quote from: MortenMacFly on April 23, 2013, 11:20:58 am ---I think the only feasible way of handling this would be that in case we realise a difference between the checklist based and the other options we issue a warning asking what to do.

--- End quote ---
Just display a warning "-Wall has been removed\nUse the checklist instead".


--- Quote from: MortenMacFly on April 23, 2013, 11:20:58 am ---The issue here is that you can use scripting (?) but at least macros in "other options" - so its not so easy to implement! And there is no automatism that will work reliable.

--- End quote ---
Scripts and macros are not recognized by the current implementation. It compares each line with avaiable switches. ('$WALL' and '-Wall -Wextra' works as expected ;) )

- osdt

Alpha:
Free untested annoying dialog:

--- Code: ---Index: src/plugins/compilergcc/compileroptionsdlg.cpp
===================================================================
--- src/plugins/compilergcc/compileroptionsdlg.cpp (revision 9000)
+++ src/plugins/compilergcc/compileroptionsdlg.cpp (working copy)
@@ -900,6 +900,8 @@
         }
     }
 
+    wxArrayString compilerOpConflicts;
+    wxArrayString linkerOpConflicts;
     for (unsigned int i = 0; i < m_Options.GetCount(); ++i)
     {
         CompOption* copt = m_Options.GetOption(i);
@@ -916,15 +918,32 @@
         {
             // for disabled options, remove relative text option *and*
             // relative linker option
-            int idx = m_CompilerOptions.Index(copt->option);
-            if (idx != wxNOT_FOUND)
-                m_CompilerOptions.RemoveAt(idx, 1);
-            idx = m_LinkerOptions.Index(copt->additionalLibs);
-            if (idx != wxNOT_FOUND)
-                m_LinkerOptions.RemoveAt(idx, 1);
+            if (m_CompilerOptions.Index(copt->option) != wxNOT_FOUND)
+                compilerOpConflicts.Add(copt->option);
+            if (m_LinkerOptions.Index(copt->additionalLibs) != wxNOT_FOUND)
+                linkerOpConflicts.Add(copt->additionalLibs);
         }
     }
 
+    if (!compilerOpConflicts.IsEmpty() || !linkerOpConflicts.IsEmpty())
+    {
+        wxString msg =   _("The compiler flags\n  ")
+                       + GetStringFromArray(compilerOpConflicts, wxT("\n  "))
+                       + GetStringFromArray(linkerOpConflicts, wxT("\n  "));
+        msg.RemoveLast(2); // remove two trailing spaces
+        msg += _("were stated in 'Other Options' but unchecked in 'Compiler Flags'.\n"
+                 "Do you want to enable these flags?");
+        AnnoyingDialog dlg(_("Enable compiler flags?"), msg,
+                           AnnoyingDialog::YES_NO, wxID_NO);
+        if (dlg.ShowModal() == wxID_NO)
+        {
+            for (size_t i = 0; i < compilerOpConflicts.GetCount(); ++i)
+                m_CompilerOptions.Remove(compilerOpConflicts[i]);
+            for (size_t i = 0; i < linkerOpConflicts.GetCount(); ++i)
+                m_LinkerOptions.Remove(linkerOpConflicts[i]);
+        }
+    }
+
     // linker options and libs
     wxListBox* lstLibs = XRCCTRL(*this, "lstLibs", wxListBox);
     for (int i = 0; i < (int)lstLibs->GetCount(); ++i)

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version