This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C PreProcessor GCC-specific features ideas.


I've got ideas for improve the preprocessor with specific features.

The basic idea is to make the preprocessing language a complete
programming language.
That can be useful for includes things like Autotools and advanced
Makefiles directly in the source code, and have just a tiny Makefile for
compile.

0. Multiple defines on one variable.
The "constants" will be transformed in "variables".

1. Assertions
#assert <CONDITION> <COMMAND-TO-EXECUTE-CONDITION-IS-FALSE>
will be transformed in :
#if !<CONDITION>
#<CMD>
#endif
(And will be of course re-preprocessed.)

2. Calculating
#calculate <VAR> <CALCUL>
will be transformed in :
#define <VAR> <RESULT>
(And will be of course re-preprocessed.)
Example :
#calculate N 1+1
will be transformed in :
#define N 2
(That can works with any type : bools, etc.)

3. Executing shell commands
#exec-sh <VAR> <SHELL-COMMAND>
The shell command <SHELL-COMMAND> while be executed and the result
(stdout) of the shell command will be putted in <VAR>

4. Read and write files
#read-file <VAR> <FILENAME>
will put the content of the file <FILENAME> in <VAR>, and if <VAR> is
modified, <FILENAME> is modified too.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]