Skip to content

Commit 7b2a7cf

Browse files
committed
Clang configuration: apply defaults rather than using configure_gcc
This isn't as precise, but will avoid the cost of process invocation. Such cost is considerable on Windows and appears to be around 100ms on macOS.
1 parent 62c2909 commit 7b2a7cf

File tree

8 files changed

+14
-44
lines changed

8 files changed

+14
-44
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,6 @@ int cbmc_parse_optionst::doit()
548548
gcc_version.get("gcc");
549549
configure_gcc(gcc_version);
550550
}
551-
else if(config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
552-
{
553-
gcc_versiont gcc_version;
554-
gcc_version.get("clang");
555-
configure_gcc(gcc_version);
556-
}
557551

558552
if(cmdline.isset("test-preprocessor"))
559553
return test_c_preprocessor(ui_message_handler)

src/cprover/cprover_parse_options.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,6 @@ int cprover_parse_optionst::main()
131131
gcc_version.get("gcc");
132132
configure_gcc(gcc_version);
133133
}
134-
else if(
135-
config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
136-
{
137-
gcc_versiont gcc_version;
138-
gcc_version.get("clang");
139-
configure_gcc(gcc_version);
140-
}
141134

142135
console_message_handlert message_handler;
143136
null_message_handlert null_message_handler;

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,6 @@ int goto_analyzer_parse_optionst::doit()
421421
gcc_version.get("gcc");
422422
configure_gcc(gcc_version);
423423
}
424-
else if(config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
425-
{
426-
gcc_versiont gcc_version;
427-
gcc_version.get("clang");
428-
configure_gcc(gcc_version);
429-
}
430424

431425
goto_model = initialize_goto_model(cmdline.args, ui_message_handler, options);
432426

src/goto-diff/goto_diff_parse_options.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,6 @@ int goto_diff_parse_optionst::doit()
107107
gcc_version.get("gcc");
108108
configure_gcc(gcc_version);
109109
}
110-
else if(config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
111-
{
112-
gcc_versiont gcc_version;
113-
gcc_version.get("clang");
114-
configure_gcc(gcc_version);
115-
}
116110

117111
if(process_goto_program(options, goto_model1))
118112
return CPROVER_EXIT_INTERNAL_ERROR;

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@ int goto_instrument_parse_optionst::doit()
139139
gcc_version.get("gcc");
140140
configure_gcc(gcc_version);
141141
}
142-
else if(
143-
config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
144-
{
145-
gcc_versiont gcc_version;
146-
gcc_version.get("clang");
147-
configure_gcc(gcc_version);
148-
}
149142

150143
{
151144
const bool validate_only = cmdline.isset("validate-goto-binary");

src/goto-synthesizer/goto_synthesizer_parse_options.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ int goto_synthesizer_parse_optionst::doit()
7373
gcc_version.get("gcc");
7474
configure_gcc(gcc_version);
7575
}
76-
else if(config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
77-
{
78-
gcc_versiont gcc_version;
79-
gcc_version.get("clang");
80-
configure_gcc(gcc_version);
81-
}
8276

8377
update_max_malloc_size(goto_model, ui_message_handler);
8478

src/libcprover-cpp/api.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ api_sessiont::api_sessiont(const api_optionst &options)
6969
gcc_version.get("gcc");
7070
configure_gcc(gcc_version);
7171
}
72-
else if(config.ansi_c.preprocessor == configt::ansi_ct::preprocessort::CLANG)
73-
{
74-
gcc_versiont gcc_version;
75-
gcc_version.get("clang");
76-
configure_gcc(gcc_version);
77-
}
7872
}
7973

8074
api_sessiont::~api_sessiont() = default;

src/util/config.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,13 @@ bool configt::set(const cmdlinet &cmdline)
986986
ansi_c.os=configt::ansi_ct::ost::OS_MACOS;
987987
ansi_c.mode = ansi_ct::flavourt::CLANG;
988988
ansi_c.preprocessor=ansi_ct::preprocessort::CLANG;
989+
// configure_gcc sets these with additional version-of-clang level of
990+
// detail, but the below are reasonable defaults for modern clang
991+
// installations
992+
ansi_c.__float128_is_keyword = true;
993+
ansi_c.float16_type = true;
994+
ansi_c.bf16_type = true;
995+
ansi_c.fp16_type = true;
989996
}
990997
else if(os == "linux" || os == "solaris" || os == "netbsd" || os == "hurd")
991998
{
@@ -1000,6 +1007,13 @@ bool configt::set(const cmdlinet &cmdline)
10001007
ansi_c.os=configt::ansi_ct::ost::OS_LINUX;
10011008
ansi_c.mode=ansi_ct::flavourt::CLANG;
10021009
ansi_c.preprocessor=ansi_ct::preprocessort::CLANG;
1010+
// configure_gcc sets these with additional version-of-clang level of
1011+
// detail, but the below are reasonable defaults for modern clang
1012+
// installations
1013+
ansi_c.__float128_is_keyword = true;
1014+
ansi_c.float16_type = true;
1015+
ansi_c.bf16_type = true;
1016+
ansi_c.fp16_type = true;
10031017
}
10041018
else
10051019
{

0 commit comments

Comments
 (0)