aboutsummaryrefslogtreecommitdiff
path: root/devel/kdevelop-kde4/files/patch-git_6b95b83
diff options
context:
space:
mode:
Diffstat (limited to 'devel/kdevelop-kde4/files/patch-git_6b95b83')
-rw-r--r--devel/kdevelop-kde4/files/patch-git_6b95b83106
1 files changed, 106 insertions, 0 deletions
diff --git a/devel/kdevelop-kde4/files/patch-git_6b95b83 b/devel/kdevelop-kde4/files/patch-git_6b95b83
new file mode 100644
index 000000000000..7f763ceb62df
--- /dev/null
+++ b/devel/kdevelop-kde4/files/patch-git_6b95b83
@@ -0,0 +1,106 @@
+commit 6b95b832d72696df0278ac7b9d290c96b798ef07
+Author: Milian Wolff <mail@milianw.de>
+Date: Tue Apr 17 11:14:02 2012 +0200
+
+ Fix gcc include-path and macro computation on machines with old GCC.
+
+ Whe default to calling GCC with -std=c++0x and fallback to a call
+ without that argument when the former fails.
+
+ BUG: 298252
+
+diff --git a/languages/cpp/setuphelpers.cpp b/languages/cpp/setuphelpers.cpp
+index d3ced10..59bb850 100644
+--- languages/cpp/setuphelpers.cpp
++++ languages/cpp/setuphelpers.cpp
+@@ -31,12 +31,13 @@
+ using namespace KDevelop;
+
+ namespace CppTools {
+-QStringList gccSetupStandardIncludePaths();
+-const QVector<rpp::pp_macro*>& gccStandardMacros();
+
+ #ifdef _MSC_VER
+ QStringList msvcSetupStandardIncludePaths();
+ const QVector<rpp::pp_macro*>& msvcStandardMacros();
++#else
++QStringList gccSetupStandardIncludePaths();
++const QVector<rpp::pp_macro*>& gccStandardMacros();
+ #endif
+
+ QStringList setupStandardIncludePaths()
+diff --git a/languages/cpp/setuphelpers_gcc.cpp b/languages/cpp/setuphelpers_gcc.cpp
+index 5b8fdda..83c6052 100644
+--- languages/cpp/setuphelpers_gcc.cpp
++++ languages/cpp/setuphelpers_gcc.cpp
+@@ -40,7 +40,7 @@ using namespace KDevelop;
+
+ namespace CppTools {
+
+-QStringList gccSetupStandardIncludePaths()
++QStringList gccSetupStandardIncludePaths(bool withStdCpp0x)
+ {
+ QStringList includePaths;
+
+@@ -59,7 +59,12 @@ QStringList gccSetupStandardIncludePaths()
+ // /usr/lib/gcc/i486-linux-gnu/4.1.2/include
+ // /usr/include
+ // End of search list.
+- proc <<"gcc" << "-std=c++0x" <<"-xc++" <<"-E" <<"-v" <<NULL_DEVICE;
++ proc << "gcc";
++ if (withStdCpp0x) {
++ // see also: https://bugs.kde.org/show_bug.cgi?id=298252
++ proc << "-std=c++0x";
++ }
++ proc << "-xc++" << "-E" << "-v" << NULL_DEVICE;
+
+ // We'll use the following constants to know what we're currently parsing.
+ const short parsingInitial = 0;
+@@ -100,6 +105,9 @@ QStringList gccSetupStandardIncludePaths()
+ }
+ }
+ }
++ } else if (withStdCpp0x) {
++ // fallback to include-path computation without -std=c++0x arg for old gcc versions
++ return gccSetupStandardIncludePaths(false);
+ } else {
+ kDebug(9007) <<"Unable to read standard c++ macro definitions from gcc:" <<QString(proc.readAll()) ;
+ }
+@@ -107,7 +115,12 @@ QStringList gccSetupStandardIncludePaths()
+ return includePaths;
+ }
+
+-QVector<rpp::pp_macro*> computeGccStandardMacros()
++QStringList gccSetupStandardIncludePaths()
++{
++ return gccSetupStandardIncludePaths(true);
++}
++
++QVector<rpp::pp_macro*> computeGccStandardMacros(bool withStdCpp0x = true)
+ {
+ QVector<rpp::pp_macro*> ret;
+ //Get standard macros from gcc
+@@ -117,7 +130,12 @@ QVector<rpp::pp_macro*> computeGccStandardMacros()
+ // The output of the following gcc commands is several line in the format:
+ // "#define MACRO [definition]", where definition may or may not be present.
+ // Parsing each line sequentially, we can easily build the macro set.
+- proc <<"gcc" << "-std=c++0x" <<"-xc++" <<"-E" <<"-dM" <<NULL_DEVICE;
++ proc << "gcc";
++ if (withStdCpp0x) {
++ // see also: https://bugs.kde.org/show_bug.cgi?id=298252
++ proc << "-std=c++0x";
++ }
++ proc << "-xc++" << "-E" << "-dM" <<NULL_DEVICE;
+
+ if (proc.execute(5000) == 0) {
+ QString line;
+@@ -141,6 +159,9 @@ QVector<rpp::pp_macro*> computeGccStandardMacros()
+ }
+ }
+ }
++ } else if (withStdCpp0x) {
++ // fallback to macro computation without -std=c++0x arg for old gcc versions
++ return computeGccStandardMacros(false);
+ } else {
+ kDebug(9007) <<"Unable to read standard c++ macro definitions from gcc:" <<QString(proc.readAll()) ;
+ }