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

Add bool specialization for VariableLengthArray; fix AUTOSAR compliance issues; fix GTest integration #284

Merged
merged 26 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d59ae51
Add missing #include <limits>
pavel-kirienko Feb 27, 2023
9e2df8f
Fix email address
pavel-kirienko Feb 27, 2023
2a80533
Add boolean specialization for VariableLengthArray; fix a few minor i…
pavel-kirienko Mar 2, 2023
f8c31cb
Contributing guide: add a note about cov_all
pavel-kirienko Mar 2, 2023
a1da03c
Un-disable warnings that were disabled by mistake due to incorrect GT…
pavel-kirienko Mar 2, 2023
9f6000e
Update to the latest GTest (no changes to the codebase were necessary)
pavel-kirienko Mar 2, 2023
44f7eb7
Update the compilability tests for the VLA by extending them to the b…
pavel-kirienko Mar 2, 2023
6875e4c
Extend the generic array test suite to also cover bool spec
pavel-kirienko Mar 2, 2023
8c1d88f
Simplify compilability test
pavel-kirienko Mar 2, 2023
adb4e4c
Extend the static array test to the bool specialization
pavel-kirienko Mar 2, 2023
1c24a17
Expand coverage
pavel-kirienko Mar 2, 2023
09c1abf
Run black
pavel-kirienko Mar 2, 2023
57a16ef
Disable -Wzero-as-null-pointer-constant in C++ test that depends on C…
pavel-kirienko Mar 2, 2023
4b64c79
Bump the patch version
pavel-kirienko Mar 2, 2023
ebacaa4
Fix build
pavel-kirienko Mar 3, 2023
4d5afe4
Add missing special functions to ReferenceImpl
pavel-kirienko Mar 3, 2023
a9475f7
Replace const_reference with the bool value type
pavel-kirienko Mar 3, 2023
4a34c2e
Format
pavel-kirienko Mar 3, 2023
7bc5f7f
Make the default constructors constexpr as suggested by Scott
pavel-kirienko Mar 3, 2023
94166aa
Add a missing method to the bool array reference class
pavel-kirienko Mar 3, 2023
d4e4d26
Fix conversion warning
pavel-kirienko Mar 3, 2023
2e76e97
Add missing cast to avoid -Werror=sign-conversion
pavel-kirienko Mar 3, 2023
43390aa
Autoformat variable_length_array.hpp
pavel-kirienko Mar 3, 2023
ab08384
Include cmath
pavel-kirienko Mar 3, 2023
7fac04c
Add missing noexcept
pavel-kirienko Mar 3, 2023
fe3b3d5
Remove assertion check
pavel-kirienko Mar 3, 2023
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: 2 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ In the list of targets that the :code:`cmake --build . --target help` command li
will be prefixed with :code:`test_` and the psedo-target that also executes the test will be prefixed with
:code:`run_test_`. You should avoid the :code:`_with_lcov` when you are manually building tests.

To obtain coverage information for the verification suite (not the Python code),
build the `cov_all` target and inspect the output under the `coverage` directory.

cmake build options
------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/nunavut/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.. autodata:: __version__
"""

__version__ = "2.0.2"
__version__ = "2.0.3"
__license__ = "MIT"
__author__ = "OpenCyphal"
__copyright__ = "Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Copyright (c) 2022 OpenCyphal."
Expand Down
6 changes: 1 addition & 5 deletions src/nunavut/jinja/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def __init__(
package_name_for_templates: typing.Optional[str] = None,
search_policy: ResourceSearchPolicy = ResourceSearchPolicy.FIND_ALL,
):

super().__init__(namespace, generate_namespace_types)

if templates_dir is not None and not isinstance(templates_dir, list):
Expand Down Expand Up @@ -668,7 +667,6 @@ def is_deprecated(instance: pydsdl.Any) -> bool:
# +-----------------------------------------------------------------------+

def __init__(self, namespace: nunavut.Namespace, **kwargs: typing.Any):

# set the search policy so we ignore the internal templates iff a filesystem
# path is provided to the generator.
super().__init__(namespace, search_policy=ResourceSearchPolicy.FIND_FIRST, **kwargs)
Expand All @@ -688,7 +686,7 @@ def generate_all(
*self.language_context.get_target_language().get_support_module(), is_dryrun, omit_serialization_support
)
provider = self.namespace.get_all_types if self.generate_namespace_types else self.namespace.get_all_datatypes
for (parsed_type, output_path) in provider():
for parsed_type, output_path in provider():
logger.info("Generating: %s", parsed_type)
generated.append(self._generate_type(parsed_type, output_path, is_dryrun, allow_overwrite))
return generated
Expand Down Expand Up @@ -785,7 +783,6 @@ class SupportGenerator(CodeGenerator):
"""

def __init__(self, namespace: nunavut.Namespace, **kwargs: typing.Any):

super().__init__(namespace, builtin_template_path="support", **kwargs)

target_language = self.language_context.get_target_language()
Expand Down Expand Up @@ -867,7 +864,6 @@ def _copy_header(
line_pps: typing.List["nunavut._postprocessors.LinePostProcessor"],
file_pps: typing.List["nunavut._postprocessors.FilePostProcessor"],
) -> pathlib.Path:

if not is_dryrun:
self._handle_overwrite(target, allow_overwrite)
target.parent.mkdir(parents=True, exist_ok=True)
Expand Down
2 changes: 0 additions & 2 deletions src/nunavut/jinja/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ def update_nunavut_globals(
is_dryrun: bool = False,
omit_serialization_support: bool = False,
) -> None:

nunavut_namespace = self.nunavut_global

setattr(
Expand Down Expand Up @@ -498,7 +497,6 @@ def _add_support_from_language_module_to_environment(
)

def _update_language_support(self, lctx: LanguageContext) -> None:

supported_languages = lctx.get_supported_languages()
target_language = lctx.get_target_language()
ln_globals = self.globals["ln"]
Expand Down
1 change: 0 additions & 1 deletion src/nunavut/jinja/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def parse(self, parser: Parser) -> nodes.Node:
return result

def _use_query_common(self, uses_query_name: str, lineno: int, name: str, filename: str) -> bool:

target_language = self.environment.target_language

if uses_query_name is None:
Expand Down
1 change: 0 additions & 1 deletion src/nunavut/lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ def _new_language_map(self, target_language: Language) -> typing.Dict[str, Langu
return languages

def _resolve_target_language(self, explicit_value: typing.Optional[str]) -> str:

if explicit_value is not None:
return explicit_value

Expand Down
2 changes: 0 additions & 2 deletions src/nunavut/lang/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,6 @@ def _strop_by_keyword(self, token: str, token_type: str, dry_run: bool) -> str:
return stropped

def _strop_by_pattern(self, token: str, token_type: str, dry_run: bool) -> str:

stropped = token

reserved_pattern_rules = self._reserved_token_patterns_by_type[token_type]
Expand Down Expand Up @@ -439,7 +438,6 @@ def encode_character(self, c: str) -> str:

@functools.lru_cache(maxsize=1024)
def strop(self, token: str, token_type: str = "any") -> str: # noqa: C901

token_type_lower = token_type.lower()
if token_type_lower == "all":
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion src/nunavut/lang/cpp/support/serialization.j2
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public:
const uint8_t in = static_cast<uint8_t>(static_cast<uint8_t>(data_[src_off / 8U] >> src_mod) << dst_mod) & 0xFFU; // NOSONAR
// Intentional violation of MISRA: indexing on a pointer.
// This simplifies the implementation greatly and avoids pointer arithmetics.
const uint8_t a = dst.data_[dst_off / 8U] & (static_cast<uint8_t>((~mask) & 0xFFU)); // NOSONAR
const uint8_t a = dst.data_[dst_off / 8U] & (static_cast<uint8_t>(static_cast<uint8_t>(~mask) & 0xFFU)); // NOSONAR
const uint8_t b = in & mask;
// Intentional violation of MISRA: indexing on a pointer.
// This simplifies the implementation greatly and avoids pointer arithmetics.
Expand Down
Loading