}
/*
- * Options taking an argument that that we may want to rewrite
- * to relative paths to get better hit rate. A secondary effect
- * is that paths in the standard error output produced by the
- * compiler will be normalized.
+ * Options taking an argument that we may want to rewrite to relative paths
+ * to get better hit rate. A secondary effect is that paths in the standard
+ * error output produced by the compiler will be normalized.
*/
-
if (compopt_takes_path(argv[i])) {
char *relpath;
char *pch_file = NULL;
goto out;
}
- /* if the argument only affects the preprocessed output then
- * it should not affect the compilation of the .c file
- */
relpath = make_relative_path(x_strdup(argv[i+1]));
if (compopt_affects_cpp(argv[i])) {
args_add(cpp_args, argv[i]);
relpath = make_relative_path(x_strdup(argv[i] + 2));
option = format("-%c%s", argv[i][1], relpath);
- /* if the argument only affects the preprocessed output then
- * it should not affect the compilation of the .c file
- */
if (compopt_short(compopt_affects_cpp, argv[i])) {
args_add(cpp_args, option);
} else {
goto out;
}
- /* if the argument only affects the preprocessed output then
- * it should not affect the compilation of the .c file
- */
if (compopt_affects_cpp(argv[i])) {
args_add(cpp_args, argv[i]);
args_add(cpp_args, argv[i+1]);
/* other options */
if (argv[i][0] == '-') {
- if (compopt_affects_cpp(argv[i]) ||
- compopt_prefix_affects_cpp(argv[i])) {
+ if (compopt_affects_cpp(argv[i])
+ || compopt_prefix_affects_cpp(argv[i])) {
args_add(cpp_args, argv[i]);
} else {
args_add(stripped_args, argv[i]);
/*
- * Copyright (C) 2010 Joel Rosdahl
+ * Copyright (C) 2010, 2012 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
{"-fno-working-directory", AFFECTS_CPP},
{"-frepo", TOO_HARD},
{"-ftest-coverage", TOO_HARD}, /* generates a .gcno file at the same time */
- {"-fworking-directory", AFFECTS_CPP},
+ {"-fworking-directory", AFFECTS_CPP},
{"-idirafter", AFFECTS_CPP | TAKES_ARG | TAKES_PATH},
{"-iframework", AFFECTS_CPP | TAKES_ARG | TAKES_CONCAT_ARG | TAKES_PATH},
{"-imacros", AFFECTS_CPP | TAKES_ARG | TAKES_PATH},
return co && (co->type & TAKES_ARG);
}
-/* determines if argument takes a concatentated argument
- by comparing prefixes
-*/
+/* Determines if argument takes a concatentated argument by comparing prefixes.
+ */
bool
compopt_takes_concat_arg(const char *option)
{
return co && (co->type & TAKES_CONCAT_ARG);
}
-/* determines if the prefix of the option matches
- any option and affects the preprocessor
-*/
+/* Determines if the prefix of the option matches any option and affects the
+ * preprocessor.
+ */
bool
compopt_prefix_affects_cpp(const char *option)
{
/* prefix options have to take concatentated args */
const struct compopt *co = find_prefix(option);
- return co && (co->type & TAKES_CONCAT_ARG) &&
- (co->type & AFFECTS_CPP);
+ return co && (co->type & TAKES_CONCAT_ARG) && (co->type & AFFECTS_CPP);
}
/*
- * Copyright (C) 2010 Joel Rosdahl
+ * Copyright (C) 2010, 2012 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
CHECK(compopt_prefix_affects_cpp("-iframework"));
}
-
TEST_SUITE_END