[llvm-dev] Why does clang -E - of a header file may have different exit status?

Peng Yu via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 29 20:04:14 PDT 2021


I see different exit status of clang. Does anybody know why? Should
clang be consistent on this aspect no matter what the header file is?

$ clang -E - <<< '#include <bfd.h>' | head -n 1
# 1 "<stdin>"
$ declare -p PIPESTATUS
declare -a PIPESTATUS=([0]="141" [1]="0")
$ clang -E - <<< '#include <stdio.h>' | head -n 1
# 1 "<stdin>"
$ declare -p PIPESTATUS
declare -a PIPESTATUS=([0]="0" [1]="0")
$ clang --version
Debian clang version 11.0.1-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

gcc's exit status is consistent in this case.

$ gcc -E - <<< '#include <stdio.h>' | head -n 1
# 1 "<stdin>"
$ declare -p PIPESTATUS
declare -a PIPESTATUS=([0]="2" [1]="0")
$ gcc -E - <<< '#include <bfd.h>' | head -n 1
# 1 "<stdin>"
$ declare -p PIPESTATUS
declare -a PIPESTATUS=([0]="2" [1]="0")
$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

-- 
Regards,
Peng


More information about the llvm-dev mailing list