What is the fastest way to get only pre-processed source code using MSVC?

I am trying to find the fastest way to get the complete pre-processed source code (I don't need any other comments, only the source code) for the C source file.

I have the following small test program that only includes the Windows ( mini.c) header file :

#include <windows.h>

Using Microsoft Visual Studio 2005, I run the following command:

cl /nologo /P mini.c

It takes 6 seconds to create a 2.5 MB mini.i file; changing it to

cl /nologo /EP mini.c > mini.i

(which skips comments and #line information) it takes just 0.5 seconds to write 2.1 MB of output.

Does anyone know of good methods to improve this even more without using precompiled headers?

, ccache MSVC. - ( ). .

, , ?

: , : WIN32_LEAN_AND_MEAN, . 3 .

+3
3

(<windows.h>), , , . <windows.h> SDK .

. , - . , - , - cl /EP.

, , , -, . , , . .

, NUL. , mini.i , md5sum.

+1

, . , MSVC .

-1

The / P option has been around for several years, it creates the .i file and does not have any object file.

-1
source

Source: https://habr.com/ru/post/1781471/


All Articles