-
Notifications
You must be signed in to change notification settings - Fork 559
Open
Description
is_flag_supported is implemented by attempting to compile a C file. This will obviously fail to correctly work when check is done in a non-C context.
For example:
let mut cfg = cc::Build::new();
cfg.flag_if_supported("-xassembler-with-cpp");
cfg.file(asm);
cfg.compile("libanan.a");
will fail to correctly identify that the flag is supported, because -xassembler-with-cpp will try to compile the C file as assembly, which will obviously fail.
This failure condition is not documented.
For at least gcc and clang the file compiled does not need to have any contents within it at all. For example:
echo "" | $CC $TESTED_FLAG -c - -o /tmp/test.o
will correctly test the $TESTED_FLAG.
Metadata
Metadata
Assignees
Labels
No labels