Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Interaction with the analyzer is primarily through the command-line interpreter
> chkc c-file analyze <filename>
> chkc c-file report-file <filename>
```
The first command preprocesses the file with gcc; the preprocessed file (.i file)
The first command preprocesses the file with `cc`; the preprocessed file (.i file)
is then parsed with **parseFile** (a wrapper for goblint-cil,
https://opam.ocaml.org/packages/goblint-cil/).
The second command analyzes the parsed artifacts, and the third command (and
Expand Down
20 changes: 10 additions & 10 deletions chc/cmdline/ParseManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,32 +221,32 @@ def save_semantics(self) -> None:
)
os.chdir(cwd)

def preprocess_file_with_gcc(
def preprocess_file_with_cc(
self,
cfilename: str,
copyfiles: bool = True,
moreoptions: List[str] = []) -> str:
"""Invoke gcc preprocessor on c source file.
"""Invoke C preprocessor on c source file.

Args:
cfilename: c source code filename relative to cpath
moreoptions: list of additional options to be given to the
preprocessor

Effects:
invokes the gcc preprocessor on the c source file and optionally
invokes the C preprocessor on the c source file and optionally
copies the original source file and the generated .i file to the
tgtpath/sourcefiles directory
tgtpath/sourcefiles directory.
"""

chklogger.logger.info("Preprocess file with gcc: %s", cfilename)
chklogger.logger.info("Preprocess file with cc: %s", cfilename)
cwd = os.getcwd()
mac = self.config.platform == "mac"
ifilename = cfilename[:-1] + "i"
macoptions = [
"-U___BLOCKS___", "-D_DARWIN_C_SOURCE", "-D_FORTIFY_SOURCE=0"]
cmd = [
"gcc",
"cc",
"-fno-inline",
"-fno-builtin",
"-E",
Expand Down Expand Up @@ -498,7 +498,7 @@ def parse_ifiles(self, copyfiles: bool = True) -> None:
targetfiles.save_xml_file(self.analysisresultspath)

def parse_cfiles(self, copyfiles: bool = True) -> None:
"""Preprocess (with gcc) and run the CodeHawk C parser on all .c
"""Preprocess and run the CodeHawk C parser on all .c
files in the directory."""

os.chdir(self.projectpath)
Expand All @@ -509,7 +509,7 @@ def parse_cfiles(self, copyfiles: bool = True) -> None:
fname = self.normalize_filename(os.path.join(d, fname))
if fname.startswith("semantics"):
continue
ifilename = self.preprocess_file_with_gcc(fname, copyfiles)
ifilename = self.preprocess_file_with_cc(fname, copyfiles)
self.parse_ifile(ifilename)
targetfiles.add_file(self.normalize_filename(fname))
targetfiles.save_xml_file(self.analysisresultspath)
Expand Down Expand Up @@ -585,7 +585,7 @@ def save_xml_file(self, tgtpath: str) -> None:

if __name__ == "__main__":

# preprocess and parse single files with gcc
# preprocess and parse single files with cc
thisdir = os.path.dirname(os.path.abspath(__file__))
topdir = os.path.dirname(os.path.dirname(thisdir))
testsdir = os.path.join(topdir, "tests")
Expand All @@ -594,5 +594,5 @@ def save_xml_file(self, tgtpath: str) -> None:
pm = ParseManager(id115dir, "kendra115", id115dir)
pm.initialize_paths()
for f in ["id115.c", "id116.c", "id117.c", "id118.c"]:
ifilename = pm.preprocess_file_with_gcc(f)
ifilename = pm.preprocess_file_with_cc(f)
pm.parse_ifile(ifilename)
8 changes: 4 additions & 4 deletions chc/cmdline/c_file/cfileutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def set_logging(
def cfile_parse_file(args: argparse.Namespace) -> NoReturn:
"""Parses a single file and saves the results in the .cch directory.

This command runs the gcc preprocessor on the single c-file presented and
This command runs the `cc` preprocessor on the single c-file presented and
then calls the ocaml C analyzer to parse (using the goblint cil parser)
the resulting .i file into ocaml data structures. These data structures
are saved in the <projectname>.cch/a directory. The original c-file and
Expand Down Expand Up @@ -154,7 +154,7 @@ def cfile_parse_file(args: argparse.Namespace) -> NoReturn:
parsemanager.initialize_paths()

try:
cfilename_i = parsemanager.preprocess_file_with_gcc(cfilename_c)
cfilename_i = parsemanager.preprocess_file_with_cc(cfilename_c)
result = parsemanager.parse_ifile(cfilename_i)
if result != 0:
print("*" * 80)
Expand Down Expand Up @@ -479,7 +479,7 @@ def cfile_run_file(args: argparse.Namespace) -> NoReturn:
parsemanager.initialize_paths()

try:
cfilename_i = parsemanager.preprocess_file_with_gcc(cfilename_c)
cfilename_i = parsemanager.preprocess_file_with_cc(cfilename_c)
result = parsemanager.parse_ifile(cfilename_i)
if result != 0:
print("*" * 80)
Expand Down Expand Up @@ -707,7 +707,7 @@ def cfile_testlibc_summary(args: argparse.Namespace) -> NoReturn:
parsemanager.initialize_paths()

try:
cfilename_i = parsemanager.preprocess_file_with_gcc(cfilename_c)
cfilename_i = parsemanager.preprocess_file_with_cc(cfilename_c)
result = parsemanager.parse_ifile(cfilename_i)
if result != 0:
print("*" * 80)
Expand Down
2 changes: 1 addition & 1 deletion chc/cmdline/chkc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The regular sequence of commands is:

> chkc c-file parse <cfilename>.c

This command will call gcc to preprocess the file and produce an .i file.
This command will call `cc` to preprocess the file and produce an .i file.
Then the CodeHawk/CIL parser is called to convert the preprocessed file into
OCaml data structures for further analysis. The data structures are stored
in xml_format in (by default) the directory <cfilename>.cch .
Expand Down
2 changes: 1 addition & 1 deletion chc/cmdline/kendra/TestManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def test_parser(self, savesemantics: bool = False) -> bool:
self.parsemanager.initialize_paths()
for cfile in self.cref_files:
cfilename_c = cfile.name
ifilename = self.parsemanager.preprocess_file_with_gcc(
ifilename = self.parsemanager.preprocess_file_with_cc(
cfilename_c, copyfiles=True
)
parseresult = self.parsemanager.parse_ifile(ifilename)
Expand Down
2 changes: 1 addition & 1 deletion chc/util/fileutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
1. A new analysis directory is created: tp/pn.cch with two subdirectories:
tp/pn.cch/a and tp/pn.cch/s

2. x.c is preprocessed with the gcc preprocessor, producing the file
2. x.c is preprocessed with the C preprocessor, producing the file
pp/fp/x.i. Both pp/fp/x.c and pp/fp/x.i are copied to tp/pn.cch/s/fp.

3. x.c is parsed by the CodeHawk/CIL parser, producing the following files
Expand Down
Loading