Skip to content
Open
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
11 changes: 8 additions & 3 deletions chc/cmdline/ParseManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
self._verbose = verbose
# compile to 32 bit or 64 bit platform (default 64 bit)
self._tgtplatform = tgtplatform
if not (self.tgtplatform in ["-m64", "-m32"]):
if not (self.tgtplatform in ["", "-m64", "-m32"]):
print(
"Warning: invalid target platform: "
+ self.tgtplatform
Expand Down Expand Up @@ -252,8 +252,11 @@ def preprocess_file_with_cc(
"-fno-inline",
"-fno-builtin",
"-E",
"-g",
self.tgtplatform,
"-g"
]
if self.tgtplatform:
cmd.append(self.tgtplatform)
cmd += [
"-o",
ifilename,
cfilename,
Expand Down Expand Up @@ -317,6 +320,8 @@ def get_platform_index(self, cmd: List[str]) -> int:
return -1

def set_platform(self, cmd: List[str]) -> None:
if not self.tgtplatform:
return
index = self.get_platform_index(cmd)
if index >= 0:
platform = cmd[index]
Expand Down
7 changes: 6 additions & 1 deletion chc/cmdline/c_file/cfileutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def cfile_parse_file(args: argparse.Namespace) -> NoReturn:
pcfilename: str = os.path.abspath(args.filename)
opttgtpath: Optional[str] = args.tgtpath
keep_system_includes: bool = args.keep_system_includes
tgtplatform: str = args.target_platform
loglevel: str = args.loglevel
logfilename: Optional[str] = args.logfilename
logfilemode: str = args.logfilemode
Expand Down Expand Up @@ -159,7 +160,11 @@ def cfile_parse_file(args: argparse.Namespace) -> NoReturn:
chklogger.logger.info("Target path: %s", targetpath)

parsemanager = ParseManager(
projectpath, projectname, targetpath, keep_system_includes=keep_system_includes)
projectpath,
projectname,
targetpath,
keep_system_includes=keep_system_includes,
tgtplatform=tgtplatform)
parsemanager.remove_semantics()
parsemanager.initialize_paths()

Expand Down
4 changes: 3 additions & 1 deletion chc/cmdline/c_project/cprojectutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def cproject_parse_project(args: argparse.Namespace) -> NoReturn:
projectname: str = args.projectname
opttgtpath: Optional[str] = args.tgtpath
keep_system_includes: bool = args.keep_system_includes
tgtplatform: str = args.target_platform
loglevel: str = args.loglevel
logfilename: Optional[str] = args.logfilename
logfilemode: str = args.logfilemode
Expand Down Expand Up @@ -168,7 +169,8 @@ def cproject_parse_project(args: argparse.Namespace) -> NoReturn:
projectpath,
projectname,
targetpath,
keep_system_includes=keep_system_includes)
keep_system_includes=keep_system_includes,
tgtplatform=tgtplatform)
parsemanager.remove_semantics()
parsemanager.initialize_paths()
exitcode = parsemanager.parse_with_ccommands(compilecommands, copyfiles=True)
Expand Down
8 changes: 8 additions & 0 deletions chc/cmdline/chkc
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,10 @@ def parse() -> argparse.Namespace:
"--keep-system-includes",
action="store_true",
help="do not filter out functions from files with absolute file names")
cfileparse.add_argument(
"--target-platform",
default="-m64",
help="target platform argument for build system")
cfileparse.add_argument(
"--loglevel", "-log",
choices=UL.LogLevel.options(),
Expand Down Expand Up @@ -1491,6 +1495,10 @@ def parse() -> argparse.Namespace:
"--keep-system-includes",
action="store_true",
help="don't filter out functions from files with absolute filenames")
cprojectparse.add_argument(
"--target-platform",
default="-m64",
help="target platform argument for build system")
cprojectparse.add_argument(
"--loglevel", "-log",
choices=UL.LogLevel.options(),
Expand Down