cprover
c_preprocess.cpp File Reference
#include "c_preprocess.h"
#include <util/c_types.h>
#include <util/config.h>
#include <util/suffix.h>
#include <util/tempfile.h>
#include <util/unicode.h>
#include <fstream>
Include dependency graph for c_preprocess.cpp:

Go to the source code of this file.

Functions

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...
 

Function Documentation

◆ c_preprocess() [1/2]

bool c_preprocess ( std::istream &  instream,
std::ostream &  outstream,
message_handlert message_handler 
)

◆ c_preprocess() [2/2]

◆ c_preprocess_arm()

◆ c_preprocess_codewarrior()

bool c_preprocess_codewarrior ( const std::string &  file,
std::ostream &  outstream,
message_handlert message_handler 
)

◆ c_preprocess_gcc_clang()

◆ c_preprocess_none()

bool c_preprocess_none ( const std::string &  file,
std::ostream &  outstream,
message_handlert message_handler 
)

◆ c_preprocess_visual_studio()

◆ error_parse()

static void error_parse ( std::istream &  errors,
bool  warning_only,
messaget message 
)
static

◆ error_parse_line()

static void error_parse_line ( const std::string &  line,
bool  warning_only,
messaget message 
)
static

◆ is_dot_i_file()

static bool is_dot_i_file ( const std::string &  path)
static

ANSI-C preprocessing.

Definition at line 251 of file c_preprocess.cpp.

References has_suffix().

Referenced by c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), and c_preprocess_visual_studio().

◆ postprocess_codewarrior()

void postprocess_codewarrior ( std::istream &  instream,
std::ostream &  outstream 
)

post-processing specifically for CodeWarrior

Definition at line 416 of file c_preprocess.cpp.

Referenced by c_preprocess_codewarrior(), and c_preprocess_none().

◆ shell_quote()

static std::string shell_quote ( const std::string &  src)
static

quote a string for bash and CMD

Definition at line 20 of file c_preprocess.cpp.

Referenced by c_preprocess_arm(), c_preprocess_codewarrior(), c_preprocess_gcc_clang(), and c_preprocess_visual_studio().

◆ test_c_preprocessor()

bool test_c_preprocessor ( message_handlert message_handler)

Definition at line 875 of file c_preprocess.cpp.

References c_preprocess(), c_test_program, and message_handler.

Referenced by cbmc_parse_optionst::doit().

Variable Documentation

◆ c_test_program

const char c_test_program[]
Initial value:
=
"#include <stdlib.h>\n"
"\n"
"int main() { }\n"

tests ANSI-C preprocessing

Definition at line 870 of file c_preprocess.cpp.

Referenced by test_c_preprocessor().