February 23, 2005

gcc -E -P

man gcc
[snip]
-E Stop after the preprocessing stage; do not run the compiler proper.
The output is in the form of preprocessed source code, which is
sent to the standard output.

Input files which don't require preprocessing are ignored.
[snip]
-P Inhibit generation of linemarkers in the output from the preproces-
sor. This might be useful when running the preprocessor on some-
thing that is not C code, and will be sent to a program which might
be confused by the linemarkers.

2.4 kernel /driver/block/blkpg.c 在用了新编译器后有问题,需要输出preprocess信息检查
改/driver/block/Makefile如下

#
# Makefile for the kernel block device drivers.
#
# 12 June 2000, Christoph Hellwig
# Rewritten to use lists instead of if-statements.
#
# Note : at this point, these files are compiled on all systems.
# In the future, some of these should be built conditionally.
#

O_TARGET := block.o

export-objs := ll_rw_blk.o blkpg.o loop.o DAC960.o genhd.o

obj-y := ll_rw_blk.o blkpg.o genhd.o elevator.o

[snip] ... [snip]

include $(TOPDIR)/Rules.make

blkpg.o: blkpg.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS_nostdinc) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -E -P $<
$(CC) $(CFLAGS) $(EXTRA_CFLAGS_nostdinc) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -c -o $@ $<

Posted by hufey at February 23, 2005 03:08 PM
Comments
Post a comment









Remember personal info?