"# 32 \"<command-line>\" 2\n";
// Note: Intentionally not using the string form to avoid false positive
// match by ccache itself.
- static const char incbin_prefix[] = {
- '.', 'i', 'n', 'c', 'b', 'i', 'n', ' '};
+ static const char incbin_directive[] = {'.', 'i', 'n', 'c', 'b', 'i', 'n'};
// Check if we look at a line containing the file name of an included file.
// At least the following formats exist (where N is a positive integer):
Statistic::could_not_use_precompiled_header);
}
p = q; // Everything of interest between p and q has been hashed now.
- } else if (strncmp(q, incbin_prefix, sizeof(incbin_prefix)) == 0
- && (q[8] == '"' || (q[8] == '\\' && q[9] == '"'))) {
+ } else if (strncmp(q, incbin_directive, sizeof(incbin_directive)) == 0
+ && ((q[7] == ' '
+ && (q[8] == '"' || (q[8] == '\\' && q[9] == '"')))
+ || q[7] == '"')) {
// An assembler .inc bin (without the space) statement, which could be
// part of inline assembly, refers to an external file. If the file
// changes, the hash should change as well, but finding out what file to
// hash is too hard for ccache, so just bail out.
LOG_RAW(
- "Found unsupported .inc"
+ "Found potential unsupported .inc"
"bin directive in source code");
return nonstd::make_unexpected(
Failure(Statistic::unsupported_code_directive));
expect_stat cache_miss 0
expect_stat unsupported_code_directive 1
+ cat <<EOF >incbin.c
+__asm__(".incbin" " \"empty.bin\"");
+EOF
+
+ $CCACHE_COMPILE -c incbin.c
+ expect_stat preprocessed_cache_hit 0
+ expect_stat cache_miss 0
+ expect_stat unsupported_code_directive 2
+
cat <<EOF >incbin.s
.incbin "empty.bin";
EOF
$CCACHE_COMPILE -c incbin.s
expect_stat preprocessed_cache_hit 0
expect_stat cache_miss 0
- expect_stat unsupported_code_directive 2
+ expect_stat unsupported_code_directive 3
cat <<EOF >incbin.cpp
struct A {
if $CCACHE_COMPILE -x c++ -c incbin.cpp 2>/dev/null; then
expect_stat preprocessed_cache_hit 0
expect_stat cache_miss 1
- expect_stat unsupported_code_directive 2
+ expect_stat unsupported_code_directive 3
fi
fi