mirror of
https://github.com/rui314/chibicc
synced 2024-11-22 14:21:18 +03:00
Add default include paths
This commit is contained in:
parent
a1dd6213c8
commit
a939a7a906
12
main.c
12
main.c
@ -29,6 +29,17 @@ static bool take_arg(char *arg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void add_default_include_paths(char *argv0) {
|
||||
// We expect that chibicc-specific include files are installed
|
||||
// to ./include relative to argv[0].
|
||||
strarray_push(&include_paths, format("%s/include", dirname(strdup(argv0))));
|
||||
|
||||
// Add standard include paths.
|
||||
strarray_push(&include_paths, "/usr/local/include");
|
||||
strarray_push(&include_paths, "/usr/include/x86_64-linux-gnu");
|
||||
strarray_push(&include_paths, "/usr/include");
|
||||
}
|
||||
|
||||
static void parse_args(int argc, char **argv) {
|
||||
// Make sure that all command line options that take an argument
|
||||
// have an argument.
|
||||
@ -313,6 +324,7 @@ int main(int argc, char **argv) {
|
||||
parse_args(argc, argv);
|
||||
|
||||
if (opt_cc1) {
|
||||
add_default_include_paths(argv[0]);
|
||||
cc1();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user