Author Topic: War Against macros  (Read 7452 times)

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 836
War Against macros
« 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: War Against macros
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: War Against macros
« Reply #2 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 836
Re: War Against macros
« Reply #3 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:
  • #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 :)

Regards
   BYO

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: War Against macros
« Reply #4 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...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: War Against macros
« Reply #5 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.
« Last Edit: May 31, 2007, 02:30:42 pm by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: War Against macros
« Reply #6 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... :(
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ