tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] precompiled headers


From: Michael Matz
Subject: Re: [Tinycc-devel] precompiled headers
Date: Sun, 24 Apr 2016 20:44:44 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)

Hi,

On Sun, 24 Apr 2016, Sergey Korshunoff wrote:

As I see this today. For example, I prefer to speed up tccboot kernel
compilation.
A current command to compile is like
 tcc -o vmlinux linux/kernel/init.c linux/arch/kernel/head.c ...

With -cheaders[=dDIR] option tcc will precompile headers in each *.c
before  the first C token is seen and create files
[DIR]linux/kernel/init.tch, [DIR]linux/arch/kernel/head.tch,...  or
use these files if they already present. I think this is better and
don't need a special tuning.

This cmdline interface seems sensible. I must warn you, though, that precompiled headers aren't totally trivial to get right. Depending on for you go with precompilation. If you save the tokens before macro-expansion is the easiest. If you save them after expansion you have to take care of including headers in different environments. E.g. in these two files:

% cat a.c
#define FOO
#include "header.h"
% cat b.c
#define BAR
#include "header.h"

the include file header.h might expand to a different token sequence depening on if FOO or BAR are defined. Such define can also be hidden in headers included before header.h. If you go even further and don't just store token sequences but code snippets the complications will only increase. Just something to keep in mind in the implementation.


Ciao,
Michael.



reply via email to

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