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 6 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 @@ -315,6 +315,7 @@ def exec_kompile(options: KompileCommandOptions) -> None:
'gen_glr_bison_parser': options.gen_glr_bison_parser,
'bison_lists': options.bison_lists,
'outer_parsed_json': options.outer_parsed_json,
'ignore_warnings': options.ignore_warnings,
tothtamas28 marked this conversation as resolved.
Show resolved Hide resolved
}
if options.backend == KompileBackend.LLVM:
kompile_dict['ccopts'] = options.ccopts
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] | None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a 100% sure in this, but consider

Suggested change
ignore_warnings: list[str] | None
ignore_warnings: list[str]

This makes it consitent with ccopts.

@nwatson22, is this the right convention to follow?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'd go without the None type option unless there is a situation where it could actually be set to None, which there shouldn't be as far as I know since you have [] as the default.


@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': None,
tothtamas28 marked this conversation as resolved.
Show resolved Hide resolved
}

@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', dest='ignore_warnings', default=None, action='append', help='Ignore provided warnings'
tothtamas28 marked this conversation as resolved.
Show resolved Hide resolved
tothtamas28 marked this conversation as resolved.
Show resolved Hide resolved
)
return args

@cached_property
Expand Down
6 changes: 6 additions & 0 deletions pyk/src/pyk/ktool/kompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ class KompileArgs:
coverage: bool
bison_lists: bool
outer_parsed_json: bool
ignore_warnings: Iterable[str] | None
tothtamas28 marked this conversation as resolved.
Show resolved Hide resolved

def __init__(
self,
Expand All @@ -531,6 +532,7 @@ def __init__(
coverage: bool = False,
bison_lists: bool = False,
outer_parsed_json: bool = False,
ignore_warnings: Iterable[str] | None = None,
):
main_file = Path(main_file)
include_dirs = tuple(sorted(Path(include_dir) for include_dir in include_dirs))
Expand All @@ -551,6 +553,7 @@ def __init__(
object.__setattr__(self, 'coverage', coverage)
object.__setattr__(self, 'bison_lists', bison_lists)
object.__setattr__(self, 'outer_parsed_json', outer_parsed_json)
object.__setattr__(self, 'ignore_warnings', ignore_warnings)

def args(self) -> list[str]:
args = [str(self.main_file)]
Expand Down Expand Up @@ -597,6 +600,9 @@ def args(self) -> list[str]:
if self.outer_parsed_json:
args += ['--outer-parsed-json']

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

return args


Expand Down
Loading