Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

patch to get the correct mingw gcc include search paths

(1/2) > >>

ollydbg:

--- Code: ---Index: nativeparser.cpp
===================================================================
--- nativeparser.cpp (revision 7280)
+++ nativeparser.cpp (working copy)
@@ -1060,7 +1060,7 @@
     // both works fine in Windows and linux
 
 #ifdef __WXMSW__
-    wxString Command = cpp_compiler + _T(" -v -E -x c++ -< nul");
+    wxString Command = _T("cmd /c \"") + cpp_compiler + _T(" -v -E -x c++ -< nul\"");
 #else
     wxString Command = cpp_compiler + _T(" -v -E -x c++ -< /dev/null");
 #endif
--- End code ---

I found that if we use the old command, sometimes we will failed to correct the gcc include paths. e.g. with gcc4.6, it will failed to collect the include paths.
see below:
nativiparser.cpp, line 1079
when running the command:

--- Code: --- if (wxExecute(Command, Output, Errors, wxEXEC_SYNC | wxEXEC_NODISABLE) == -1)
--- End code ---

--- Quote ---> output Errors
8 count of wxArrayString = {
  [0] = 0xb791a4 L"Using built-in specs.",
  [1] = 0xb79214 L"COLLECT_GCC=E:\\code\\cb\\gcc\\MinGW_gcc4.6.1release_static_win32\\MinGW\\bin\\g++.exe",
  [2] = 0xb792e4 L"COLLECT_LTO_WRAPPER=e:/code/cb/gcc/mingw_gcc4.6.1release_static_win32/mingw/bin/../libexec/gcc/i686-pc-mingw32/4.6.1/lto-wrapper.exe",
  [3] = 0xb79434 L"g++.exe: error: unrecognized option '-<'",
  [4] = 0xb794c4 L"Target: i686-pc-mingw32",
  [5] = 0xb7a014 L"Configured with: ./configure --prefix=/mingw --host=i686-pc-mingw32 --build=i686-pc-mingw32 --target=i686-pc-mingw32 --with-lto-plugin --with-host-libstdcxx=-lstdc++ --disable-bootstrap --disable-werror --with-arch=i686 --with-tune=generic --enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32 --enable-lto --with-system-zlib --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-fully-dynamic-string --disable-sjlj-exceptions --with-dwarf2 --disable-symvers --enable-checking=release --enable-plugins --enable-cloog-backend=isl --enable-static --disable-shared --disable-nls --disable-win32-registry --with-pkgversion=pcx32",
  [6] = 0xb79f34 L"Thread model: win32",
  [7] = 0xb79534 L"gcc version 4.6.1 (pcx32) "

--- End quote ---
look, we will get failed on running this command on mingw gcc 4.6.1.

I have test this patch on both mingw gcc 4.5.x and gcc 4.6.1(pcx), both works fine.

oBFusCATed:
Ollydbg: test also the "official" 4.4.x + older compilers 4.1 or something like that.

xunxun:
I 'm disposed to change to :

--- Code: ---wxString Command = cpp_compiler + _T(" -v -E -x c++ -dD nul");

--- End code ---
This can avoid "-<" output error in wxWidgets, and the content to output is much more, which contains all pre-defined compiler macros, and that can be a better supplement of CC plugin. The CC plugin may use "-dD" to distinguish the value of these pre-defined compiler macros.

ollydbg:
what does "-<" means?
I can't find this option from: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html

But I don't think -dD is need, because CC has another function to collect the predefined macros.
look at:
bool NativeParser::AddCompilerPredefinedMacros(cbProject* project, Parser* parser)
it use:
const wxString args(_T(" -dM -E -< nul")); under mingw.

ollydbg:
add a ref:
http://forums.codeblocks.org/index.php/topic,10598.msg72620.html#msg72620
But there is no such "-<"?
Maybe, morten can say something about this. :D

Edit:
the command options list: (I can't find any usage of "-<")...
http://technet.microsoft.com/en-us/library/bb490982.aspx

Navigation

[0] Message Index

[#] Next page

Go to full version