Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#8372) [RFC] Inline generator
Home

[Freeciv-Dev] (PR#8372) [RFC] Inline generator

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8372) [RFC] Inline generator
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Thu, 25 Mar 2004 02:09:36 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8372 >


I want to hear what you think about this idea.

The source is preprocessed by a generator script (written on python,
perl or similar). This script transforms functions into macros or
inline functions based on a list. These macros or functions are moved
into the header file to have effect. The so created source is
compiled. You can specify dependencies (other functions, structs,
variables) for each function. These dependencies are also resolved. If
the generator isn't used the source files will still compile fine.

Advantages over current code:
 - no macros or inline function in the header files, making them cleaner
 - more speed

Disadvantages over current code:
 - need for python (or similar) if you change something
 - the generator is run before every compile (time)
 - the line numbers of the header files are wrong in error messages

Advantages over other proposals:
 - more flexibility (basically the desicion what to inline depends on
 the architecture and compiler)
 - allows a debug version where all functions are visible
 - no heavy changes required to source

With this generator in place I would agree that all "speed" functions
are turned into macros if they have no local variables. Otherwise
inline functions will be generated.

The biggest problem I see is changing the build system so that it
compiles foo_.c (the generated version) if the file is there or foo.c
otherwise.

Does anybody of any other implemenation of such an idea or similar
ideas?

Last but not least: if we have such an extra layer in place we can do
a lot of other stuff. Like generating speclist code ;)

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  Microsoft does have a year 2000 problem. I'm part of it. I'm running Linux.




[Prev in Thread] Current Thread [Next in Thread]