3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

merge with master

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-03-25 14:57:01 -07:00
commit c513f3ca09
883 changed files with 13979 additions and 16480 deletions

View file

@ -41,7 +41,7 @@ static stopwatch g_overall_time;
static stopwatch g_piece_timer;
static unsigned t_parsing = 0;
static datalog::context * g_ctx = 0;
static datalog::context * g_ctx = nullptr;
static datalog::rule_set * g_orig_rules;
static datalog::instruction_block * g_code;
static datalog::execution_context * g_ectx;
@ -257,7 +257,7 @@ unsigned read_datalog(char const * file) {
true);
return ERR_MEMOUT;
}
register_on_timeout_proc(0);
register_on_timeout_proc(nullptr);
return 0;
}

View file

@ -26,7 +26,7 @@ Revision History:
#include "sat/sat_solver.h"
extern bool g_display_statistics;
static sat::solver * g_solver = 0;
static sat::solver * g_solver = nullptr;
static clock_t g_start_time;
static void display_statistics() {

View file

@ -17,7 +17,7 @@ Author:
#include "util/gparams.h"
#include <signal.h>
static lp::lp_solver<double, double>* g_solver = 0;
static lp::lp_solver<double, double>* g_solver = nullptr;
static void display_statistics() {
if (g_solver && g_solver->settings().print_statistics) {
@ -49,7 +49,7 @@ struct front_end_resource_limit : public lp::lp_resource_limit {
m_reslim(lim)
{}
virtual bool get_cancel_flag() { return !m_reslim.inc(); }
bool get_cancel_flag() override { return !m_reslim.inc(); }
};
void run_solver(lp_params & params, char const * mps_file_name) {
@ -95,8 +95,8 @@ void run_solver(lp_params & params, char const * mps_file_name) {
// #pragma omp critical (g_display_stats)
{
display_statistics();
register_on_timeout_proc(0);
g_solver = 0;
register_on_timeout_proc(nullptr);
g_solver = nullptr;
}
delete solver;
}

View file

@ -36,12 +36,13 @@ Revision History:
#include "util/file_path.h"
#include "util/gparams.h"
#include "util/env_params.h"
#include "util/file_path.h"
#include "shell/lp_frontend.h"
typedef enum { IN_UNSPECIFIED, IN_SMTLIB, IN_SMTLIB_2, IN_DATALOG, IN_DIMACS, IN_WCNF, IN_OPB, IN_LP, IN_Z3_LOG, IN_MPS } input_kind;
typedef enum { IN_UNSPECIFIED, IN_SMTLIB_2, IN_DATALOG, IN_DIMACS, IN_WCNF, IN_OPB, IN_LP, IN_Z3_LOG, IN_MPS } input_kind;
std::string g_aux_input_file;
char const * g_input_file = 0;
char const * g_input_file = nullptr;
bool g_standard_input = false;
input_kind g_input_kind = IN_UNSPECIFIED;
bool g_display_statistics = false;
@ -115,7 +116,7 @@ void display_usage() {
void parse_cmd_line_args(int argc, char ** argv) {
int i = 1;
char * eq_pos = 0;
char * eq_pos = nullptr;
while (i < argc) {
char * arg = argv[i];
@ -147,7 +148,7 @@ void parse_cmd_line_args(int argc, char ** argv) {
// allow names such as --help
if (*opt_name == '-')
opt_name++;
char * opt_arg = 0;
char * opt_arg = nullptr;
char * colon = strchr(arg, ':');
if (colon) {
opt_arg = colon + 1;
@ -172,9 +173,6 @@ void parse_cmd_line_args(int argc, char ** argv) {
std::cout << "\n";
exit(0);
}
else if (strcmp(opt_name, "smt") == 0) {
g_input_kind = IN_SMTLIB;
}
else if (strcmp(opt_name, "smt2") == 0) {
g_input_kind = IN_SMTLIB_2;
}
@ -208,7 +206,7 @@ void parse_cmd_line_args(int argc, char ** argv) {
else if (strcmp(opt_name, "v") == 0) {
if (!opt_arg)
error("option argument (-v:level) is missing.");
long lvl = strtol(opt_arg, 0, 10);
long lvl = strtol(opt_arg, nullptr, 10);
set_verbosity_level(lvl);
}
else if (strcmp(opt_name, "file") == 0) {
@ -217,7 +215,7 @@ void parse_cmd_line_args(int argc, char ** argv) {
else if (strcmp(opt_name, "T") == 0) {
if (!opt_arg)
error("option argument (-T:timeout) is missing.");
long tm = strtol(opt_arg, 0, 10);
long tm = strtol(opt_arg, nullptr, 10);
set_timeout(tm * 1000);
}
else if (strcmp(opt_name, "t") == 0) {
@ -336,9 +334,6 @@ int STD_CALL main(int argc, char ** argv) {
else if (strcmp(ext, "smt2") == 0) {
g_input_kind = IN_SMTLIB_2;
}
else if (strcmp(ext, "smt") == 0) {
g_input_kind = IN_SMTLIB;
}
else if (strcmp(ext, "mps") == 0 || strcmp(ext, "sif") == 0 ||
strcmp(ext, "MPS") == 0 || strcmp(ext, "SIF") == 0) {
g_input_kind = IN_MPS;
@ -346,9 +341,6 @@ int STD_CALL main(int argc, char ** argv) {
}
}
switch (g_input_kind) {
case IN_SMTLIB:
return_value = read_smtlib_file(g_input_file);
break;
case IN_SMTLIB_2:
memory::exit_when_out_of_memory(true, "(error \"out of memory\")");
return_value = read_smtlib2_commands(g_input_file);

View file

@ -17,12 +17,12 @@ Copyright (c) 2015 Microsoft Corporation
#include "ast/reg_decl_plugins.h"
#include "model/model_smt2_pp.h"
#include "opt/opt_context.h"
#include "opt/opt_parse.h"
#include "shell/opt_frontend.h"
#include "opt/opt_parse.h"
extern bool g_display_statistics;
static bool g_first_interrupt = true;
static opt::context* g_opt = 0;
static opt::context* g_opt = nullptr;
static double g_start_time = 0;
static unsigned_vector g_handles;
@ -135,8 +135,8 @@ static unsigned parse_opt(std::istream& in, opt_format f) {
#pragma omp critical (g_display_stats)
{
display_statistics();
register_on_timeout_proc(0);
g_opt = 0;
register_on_timeout_proc(nullptr);
g_opt = nullptr;
}
return 0;
}

View file

@ -21,7 +21,6 @@ Revision History:
#include<iostream>
#include<time.h>
#include<signal.h>
#include "parsers/smt/smtlib_solver.h"
#include "util/timeout.h"
#include "parsers/smt2/smt2parser.h"
#include "muz/fp/dl_cmds.h"
@ -35,20 +34,14 @@ Revision History:
extern bool g_display_statistics;
static clock_t g_start_time;
static smtlib::solver* g_solver = 0;
static cmd_context * g_cmd_context = 0;
static cmd_context * g_cmd_context = nullptr;
static void display_statistics() {
clock_t end_time = clock();
if ((g_solver || g_cmd_context) && g_display_statistics) {
if (g_cmd_context && g_display_statistics) {
std::cout.flush();
std::cerr.flush();
if (g_solver) {
g_solver->display_statistics();
memory::display_max_usage(std::cout);
std::cout << "time: " << ((static_cast<double>(end_time) - static_cast<double>(g_start_time)) / CLOCKS_PER_SEC) << " secs\n";
}
else if (g_cmd_context) {
if (g_cmd_context) {
g_cmd_context->set_regular_stream("stdout");
g_cmd_context->display_statistics(true, ((static_cast<double>(end_time) - static_cast<double>(g_start_time)) / CLOCKS_PER_SEC));
}
@ -72,33 +65,6 @@ static void STD_CALL on_ctrl_c(int) {
raise(SIGINT);
}
unsigned read_smtlib_file(char const * benchmark_file) {
g_start_time = clock();
register_on_timeout_proc(on_timeout);
signal(SIGINT, on_ctrl_c);
smtlib::solver solver;
g_solver = &solver;
bool ok = true;
ok = solver.solve_smt(benchmark_file);
if (!ok) {
if (benchmark_file) {
std::cerr << "ERROR: solving '" << benchmark_file << "'.\n";
}
else {
std::cerr << "ERROR: solving input stream.\n";
}
}
#pragma omp critical (g_display_stats)
{
display_statistics();
register_on_timeout_proc(0);
g_solver = 0;
}
return solver.get_error_code();
}
unsigned read_smtlib2_commands(char const * file_name) {
g_start_time = clock();
@ -136,7 +102,7 @@ unsigned read_smtlib2_commands(char const * file_name) {
#pragma omp critical (g_display_stats)
{
display_statistics();
g_cmd_context = 0;
g_cmd_context = nullptr;
}
return result ? 0 : 1;
}