Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose -Wno via ignore-warnings kompile option #4471

Merged
merged 13 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
1 change: 1 addition & 0 deletions pyk/src/pyk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def exec_kompile(options: KompileCommandOptions) -> None:
type_inference_mode=options.type_inference_mode,
warnings=options.warnings,
warnings_to_errors=options.warnings_to_errors,
ignore_warnings=options.ignore_warnings,
no_exc_wrap=options.no_exc_wrap,
)
except RuntimeError as err:
Expand Down
5 changes: 5 additions & 0 deletions pyk/src/pyk/cli/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class KompileOptions(Options):
bison_lists: bool
no_exc_wrap: bool
outer_parsed_json: bool
ignore_warnings: list[str]

@staticmethod
def default() -> dict[str, Any]:
Expand All @@ -230,6 +231,7 @@ def default() -> dict[str, Any]:
'bison_lists': False,
'no_exc_wrap': False,
'outer_parsed_json': False,
'ignore_warnings': [],
}

@staticmethod
Expand Down Expand Up @@ -475,6 +477,9 @@ def kompile_args(self) -> ArgumentParser:
action='store_true',
help='Do not wrap the output on the CLI.',
)
args.add_argument(
'--ignore-warnings', '-Wno', dest='ignore_warnings', action='append', help='Ignore provided warnings'
)
return args

@cached_property
Expand Down
10 changes: 10 additions & 0 deletions pyk/src/pyk/ktool/kompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def kompile(
type_inference_mode: str | TypeInferenceMode | None = None,
warnings: str | Warnings | None = None,
warnings_to_errors: bool = False,
ignore_warnings: Iterable[str] = (),
no_exc_wrap: bool = False,
# ---
debug: bool = False,
Expand All @@ -77,6 +78,7 @@ def kompile(
type_inference_mode=type_inference_mode,
warnings=warnings,
warnings_to_errors=warnings_to_errors,
ignore_warnings=ignore_warnings,
no_exc_wrap=no_exc_wrap,
debug=debug,
verbose=verbose,
Expand All @@ -95,6 +97,7 @@ def kompile(
type_inference_mode=type_inference_mode,
warnings=warnings,
warnings_to_errors=warnings_to_errors,
ignore_warnings=ignore_warnings,
no_exc_wrap=no_exc_wrap,
debug=debug,
verbose=verbose,
Expand All @@ -110,6 +113,7 @@ def _booster_kompile(
type_inference_mode: str | TypeInferenceMode | None,
warnings: str | Warnings | None,
warnings_to_errors: bool,
ignore_warnings: Iterable[str],
no_exc_wrap: bool,
# ---
debug: bool,
Expand Down Expand Up @@ -145,6 +149,7 @@ def kompile_llvm() -> None:
type_inference_mode=type_inference_mode,
warnings=warnings,
warnings_to_errors=warnings_to_errors,
ignore_warnings=ignore_warnings,
no_exc_wrap=no_exc_wrap,
debug=debug,
verbose=verbose,
Expand All @@ -160,6 +165,7 @@ def kompile_haskell() -> None:
type_inference_mode=type_inference_mode,
warnings=warnings,
warnings_to_errors=warnings_to_errors,
ignore_warnings=ignore_warnings,
no_exc_wrap=no_exc_wrap,
debug=debug,
verbose=verbose,
Expand Down Expand Up @@ -272,6 +278,7 @@ def __call__(
type_inference_mode: str | TypeInferenceMode | None = None,
warnings: str | Warnings | None = None,
warnings_to_errors: bool = False,
ignore_warnings: Iterable[str] = (),
no_exc_wrap: bool = False,
debug: bool = False,
verbose: bool = False,
Expand Down Expand Up @@ -320,6 +327,9 @@ def __call__(
if outer_parsed_json:
args += ['--outer-parsed-json']

if ignore_warnings:
args += ['-Wno', ','.join(ignore_warnings)]

try:
proc_res = run_process(args, logger=_LOGGER, cwd=cwd, check=check)
except CalledProcessError as err:
Expand Down
1 change: 1 addition & 0 deletions pyk/src/pyk/testing/_kompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __call__(
output_dir=output_dir,
type_inference_mode=TypeInferenceMode.CHECKED,
warnings_to_errors=True,
ignore_warnings=(),
JuanCoRo marked this conversation as resolved.
Show resolved Hide resolved
)

return self._cache[kompile]
Expand Down
Loading