如何在本地头只运行预处理器? [英] How do I run the preprocessor on local headers only?

查看:114
本文介绍了如何在本地头只运行预处理器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望预处理器读入包含的本地头文件,但忽略系统头文件的包含。换句话说,如何让预处理器跳过以下形式的预处理指令:

  #include< h -char-sequence> new-line 

,但仍会处理以下格式的指令:

  #includeq-char-sequencenew-line 






作为代码示例,请观察以下文件:

  #include< iostream> // system 
#includeclass_a.hpp// local
#include< string> // system
#includeclass_b.hpp// local

int main(){}

我如何得到预处理器的输出是:

  #include< iostream> 
class A {};
#include< string>
class B {};

int main(){}





$ b b

本地包含文件可能包括其他本地包含文件,并且预处理器将递归地将它们全部带入;非常像它通常做的。它仍然会打印所有的系统文件头,但不会带来他们的内容。






调用看起来像这样到目前为止: g ++ -E -P main.cpp ,其中 -E 在预处理后停止, -P 排除了行标记的生成。

我似乎找不到排除系统标题处理的标志。

解决方案

你愿意付出多少努力?有一个令人讨厌的晦涩的方式来做到这一点,但它要求您设置一个虚拟目录来保存系统标题的代理。 OTOH,它不要求您的任何源代码的任何更改。



设置



文件:

  ./ class_a.hpp 
./class_b.hpp
./example.cpp
./system-headers/ iostream
./system-headers/string

'系统标题' c $ c> ./ system-headers / iostream 包含一行(在该行上没有!):

  include< iostream> 

类标题每个包含一行,如:

  class A {}; 

example.cpp 的内容您在问题中显示:

  #include< iostream& // system 
#includeclass_a.hpp// local
#include< string> // system
#includeclass_b.hpp// local

int main(){}



运行C预处理器



像这样运行C预处理器会产生如下输出:

  $ cpp -Dinclude =#include -I。 -Isystem-headers example.cpp 
#1example.cpp
#1< built-in>
#1< command-line>
#1example.cpp
#1system-headers / iostream1
#include< iostream>
#2example.cpp2
#1class_a.hpp1
class A {};
#3example.cpp2
#1system-headers / string1
#include< string>
#4example.cpp2
#1class_b.hpp1
class B {};
#5example.cpp2

int main(){}
$

如果删除#n 行,则输出结果为:

  $ cpp -Dinclude =#include -I。 -Isystem-headers example.cpp | grep -v'^#[0-9]'
#include< iostream>
class A {};
#include< string>
class B {};

int main(){}
$

#include 行的开头给出或占用空格是您想要的。



分析



-Dinclude =#include 参数等同于 #define include #include 。当预处理器从宏生成输出时,即使它看起来像一个指令(例如 #include ),它不是一个预处理器指令。引用C ++ 11标准ISO / IEC 14882:2011(不是这在版本AFAIK之间有所变化 - 并且逐字,它在C11标准中说,ISO / IEC 9899:2011在§6.10.3中说的) :


§16.3宏替换



¶8如果预处理令牌,后跟一个标识符,在预处理指令可以开始的地方出现,该标识符不需要进行宏替换。



§16.3.4重新扫描和进一步替换



¶2如果在此扫描替换列表期间找到要替换的宏的名称(不包括其余的源文件的预处理令牌),它不被替换。 ...



¶3完全宏替换的预处理令牌序列不作为预处理伪指令处理,即使它类似于...


当预处理器遇到 #include 时,它在当前目录中查找没有文件,查找 ./ system-headers 并找到文件 iostream ,因此将其处理到输出。它包含一行, include< iostream> 。由于 include 是一个宏,它被扩展(到 #include ),但是阻止进一步扩展,由于§16.3.4¶3,c $ c>#不作为指令处理。因此,输出包含 #include< iostream>



当预处理器遇到 #includeclass_a.hpp,查找当前目录并找到该文件并将其内容包含在输出中。



重复其他标题。如果 class_a.hpp 包含 #include< iostream> ,则最终扩展为 #include< iostream> (带前导空格)。如果您的 system-headers 目录缺少任何标题,那么预处理器将在正常位置搜索,并找到并包括它。如果直接使用编译器而不是 cpp ,可以禁止它使用 -nostdinc 查看系统目录 - 因此如果 system-headers 缺少系统头的代理,则预处理器将生成错误。

  $ g ++ -E -nostdinc -Dinclude =#include -I。 -Isystem-headers example.cpp | grep -v'^#[0-9]'
#include< iostream>
class A {};
#include< string>
class B {};

int main(){}
$

它很容易生成代理系统头:

 用于算法中的头chrono iostream string ... 
do echo include< $ header> > system-headers / $ header
done

JFTR,测试在Mac OS X 10.11 .5与GCC 6.1.0。如果您使用GCC(GNU编译器集合,使用领先的示例编译器 gcc g ++ ),您的里程应该



如果使用宏名称 include 感到不舒服,您可以将其更改为适合您的任何其他内容 - syzygy apoplexy nadir reinclude ,... - 并更改代理头以使用该名称,并在预处理器(编译器)命令行上定义该名称。 的一个优点包括是不可能有任何使用它作为宏名称。



自动生成代理



osgx asks



< blockquote>

我们如何自动生成模拟系统头文件?


有很多选项。一个是分析你的代码(例如使用 grep )来查找被引用或可能被引用的名称,并生成相应的代理头。没有关系,如果你生成一些未使用的头 - 他们不会影响过程。注意,如果你使用 #include< sys / wait.h> ,代理必须是 ./ system-headers / sys / wait.h ;稍微复杂的shell代码显示,但不是非常。另一种方法是查看系统头文件目录中的头文件( / usr / include / usr / local / include ,等),并为您在那里找到的标头生成代理。
例如, mksurrogates.sh 可能是:

  #!/ bin / sh 

sysdir =./ system-headers
for$ @
do
mkdir -p$ sysdir / $(dirname $ header)
echoinclude< $ header> > $ sysdir / $ header
done

> listsyshdrs.sh 找到在命名目录下的源代码中引用的系统头:

  !/ bin / sh 

grep -h -e'^ [[:space:]] *#[[:space:]] * include [[:space:]] *& >] *>'-r$ {@: - 。}|
sed's / ^ [[:space:]] *#[[:space:]] * include [[:space:]] *< \([^>] * \) ;。* / \1 /'|
sort -u

添加了一些格式,这是当我扫描源树与我的答案SO问题:

 算法arpa / inet.h assert.h cassert 
chrono cmath cstddef cstdint
cstdlib cstring ctime ctype.h
dirent.h errno.h fcntl.h float.h
getopt.h inttypes.h iomanip iostream
limits。 h locale.h map math.h
memory.h netdb.h netinet / in.h pthread.h
semaphore.h signal.h sstream stdarg.h
stdbool.h stddef.h stdint.h stdio.h
stdlib.h string string.h sys / ipc.h
sys / mman.h sys / param.h sys / ptrace.h sys / select.h
sys / sem.h sys / shm.h sys / socket.h sys / stat.h
sys / time.h sys / timeb.h sys / times.h sys / types.h
sys / wait.h termios.h time.h unistd.h
实用程序向量wchar.h

因此,要在当前目录下生成源代码的代理:

  $ sh mksurrogatehdr.sh $(sh listsyshdrs.sh )
$ ls -lR system-headers
total 344
-rw-r - r-- 1 jleffler staff 20 Jul 2 17:27 algorithm
drwxr-xr-x 3 jleffler的工作人员102七月2 17:27 arpa
-rw-r - r-- 1 jleffler工作人员19 Jul 2 17:27 assert.h
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 cassert
-rw-r - r-- 1 jleffler工作人员17七月2 17:27 chrono
-rw-r - r-- 1 jleffler工作人员7月2日17:27 cmath
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 cstddef
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 cstdint
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 cstdlib
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 cstring
-rw-r - r-- 1 jleffler工作人员16 Jul 2 17:27 ctime
-rw-r - r-- 1 jleffler工作人员18七月2 17:27 ctype.h
-rw -r - r-- 1 jleffler staff 19 Jul 2 17:27 dirent.h
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 errno.h
-rw -r - r-- 1 jleffler staff 18 Jul 2 17:27 fcntl.h
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 float.h
-rw -r - r-- 1 jleffler staff 19 Jul 2 17:27 getopt.h
-rw-r - r-- 1 jleffler工作人员21七月2 17:27 inttypes.h
-rw -r - r-- 1 jleffler staff 18 Jul 2 17:27 iomanip
-rw-r - r-- 1 jleffler staff 19 Jul 2 17:27 iostream
-rw-r-- r-- 1 jleffler staff 19 Jul 2 17:27 limits.h
-rw-r - r-- 1 jleffler staff 19 Jul 2 17:27 locale.h
-rw-r-- r-- 1 jleffler staff 14 Jul 2 17:27 map
-rw-r - r-- 1 jleffler staff 17 Jul 2 17:27 math.h
-rw-r - r- - 1 jleffler的工作人员19七月2 17:27 memory.h
-rw-r - r-- 1 jleffler工作人员18 7月2日17:27 netdb.h
drwxr-xr-x 3 jleffler工作人员102 Jul 2 17:27 netinet
-rw-r - r-- 1 jleffler工作人员20七月2 17:27 pthread.h
-rw-r - r-- 1 jleffler工作人员7月22日2 17:27 semaphore.h
-rw-r - r-- 1 jleffler staff 19 Jul 2 17:27 signal.h
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 sstream
-rw-r - r-- 1 jleffler工作人员19 Jul 2 17:27 stdarg.h
-rw-r - r-- 1 jleffler工作人员20七月2 17 :27 stdbool.h
-rw-r - r-- 1 jleffler staff 19 Jul 2 17:27 stddef.h
-rw-r - r-- 1 jleffler staff 19 Jul 2 17 :27 stdint.h
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 stdio.h
-rw-r - r-- 1 jleffler staff 19 Jul 2 17 :27 stdlib.h
-rw-r - r-- 1 jleffler staff 17 Jul 2 17:27 string
-rw-r - r-- 1 jleffler staff 19 Jul 2 17:27 string.h
drwxr-xr-x 16 jleffler staff 544 Jul 2 17:27 sys
-rw-r - r-- 1 jleffler staff 7月2日17:27 termios.h
-rw-r - r-- 1 jleffler staff 17 Jul 2 17:27 time.h
-rw-r - r-- 1 jleffler staff 19 Jul 2 17:27 unistd.h
-rw-r - r-- 1 jleffler staff 18 Jul 2 17:27 utility
-rw-r - r-- 1 jleffler staff 17 Jul 2 17:27 vector
-rw- r - r-- 1 jleffler staff 18 Jul 2 17:27 wchar.h

system-headers / arpa:
共8
-rw-r - r- - 1 jleffler staff 22 Jul 2 17:27 inet.h

system-headers / netinet:
共8
-rw-r - r-- 1 jleffler staff 23 Jul 2 17:27 in.h

system-headers / sys:
total 112
-rw-r - r-- 1 jleffler staff 20 Jul 2 17:27 ipc.h
-rw-r - r-- 1 jleffler staff 7月2日17:27 mman.h
-rw-r - r-- 1 jleffler工作人员22七月2 17:27 param.h
-rw-r - r-- 1 jleffler staff 23 Jul 2 17:27 ptrace.h
-rw-r - r-- 1 jleffler工作人员23七月2 17:27 select.h
-rw-r - r-- 1 jleffler staff 20 Jul 2 17:27 sem.h
-rw-r - r-- 1 jleffler staff 7月2日17:27 shm.h
-rw-r - r-- 1 jleffler staff 23 Jul 2 17:27 socket.h
-rw-r - r-- 1 jleffler工作人员21七月2 17:27 stat.h
-rw-r - r-- 1 jleffler staff 7月2日17:27 time.h
-rw-r - r-- 1 jleffler工作人员22七月2 17:27 timeb.h
-rw-r - r-- 1 jleffler staff 22 Jul 2 17:27 times.h
-rw-r - r-- 1 jleffler工作人员22七月2 17:27 types.h
-rw-r - r-- 1 jleffler staff 21 Jul 2 17:27 wait.h
$

这假设头文件名不包含空格,这不是不合理的 - 这将是一个勇敢的程序员用空格或其他棘手的字符创建头文件名。



mksurrogates.sh 的完整生产版本将接受指定代理头目录的参数。


I want the preprocessor to read in the includes of local headers, but ignore the includes of system headers. To put it another way, how do I get the preprocessor to skip over preprocessing directives of the form:

#include <h-char-sequence> new-line

but still process directives of the form:

#include "q-char-sequence" new-line


As a code example, observe the following file:

#include <iostream>     //system
#include "class_a.hpp"  //local
#include <string>       //system
#include "class_b.hpp"  //local

int main() {}

how can I get the output of the preprocessor to be:

#include <iostream>
class A{};
#include <string>
class B{};

int main() {}


Local include files may include other local include files, and the preprocessor would recursively bring them all in; much like it normally does. It would still print all of the system file headers, but it would not bring in their contents.


on gcc, my call looks like this so far: g++ -E -P main.cpp, where -E stops after preprocessing, and -P excludes the generation of line markers.
I can't seem to find a flag that excludes the processing of system headers.

解决方案

How much effort are you willing to go to? There's an obnoxiously obscure way to do it but it requires you to set up a dummy directory to hold surrogates for the system headers. OTOH, it doesn't require any changes in any of your source code. The same technique works equally well for C code.

Setup

Files:

./class_a.hpp
./class_b.hpp
./example.cpp
./system-headers/iostream
./system-headers/string

The 'system headers' such as ./system-headers/iostream contain a single line (there is no # on that line!):

include <iostream>

The class headers each contain a single line like:

class A{};

The contents of example.cpp are what you show in the question:

#include <iostream>     //system
#include "class_a.hpp"  //local
#include <string>       //system
#include "class_b.hpp"  //local

int main() {}

Running the C preprocessor

Running the C preprocessor like this produces the output shown:

$ cpp -Dinclude=#include -I. -Isystem-headers example.cpp
# 1 "example.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "example.cpp"
# 1 "system-headers/iostream" 1
 #include <iostream>
# 2 "example.cpp" 2
# 1 "class_a.hpp" 1
class A{};
# 3 "example.cpp" 2
# 1 "system-headers/string" 1
 #include <string>
# 4 "example.cpp" 2
# 1 "class_b.hpp" 1
class B{};
# 5 "example.cpp" 2

int main() {}
$

If you eliminate the # n lines, that output is:

$ cpp -Dinclude=#include -I. -Isystem-headers example.cpp | grep -v '^# [0-9]'
 #include <iostream>
class A{};
 #include <string>
class B{};

int main() {}
$

which, give or take the space at the beginning of the lines containing #include, is what you wanted.

Analysis

The -Dinclude=#include argument is equivalent to #define include #include. When the preprocessor generates output from a macro, even if it looks like a directive (such as #include), it is not a preprocessor directive. Quoting the C++11 standard ISO/IEC 14882:2011 (not that this has changed between versions AFAIK — and is, verbatim, what it says in the C11 standard, ISO/IEC 9899:2011 too, in §6.10.3):

§16.3 Macro replacement

¶8 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which a preprocessing directive could begin, the identifier is not subject to macro replacement.

§16.3.4 Rescanning and further replacement

¶2 If the name of the macro being replaced is found during this scan of the replacement list (not including the rest of the source file’s preprocessing tokens), it is not replaced. …

¶3 The resulting completely macro-replaced preprocessing token sequence is not processed as a preprocessing directive even if it resembles one, …

When the preprocessor encounters #include <iostream>, it looks in the current directory and finds no file, then looks in ./system-headers and finds the file iostream so it processes that into the output. It contains a single line, include <iostream>. Since include is a macro, it is expanded (to #include) but further expansion is prevented, and the # is not processed as a directive because of §16.3.4 ¶3. Thus, the output contains #include <iostream>.

When the preprocessor encounters #include "class_a.hpp", it looks in the current directory and finds the file and includes its contents in the output.

Rinse and repeat for the other headers. If class_a.hpp contained #include <iostream>, then that ends up expanding to #include <iostream> again (with the leading space). If your system-headers directory is missing any header, then the preprocessor will search in the normal locations and find and include that. If you use the compiler rather than cpp directly, you can prohibit it from looking in the system directories with -nostdinc — so the preprocessor will generate an error if system-headers is missing a (surrogate for a) system header.

$ g++ -E -nostdinc -Dinclude=#include -I. -Isystem-headers example.cpp | grep -v '^# [0-9]'
 #include <iostream>
class A{};
 #include <string>
class B{};

int main() {}
$

Note that it is very easy to generate the surrogate system headers:

for header in algorithm chrono iostream string …
do echo "include <$header>" > system-headers/$header
done

JFTR, testing was done on Mac OS X 10.11.5 with GCC 6.1.0. If you're using GCC (the GNU Compiler Collection, with leading example compilers gcc and g++), your mileage shouldn't vary very much with any plausible alternative version.

If you're uncomfortable using the macro name include, you can change it to anything else that suits you — syzygy, apoplexy, nadir, reinclude, … — and change the surrogate headers to use that name, and define that name on the preprocessor (compiler) command line. One advantage of include is that it's improbable that you have anything using that as a macro name.

Automatically generating surrogate headers

osgx asks:

How can we automate the generation of mock system headers?

There are a variety of options. One is to analyze your code (with grep for example) to find the names that are, or might be, referenced and generate the appropriate surrogate headers. It doesn't matter if you generate a few unused headers — they won't affect the process. Note that if you use #include <sys/wait.h>, the surrogate must be ./system-headers/sys/wait.h; that slightly complicates the shell code shown, but not by very much. Another way would look at the headers in the system header directories (/usr/include, /usr/local/include, etc) and generate surrogates for the headers you find there. For example, mksurrogates.sh might be:

#!/bin/sh

sysdir="./system-headers"
for header in "$@"
do
    mkdir -p "$sysdir/$(dirname $header)"
    echo "include <$header>" > "$sysdir/$header"
done

And we can write listsyshdrs.sh to find the system headers referenced in source code under a named directory:

#!/bin/sh

grep -h -e '^[[:space:]]*#[[:space:]]*include[[:space:]]*<[^>]*>' -r "${@:-.}" |
sed 's/^[[:space:]]*#[[:space:]]*include[[:space:]]*<\([^>]*\)>.*/\1/' |
sort -u

With a bit of formatting added, that generated a list of headers like this when I scanned the source tree with my answers to SO questions:

algorithm         arpa/inet.h       assert.h          cassert
chrono            cmath             cstddef           cstdint
cstdlib           cstring           ctime             ctype.h
dirent.h          errno.h           fcntl.h           float.h
getopt.h          inttypes.h        iomanip           iostream
limits.h          locale.h          map               math.h
memory.h          netdb.h           netinet/in.h      pthread.h
semaphore.h       signal.h          sstream           stdarg.h
stdbool.h         stddef.h          stdint.h          stdio.h
stdlib.h          string            string.h          sys/ipc.h
sys/mman.h        sys/param.h       sys/ptrace.h      sys/select.h
sys/sem.h         sys/shm.h         sys/socket.h      sys/stat.h
sys/time.h        sys/timeb.h       sys/times.h       sys/types.h
sys/wait.h        termios.h         time.h            unistd.h
utility           vector            wchar.h

So, to generate the surrogates for the source tree under the current directory:

$ sh mksurrogatehdr.sh $(sh listsyshdrs.sh)
$ ls -lR system-headers
total 344
-rw-r--r--   1 jleffler  staff   20 Jul  2 17:27 algorithm
drwxr-xr-x   3 jleffler  staff  102 Jul  2 17:27 arpa
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 assert.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 cassert
-rw-r--r--   1 jleffler  staff   17 Jul  2 17:27 chrono
-rw-r--r--   1 jleffler  staff   16 Jul  2 17:27 cmath
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 cstddef
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 cstdint
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 cstdlib
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 cstring
-rw-r--r--   1 jleffler  staff   16 Jul  2 17:27 ctime
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 ctype.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 dirent.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 errno.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 fcntl.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 float.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 getopt.h
-rw-r--r--   1 jleffler  staff   21 Jul  2 17:27 inttypes.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 iomanip
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 iostream
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 limits.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 locale.h
-rw-r--r--   1 jleffler  staff   14 Jul  2 17:27 map
-rw-r--r--   1 jleffler  staff   17 Jul  2 17:27 math.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 memory.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 netdb.h
drwxr-xr-x   3 jleffler  staff  102 Jul  2 17:27 netinet
-rw-r--r--   1 jleffler  staff   20 Jul  2 17:27 pthread.h
-rw-r--r--   1 jleffler  staff   22 Jul  2 17:27 semaphore.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 signal.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 sstream
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 stdarg.h
-rw-r--r--   1 jleffler  staff   20 Jul  2 17:27 stdbool.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 stddef.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 stdint.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 stdio.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 stdlib.h
-rw-r--r--   1 jleffler  staff   17 Jul  2 17:27 string
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 string.h
drwxr-xr-x  16 jleffler  staff  544 Jul  2 17:27 sys
-rw-r--r--   1 jleffler  staff   20 Jul  2 17:27 termios.h
-rw-r--r--   1 jleffler  staff   17 Jul  2 17:27 time.h
-rw-r--r--   1 jleffler  staff   19 Jul  2 17:27 unistd.h
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 utility
-rw-r--r--   1 jleffler  staff   17 Jul  2 17:27 vector
-rw-r--r--   1 jleffler  staff   18 Jul  2 17:27 wchar.h

system-headers/arpa:
total 8
-rw-r--r--  1 jleffler  staff  22 Jul  2 17:27 inet.h

system-headers/netinet:
total 8
-rw-r--r--  1 jleffler  staff  23 Jul  2 17:27 in.h

system-headers/sys:
total 112
-rw-r--r--  1 jleffler  staff  20 Jul  2 17:27 ipc.h
-rw-r--r--  1 jleffler  staff  21 Jul  2 17:27 mman.h
-rw-r--r--  1 jleffler  staff  22 Jul  2 17:27 param.h
-rw-r--r--  1 jleffler  staff  23 Jul  2 17:27 ptrace.h
-rw-r--r--  1 jleffler  staff  23 Jul  2 17:27 select.h
-rw-r--r--  1 jleffler  staff  20 Jul  2 17:27 sem.h
-rw-r--r--  1 jleffler  staff  20 Jul  2 17:27 shm.h
-rw-r--r--  1 jleffler  staff  23 Jul  2 17:27 socket.h
-rw-r--r--  1 jleffler  staff  21 Jul  2 17:27 stat.h
-rw-r--r--  1 jleffler  staff  21 Jul  2 17:27 time.h
-rw-r--r--  1 jleffler  staff  22 Jul  2 17:27 timeb.h
-rw-r--r--  1 jleffler  staff  22 Jul  2 17:27 times.h
-rw-r--r--  1 jleffler  staff  22 Jul  2 17:27 types.h
-rw-r--r--  1 jleffler  staff  21 Jul  2 17:27 wait.h
$

This assumes that header file names contain no spaces, which is not unreasonable — it would be a brave programmer who created header file names with spaces or other tricky characters.

A full production-ready version of mksurrogates.sh would accept an argument specifying the surrogate header directory.

这篇关于如何在本地头只运行预处理器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆