cprover
|
#include "c_preprocess.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <util/c_types.h>
#include <util/config.h>
#include <util/message.h>
#include <util/tempfile.h>
#include <util/unicode.h>
#include <util/arith_tools.h>
#include <util/std_types.h>
#include <util/prefix.h>
Go to the source code of this file.
Macros | |
#define | GCC_DEFINES_16 |
#define | GCC_DEFINES_32 |
#define | GCC_DEFINES_LP64 |
#define | GCC_DEFINES_LLP64 |
Functions | |
static std::string | type_max (const typet &src) |
produce a string with the maximum value of a given type More... | |
static std::string | shell_quote (const std::string &src) |
quote a string for bash and CMD More... | |
static void | error_parse_line (const std::string &line, bool warning_only, messaget &message) |
static void | error_parse (std::istream &errors, bool warning_only, messaget &message) |
bool | c_preprocess (std::istream &instream, std::ostream &outstream, message_handlert &message_handler) |
ANSI-C preprocessing. More... | |
static bool | is_dot_i_file (const std::string &path) |
ANSI-C preprocessing. More... | |
bool | c_preprocess_codewarrior (const std::string &, std::ostream &, message_handlert &) |
ANSI-C preprocessing. More... | |
bool | c_preprocess_arm (const std::string &file, std::ostream &outstream, message_handlert &message_handler) |
ANSI-C preprocessing. More... | |
bool | c_preprocess_gcc_clang (const std::string &file, std::ostream &outstream, message_handlert &message_handler, configt::ansi_ct::preprocessort preprocessor) |
ANSI-C preprocessing. More... | |
bool | c_preprocess_none (const std::string &file, std::ostream &outstream, message_handlert &message_handler) |
ANSI-C preprocessing. More... | |
bool | c_preprocess_visual_studio (const std::string &file, std::ostream &outstream, message_handlert &message_handler) |
ANSI-C preprocessing. More... | |
bool | c_preprocess (const std::string &path, std::ostream &outstream, message_handlert &message_handler) |
void | postprocess_codewarrior (std::istream &instream, std::ostream &outstream) |
post-processing specifically for CodeWarrior More... | |
bool | test_c_preprocessor (message_handlert &message_handler) |
Variables | |
const char | c_test_program [] |
tests ANSI-C preprocessing More... | |
#define GCC_DEFINES_16 |
Definition at line 35 of file c_preprocess.cpp.
Referenced by c_preprocess_arm(), and c_preprocess_gcc_clang().
#define GCC_DEFINES_32 |
Definition at line 51 of file c_preprocess.cpp.
Referenced by c_preprocess_arm(), and c_preprocess_gcc_clang().
#define GCC_DEFINES_LLP64 |
Definition at line 83 of file c_preprocess.cpp.
Referenced by c_preprocess_gcc_clang().
#define GCC_DEFINES_LP64 |
Definition at line 67 of file c_preprocess.cpp.
Referenced by c_preprocess_arm(), and c_preprocess_gcc_clang().
bool c_preprocess | ( | std::istream & | instream, |
std::ostream & | outstream, | ||
message_handlert & | message_handler | ||
) |
ANSI-C preprocessing.
Definition at line 318 of file c_preprocess.cpp.
References c_preprocess(), messaget::eom(), and messaget::error().
Referenced by c_preprocess(), ansi_c_languaget::preprocess(), cpp_languaget::preprocess(), and test_c_preprocessor().
bool c_preprocess | ( | const std::string & | path, |
std::ostream & | outstream, | ||
message_handlert & | message_handler | ||
) |
Definition at line 370 of file c_preprocess.cpp.
References configt::ansi_c, configt::ansi_ct::ARM, c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), c_preprocess_none(), c_preprocess_visual_studio(), configt::ansi_ct::CLANG, configt::ansi_ct::CODEWARRIOR, config, configt::ansi_ct::GCC, configt::ansi_ct::NONE, configt::ansi_ct::preprocessor, and configt::ansi_ct::VISUAL_STUDIO.
bool c_preprocess_arm | ( | const std::string & | file, |
std::ostream & | outstream, | ||
message_handlert & | message_handler | ||
) |
ANSI-C preprocessing.
Definition at line 925 of file c_preprocess.cpp.
References configt::ansi_c, c_preprocess_none(), config, configt::ansi_ct::defines, messaget::eom(), messaget::error(), error_parse(), GCC_DEFINES_16, GCC_DEFINES_32, GCC_DEFINES_LP64, get_temporary_file(), configt::ansi_ct::include_paths, configt::ansi_ct::int_width, is_dot_i_file(), configt::ansi_ct::os, configt::ansi_ct::OS_WIN, configt::ansi_ct::pointer_width, and shell_quote().
Referenced by c_preprocess().
bool c_preprocess_codewarrior | ( | const std::string & | file, |
std::ostream & | outstream, | ||
message_handlert & | message_handler | ||
) |
ANSI-C preprocessing.
Definition at line 548 of file c_preprocess.cpp.
References configt::ansi_c, c_preprocess_none(), config, configt::ansi_ct::defines, messaget::eom(), messaget::error(), error_parse(), get_temporary_file(), configt::ansi_ct::include_files, configt::ansi_ct::include_paths, is_dot_i_file(), postprocess_codewarrior(), configt::ansi_ct::preprocessor_options, and shell_quote().
Referenced by c_preprocess().
bool c_preprocess_gcc_clang | ( | const std::string & | file, |
std::ostream & | outstream, | ||
message_handlert & | message_handler, | ||
configt::ansi_ct::preprocessort | preprocessor | ||
) |
ANSI-C preprocessing.
Definition at line 621 of file c_preprocess.cpp.
References configt::ansi_c, configt::ansi_ct::arch, configt::ansi_ct::C11, configt::ansi_ct::C89, configt::ansi_ct::C99, c_preprocess_none(), configt::ansi_ct::c_standard, configt::ansi_ct::char_is_unsigned, configt::ansi_ct::char_width, configt::ansi_ct::CLANG, config, configt::ansi_ct::defines, messaget::eom(), messaget::error(), error_parse(), GCC_DEFINES_16, GCC_DEFINES_32, GCC_DEFINES_LLP64, GCC_DEFINES_LP64, get_temporary_file(), configt::ansi_ct::include_files, configt::ansi_ct::include_paths, configt::ansi_ct::int_width, is_dot_i_file(), configt::ansi_ct::long_int_width, configt::ansi_ct::mode, configt::ansi_ct::NO_OS, configt::ansi_ct::os, configt::ansi_ct::OS_LINUX, configt::ansi_ct::OS_MACOS, configt::ansi_ct::OS_WIN, configt::ansi_ct::pointer_width, configt::ansi_ct::preprocessor_options, shell_quote(), configt::ansi_ct::short_int_width, type_max(), configt::ansi_ct::VISUAL_STUDIO, configt::ansi_ct::wchar_t_is_unsigned, wchar_t_type(), and configt::ansi_ct::wchar_t_width.
Referenced by c_preprocess().
bool c_preprocess_none | ( | const std::string & | file, |
std::ostream & | outstream, | ||
message_handlert & | message_handler | ||
) |
ANSI-C preprocessing.
Definition at line 1047 of file c_preprocess.cpp.
References configt::ansi_c, configt::ansi_ct::CODEWARRIOR, config, messaget::eom(), messaget::error(), configt::ansi_ct::mode, postprocess_codewarrior(), and widen().
Referenced by c_preprocess(), c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), and c_preprocess_visual_studio().
bool c_preprocess_visual_studio | ( | const std::string & | file, |
std::ostream & | outstream, | ||
message_handlert & | message_handler | ||
) |
ANSI-C preprocessing.
Definition at line 405 of file c_preprocess.cpp.
References configt::ansi_c, c_preprocess_none(), configt::ansi_ct::char_is_unsigned, config, configt::ansi_ct::defines, messaget::eom(), messaget::error(), error_parse(), get_temporary_file(), configt::ansi_ct::include_files, configt::ansi_ct::include_paths, is_dot_i_file(), configt::ansi_ct::pointer_width, and shell_quote().
Referenced by c_preprocess().
|
static |
Definition at line 306 of file c_preprocess.cpp.
References error_parse_line().
Referenced by c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), and c_preprocess_visual_studio().
|
static |
Definition at line 186 of file c_preprocess.cpp.
References messaget::eom(), messaget::error(), has_prefix(), source_locationt::set_column(), source_locationt::set_file(), source_locationt::set_function(), source_locationt::set_line(), messaget::mstreamt::source_location, and messaget::warning().
Referenced by error_parse().
|
static |
ANSI-C preprocessing.
Definition at line 344 of file c_preprocess.cpp.
Referenced by c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), and c_preprocess_visual_studio().
void postprocess_codewarrior | ( | std::istream & | instream, |
std::ostream & | outstream | ||
) |
post-processing specifically for CodeWarrior
Definition at line 512 of file c_preprocess.cpp.
Referenced by c_preprocess_codewarrior(), and c_preprocess_none().
|
static |
quote a string for bash and CMD
Definition at line 113 of file c_preprocess.cpp.
Referenced by c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), and c_preprocess_visual_studio().
bool test_c_preprocessor | ( | message_handlert & | message_handler | ) |
Definition at line 1087 of file c_preprocess.cpp.
References c_preprocess(), and c_test_program.
Referenced by cbmc_parse_optionst::doit().
|
static |
produce a string with the maximum value of a given type
Definition at line 100 of file c_preprocess.cpp.
References irept::id(), integer2string(), power(), to_signedbv_type(), and to_unsignedbv_type().
Referenced by c_preprocess_gcc_clang().
const char c_test_program[] |
tests ANSI-C preprocessing
Definition at line 1082 of file c_preprocess.cpp.
Referenced by test_c_preprocessor().