Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: byo on May 31, 2007, 11:23:01 am

Title: War Against macros
Post by: byo on May 31, 2007, 11:23:01 am
Hi,
There's problem when compiling on linux after last "War against macros" (rev 4018).
Before the change, compilers were selected for specific platform using #ifdef stuff, now it's using standard c++ if.

Now there are two problems: list of #includes is still masked using #ifdef, so when compmiling on linux it will need compiler interfaces like compilerMSVC. It's never used since if (platform::windows) filters it, but compiler have to know this class just to compile. Even after removing conditional includes the problem still remains because specific compilers are again internally filtered against unknown platforms inside their .h files just like this:

Code
#ifdef __WXMSW__
// this compiler is valid only in windows

#ifndef COMPILERMSVC_H
#define COMPILERMSVC_H

#include <compiler.h>

class CompilerMSVC : public Compiler
{
....

Regards
   BYO
Title: Re: War Against macros
Post by: MortenMacFly on May 31, 2007, 11:29:29 am
There's problem when compiling on linux after last "War against macros" (rev 4018).
Before the change, compilers were selected for specific platform using #ifdef stuff, now it's using standard c++ if. [...]
Right... this particular part should be reverted... Sorry. :oops:
With regards, Morten.
Title: Re: War Against macros
Post by: MortenMacFly on May 31, 2007, 11:33:54 am
BTW: You meant the CompilerFactory::RegisterCompiler stuff only, or are there any mote issues?
With regards, Morten.
Title: Re: War Against macros
Post by: byo on May 31, 2007, 01:03:36 pm
There's problem when compiling on linux after last "War against macros" (rev 4018).
Before the change, compilers were selected for specific platform using #ifdef stuff, now it's using standard c++ if. [...]
Right... this particular part should be reverted... Sorry. :oops:
With regards, Morten.

Maybe not reverted :) It just need more #ifdef like macros to be removed, generally this apply to:

That will link code for compilers which are never used, but the overhead is not so big :)

Regards
   BYO
Title: Re: War Against macros
Post by: MortenMacFly on May 31, 2007, 01:21:57 pm
Maybe not reverted :) It just need more #ifdef like macros to be removed, generally this apply to:
  • #includes inside compilergcc.cpp - all compilers should be included no matter what platform
  • All compilerXXX.cpp / compilerXXX.h files - stuff like #ifdef __WXMSW__ should also be removed
That will link code for compilers which are never used, but the overhead is not so big :)
I'd agree on that... sounds good to me. I'll give it a try to see if it would work. Hence I still have this Linux blindness - mind trying on Linux? (I mean it should work... but now I'm more carefully than last time... ;-)).
BTW: I tried to fix the compilation in SVN by now...
Title: Re: War Against macros
Post by: Deschamps on May 31, 2007, 02:16:16 pm
Quote from: MortenMacFly
Quote from: byo
(..) #includes inside compilergcc.cpp - all compilers should be included no matter what platform (..)

(..) BTW: I tried to fix the compilation in SVN by now...

In regards to this:

I've just tried to compile svn r4018 sources on Windows XP SP2 (using workspace in C::B svn r3989, GCC 3.4.5 and wxMSW-2.8.4) and got this error:

Code
D:\svn-repos\codeblocks\src\plugins\compilergcc\compilergcc.cpp: In member function `virtual void CompilerGCC::OnAttach()':
D:\svn-repos\codeblocks\src\plugins\compilergcc\compilergcc.cpp:328: error: `CompilerLCC' has not been declared
Process terminated with status 1 (7 minutes, 58 seconds)
1 errors, 33 warnings

A typo, maybe?
Regards.

Edit: Just updated to svn r4019 and got the same error when compiling Compiler target.
Title: Re: War Against macros
Post by: MortenMacFly on May 31, 2007, 02:51:36 pm
A typo, maybe?
Edit: Just updated to svn r4019 and got the same error when compiling Compiler target.
Not a typo but an additional line that shouldn't go into SVN (I've added support for the LCC compiler on my local copy). Should hopefully be fixed by now in SVN... It seems it's not my day to day... :(