Skip to content

Commit ad5c375

Browse files
author
Daniel Kroening
committed
use a string instead of macro for version number
1 parent 0618f7d commit ad5c375

15 files changed

+111
-111
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Release/*
2828
*.obj
2929
*.a
3030
*.lib
31-
version.h
31+
util/version.cpp
3232
src/ansi-c/arm_builtin_headers.inc
3333
src/ansi-c/clang_builtin_headers.inc
3434
src/ansi-c/cprover_builtin_headers.inc

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Author: Daniel Kroening, [email protected]
6060
janalyzer_parse_optionst::janalyzer_parse_optionst(int argc, const char **argv)
6161
: parse_options_baset(JANALYZER_OPTIONS, argc, argv),
6262
messaget(ui_message_handler),
63-
ui_message_handler(cmdline, "JANALYZER " CBMC_VERSION)
63+
ui_message_handler(cmdline, std::string("JANALYZER ") + CBMC_VERSION)
6464
{
6565
}
6666

@@ -342,7 +342,7 @@ int janalyzer_parse_optionst::doit()
342342
//
343343
// Print a banner
344344
//
345-
status() << "JANALYZER version " CBMC_VERSION " " << sizeof(void *) * 8
345+
status() << "JANALYZER version " << CBMC_VERSION << " " << sizeof(void *) * 8
346346
<< "-bit " << config.this_architecture() << " "
347347
<< config.this_operating_system() << eom;
348348

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@ Author: Daniel Kroening, [email protected]
6161
#include <java_bytecode/replace_java_nondet.h>
6262
#include <java_bytecode/simple_method_stubbing.h>
6363

64-
jbmc_parse_optionst::jbmc_parse_optionst(int argc, const char **argv):
65-
parse_options_baset(JBMC_OPTIONS, argc, argv),
66-
messaget(ui_message_handler),
67-
ui_message_handler(cmdline, "JBMC " CBMC_VERSION),
68-
path_strategy_chooser()
64+
jbmc_parse_optionst::jbmc_parse_optionst(int argc, const char **argv)
65+
: parse_options_baset(JBMC_OPTIONS, argc, argv),
66+
messaget(ui_message_handler),
67+
ui_message_handler(cmdline, std::string("JBMC ") + CBMC_VERSION),
68+
path_strategy_chooser()
6969
{
7070
}
7171

7272
::jbmc_parse_optionst::jbmc_parse_optionst(
7373
int argc,
7474
const char **argv,
75-
const std::string &extra_options):
76-
parse_options_baset(JBMC_OPTIONS+extra_options, argc, argv),
77-
messaget(ui_message_handler),
78-
ui_message_handler(cmdline, "JBMC " CBMC_VERSION),
79-
path_strategy_chooser()
75+
const std::string &extra_options)
76+
: parse_options_baset(JBMC_OPTIONS + extra_options, argc, argv),
77+
messaget(ui_message_handler),
78+
ui_message_handler(cmdline, std::string("JBMC ") + CBMC_VERSION),
79+
path_strategy_chooser()
8080
{
8181
}
8282

@@ -418,9 +418,8 @@ int jbmc_parse_optionst::doit()
418418
//
419419
// Print a banner
420420
//
421-
status() << "JBMC version " CBMC_VERSION " "
422-
<< sizeof(void *)*8 << "-bit "
423-
<< config.this_architecture() << " "
421+
status() << "JBMC version " << CBMC_VERSION << " " << sizeof(void *) * 8
422+
<< "-bit " << config.this_architecture() << " "
424423
<< config.this_operating_system() << eom;
425424

426425
register_language(new_ansi_c_language);

jbmc/src/jdiff/jdiff_parse_options.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Author: Peter Schrammel
6464
jdiff_parse_optionst::jdiff_parse_optionst(int argc, const char **argv)
6565
: parse_options_baset(JDIFF_OPTIONS, argc, argv),
6666
jdiff_languagest(cmdline, ui_message_handler),
67-
ui_message_handler(cmdline, "JDIFF " CBMC_VERSION),
67+
ui_message_handler(cmdline, std::string("JDIFF ") + CBMC_VERSION),
6868
languages2(cmdline, ui_message_handler)
6969
{
7070
}
@@ -75,7 +75,7 @@ ::jdiff_parse_optionst::jdiff_parse_optionst(
7575
const std::string &extra_options)
7676
: parse_options_baset(JDIFF_OPTIONS + extra_options, argc, argv),
7777
jdiff_languagest(cmdline, ui_message_handler),
78-
ui_message_handler(cmdline, "JDIFF " CBMC_VERSION),
78+
ui_message_handler(cmdline, std::string("JDIFF ") + CBMC_VERSION),
7979
languages2(cmdline, ui_message_handler)
8080
{
8181
}
@@ -206,8 +206,8 @@ int jdiff_parse_optionst::doit()
206206
//
207207
// Print a banner
208208
//
209-
status() << "JDIFF version " CBMC_VERSION " " << sizeof(void *) * 8 << "-bit "
210-
<< config.this_architecture() << " "
209+
status() << "JDIFF version " << CBMC_VERSION << " " << sizeof(void *) * 8
210+
<< "-bit " << config.this_architecture() << " "
211211
<< config.this_operating_system() << eom;
212212

213213
if(cmdline.args.size() != 2)

src/cbmc/cbmc_parse_options.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@ Author: Daniel Kroening, [email protected]
6565

6666
#include "xml_interface.h"
6767

68-
cbmc_parse_optionst::cbmc_parse_optionst(int argc, const char **argv):
69-
parse_options_baset(CBMC_OPTIONS, argc, argv),
70-
xml_interfacet(cmdline),
71-
messaget(ui_message_handler),
72-
ui_message_handler(cmdline, "CBMC " CBMC_VERSION),
73-
path_strategy_chooser()
68+
cbmc_parse_optionst::cbmc_parse_optionst(int argc, const char **argv)
69+
: parse_options_baset(CBMC_OPTIONS, argc, argv),
70+
xml_interfacet(cmdline),
71+
messaget(ui_message_handler),
72+
ui_message_handler(cmdline, std::string("CBMC ") + CBMC_VERSION),
73+
path_strategy_chooser()
7474
{
7575
}
7676

7777
::cbmc_parse_optionst::cbmc_parse_optionst(
7878
int argc,
7979
const char **argv,
80-
const std::string &extra_options):
81-
parse_options_baset(CBMC_OPTIONS+extra_options, argc, argv),
82-
xml_interfacet(cmdline),
83-
messaget(ui_message_handler),
84-
ui_message_handler(cmdline, "CBMC " CBMC_VERSION),
85-
path_strategy_chooser()
80+
const std::string &extra_options)
81+
: parse_options_baset(CBMC_OPTIONS + extra_options, argc, argv),
82+
xml_interfacet(cmdline),
83+
messaget(ui_message_handler),
84+
ui_message_handler(cmdline, std::string("CBMC ") + CBMC_VERSION),
85+
path_strategy_chooser()
8686
{
8787
}
8888

@@ -436,9 +436,8 @@ int cbmc_parse_optionst::doit()
436436
//
437437
// Print a banner
438438
//
439-
status() << "CBMC version " CBMC_VERSION " "
440-
<< sizeof(void *)*8 << "-bit "
441-
<< config.this_architecture() << " "
439+
status() << "CBMC version " << CBMC_VERSION << " " << sizeof(void *) * 8
440+
<< "-bit " << config.this_architecture() << " "
442441
<< config.this_operating_system() << eom;
443442

444443
//

src/cbmc/cbmc_solvers.cpp

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,12 @@ std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_smt2(
173173
throw 0;
174174
}
175175

176-
auto smt2_dec=
177-
util_make_unique<smt2_dect>(
178-
ns,
179-
"cbmc",
180-
"Generated by CBMC " CBMC_VERSION,
181-
"QF_AUFBV",
182-
solver);
176+
auto smt2_dec = util_make_unique<smt2_dect>(
177+
ns,
178+
"cbmc",
179+
std::string("Generated by CBMC ") + CBMC_VERSION,
180+
"QF_AUFBV",
181+
solver);
183182

184183
if(options.get_bool_option("fpa"))
185184
smt2_dec->use_FPA_theory=true;
@@ -188,14 +187,13 @@ std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_smt2(
188187
}
189188
else if(filename=="-")
190189
{
191-
auto smt2_conv=
192-
util_make_unique<smt2_convt>(
193-
ns,
194-
"cbmc",
195-
"Generated by CBMC " CBMC_VERSION,
196-
"QF_AUFBV",
197-
solver,
198-
std::cout);
190+
auto smt2_conv = util_make_unique<smt2_convt>(
191+
ns,
192+
"cbmc",
193+
std::string("Generated by CBMC ") + CBMC_VERSION,
194+
"QF_AUFBV",
195+
solver,
196+
std::cout);
199197

200198
if(options.get_bool_option("fpa"))
201199
smt2_conv->use_FPA_theory=true;
@@ -218,14 +216,13 @@ std::unique_ptr<cbmc_solverst::solvert> cbmc_solverst::get_smt2(
218216
throw 0;
219217
}
220218

221-
auto smt2_conv=
222-
util_make_unique<smt2_convt>(
223-
ns,
224-
"cbmc",
225-
"Generated by CBMC " CBMC_VERSION,
226-
"QF_AUFBV",
227-
solver,
228-
*out);
219+
auto smt2_conv = util_make_unique<smt2_convt>(
220+
ns,
221+
"cbmc",
222+
std::string("Generated by CBMC ") + CBMC_VERSION,
223+
"QF_AUFBV",
224+
solver,
225+
*out);
229226

230227
if(options.get_bool_option("fpa"))
231228
smt2_conv->use_FPA_theory=true;

src/clobber/clobber_parse_options.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Author: Daniel Kroening, [email protected]
3535

3636
#include <langapi/mode.h>
3737

38-
clobber_parse_optionst::clobber_parse_optionst(int argc, const char **argv):
39-
parse_options_baset(CLOBBER_OPTIONS, argc, argv),
40-
language_uit(cmdline, ui_message_handler),
41-
ui_message_handler(cmdline, "CLOBBER " CBMC_VERSION)
38+
clobber_parse_optionst::clobber_parse_optionst(int argc, const char **argv)
39+
: parse_options_baset(CLOBBER_OPTIONS, argc, argv),
40+
language_uit(cmdline, ui_message_handler),
41+
ui_message_handler(cmdline, std::string("CLOBBER ") + CBMC_VERSION)
4242
{
4343
}
4444

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ Author: Daniel Kroening, [email protected]
6464

6565
goto_analyzer_parse_optionst::goto_analyzer_parse_optionst(
6666
int argc,
67-
const char **argv):
68-
parse_options_baset(GOTO_ANALYSER_OPTIONS, argc, argv),
69-
messaget(ui_message_handler),
70-
ui_message_handler(cmdline, "GOTO-ANALYZER " CBMC_VERSION)
67+
const char **argv)
68+
: parse_options_baset(GOTO_ANALYSER_OPTIONS, argc, argv),
69+
messaget(ui_message_handler),
70+
ui_message_handler(cmdline, std::string("GOTO-ANALYZER ") + CBMC_VERSION)
7171
{
7272
}
7373

@@ -374,9 +374,8 @@ int goto_analyzer_parse_optionst::doit()
374374
//
375375
// Print a banner
376376
//
377-
status() << "GOTO-ANALYSER version " CBMC_VERSION " "
378-
<< sizeof(void *)*8 << "-bit "
379-
<< config.this_architecture() << " "
377+
status() << "GOTO-ANALYSER version " << CBMC_VERSION << " "
378+
<< sizeof(void *) * 8 << "-bit " << config.this_architecture() << " "
380379
<< config.this_operating_system() << eom;
381380

382381
register_languages();

src/goto-cc/as_mode.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,18 @@ int as_modet::doit()
8282
cmdline.isset("version"))
8383
{
8484
if(act_as_as86)
85-
status() << "as86 version: 0.16.17 (goto-cc " CBMC_VERSION ")"
85+
status() << "as86 version: 0.16.17 (goto-cc " << CBMC_VERSION << ")"
8686
<< eom;
8787
else
8888
status() << "GNU assembler version 2.20.51.0.7 20100318"
89-
<< " (goto-cc " CBMC_VERSION ")" << eom;
90-
91-
status() << '\n' <<
92-
"Copyright (C) 2006-2014 Daniel Kroening, Christoph Wintersteiger\n" <<
93-
"CBMC version: " CBMC_VERSION << '\n' <<
94-
"Architecture: " << config.this_architecture() << '\n' <<
95-
"OS: " << config.this_operating_system() << eom;
89+
<< " (goto-cc " << CBMC_VERSION << ")" << eom;
90+
91+
status()
92+
<< '\n'
93+
<< "Copyright (C) 2006-2014 Daniel Kroening, Christoph Wintersteiger\n"
94+
<< "CBMC version: " << CBMC_VERSION << '\n'
95+
<< "Architecture: " << config.this_architecture() << '\n'
96+
<< "OS: " << config.this_operating_system() << eom;
9697

9798
return EX_OK; // Exit!
9899
}

src/goto-cc/compile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,8 @@ unsigned compilet::function_body_count(const goto_functionst &functions) const
677677

678678
void compilet::add_compiler_specific_defines(configt &config) const
679679
{
680-
config.ansi_c.defines.push_back("__GOTO_CC_VERSION__=" CBMC_VERSION);
680+
config.ansi_c.defines.push_back(
681+
std::string("__GOTO_CC_VERSION__=") + CBMC_VERSION);
681682
}
682683

683684
void compilet::convert_symbols(goto_functionst &dest)

src/goto-cc/gcc_mode.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,16 @@ int gcc_modet::doit()
345345
// Compilation continues, don't exit!
346346

347347
if(act_as_bcc)
348-
std::cout << "bcc: version " << gcc_version
349-
<< " (goto-cc " CBMC_VERSION ")\n";
348+
std::cout << "bcc: version " << gcc_version << " (goto-cc "
349+
<< CBMC_VERSION << ")\n";
350350
else
351351
{
352352
if(gcc_version.flavor == gcc_versiont::flavort::CLANG)
353-
std::cout << "clang version " << gcc_version
354-
<< " (goto-cc " CBMC_VERSION ")\n";
353+
std::cout << "clang version " << gcc_version << " (goto-cc "
354+
<< CBMC_VERSION << ")\n";
355355
else
356-
std::cout << "gcc (goto-cc " CBMC_VERSION ") " << gcc_version << '\n';
356+
std::cout << "gcc (goto-cc " << CBMC_VERSION << ") " << gcc_version
357+
<< '\n';
357358
}
358359
}
359360

@@ -371,7 +372,7 @@ int gcc_modet::doit()
371372
std::cout
372373
<< '\n'
373374
<< "Copyright (C) 2006-2018 Daniel Kroening, Christoph Wintersteiger\n"
374-
<< "CBMC version: " CBMC_VERSION << '\n'
375+
<< "CBMC version: " << CBMC_VERSION << '\n'
375376
<< "Architecture: " << config.this_architecture() << '\n'
376377
<< "OS: " << config.this_operating_system() << '\n';
377378

src/goto-diff/goto_diff_parse_options.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@ Author: Peter Schrammel
6161
#include "unified_diff.h"
6262
#include "change_impact.h"
6363

64-
goto_diff_parse_optionst::goto_diff_parse_optionst(int argc, const char **argv):
65-
parse_options_baset(GOTO_DIFF_OPTIONS, argc, argv),
66-
goto_diff_languagest(cmdline, ui_message_handler),
67-
ui_message_handler(cmdline, "GOTO-DIFF " CBMC_VERSION),
68-
languages2(cmdline, ui_message_handler)
64+
goto_diff_parse_optionst::goto_diff_parse_optionst(int argc, const char **argv)
65+
: parse_options_baset(GOTO_DIFF_OPTIONS, argc, argv),
66+
goto_diff_languagest(cmdline, ui_message_handler),
67+
ui_message_handler(cmdline, std::string("GOTO-DIFF ") + CBMC_VERSION),
68+
languages2(cmdline, ui_message_handler)
6969
{
7070
}
7171

7272
::goto_diff_parse_optionst::goto_diff_parse_optionst(
7373
int argc,
7474
const char **argv,
75-
const std::string &extra_options):
76-
parse_options_baset(GOTO_DIFF_OPTIONS+extra_options, argc, argv),
77-
goto_diff_languagest(cmdline, ui_message_handler),
78-
ui_message_handler(cmdline, "GOTO-DIFF " CBMC_VERSION),
79-
languages2(cmdline, ui_message_handler)
75+
const std::string &extra_options)
76+
: parse_options_baset(GOTO_DIFF_OPTIONS + extra_options, argc, argv),
77+
goto_diff_languagest(cmdline, ui_message_handler),
78+
ui_message_handler(cmdline, std::string("GOTO-DIFF ") + CBMC_VERSION),
79+
languages2(cmdline, ui_message_handler)
8080
{
8181
}
8282

@@ -243,9 +243,8 @@ int goto_diff_parse_optionst::doit()
243243
//
244244
// Print a banner
245245
//
246-
status() << "GOTO-DIFF version " CBMC_VERSION " "
247-
<< sizeof(void *)*8 << "-bit "
248-
<< config.this_architecture() << " "
246+
status() << "GOTO-DIFF version " << CBMC_VERSION << " " << sizeof(void *) * 8
247+
<< "-bit " << config.this_architecture() << " "
249248
<< config.this_operating_system() << eom;
250249

251250
if(cmdline.args.size()!=2)

0 commit comments

Comments
 (0)