Skip to content

Add another argument for the JERRY_STATIC_ASSERT with the description of the assert statement. #916

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

Merged
merged 1 commit into from
Feb 25, 2016

Conversation

robertsipka
Copy link
Contributor

The release.linux build fails with enabled ALL_IN_ONE option.

@LaszloLango LaszloLango added the bug Undesired behaviour label Feb 24, 2016
@akosthekiss
Copy link
Member

I got confused by the title and the comment of this PR when I took a look at the patch. All I saw was that static asserts were extended with an additional message-like argument. I'm still not sure why that's needed. What kind of typedefs get redefined?

Other than that, the patch seems to be a fair step-by-step rewrite of all static asserts, that's good. (If that's really needed.)

Finally, please make sure that all touched files have the copyright year(s) updated in their headers. (At least some of them contain 2015.)

JERRY_STATIC_ASSERT (sizeof (ecma_object_t) <= sizeof (uint64_t),
size_of_ecma_object_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (ECMA_OBJECT_OBJ_TYPE_SIZE <= sizeof (uint64_t) * JERRY_BITSINBYTE,
ECMA_OBJECT_OBJ_TYPE_SIZE_must_be_less_than_or_equal_to_64_bytes);
Copy link
Member

Choose a reason for hiding this comment

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

_to_8_bytes (!)

@zherczeg
Copy link
Member

The generic direction is good, but I also agree with Akos that some names need to be a bit better.

@robertsipka
Copy link
Contributor Author

Thanks for the comments, I've updated the patch with the suggested names.

JERRY_STATIC_ASSERT (sizeof (ecma_object_t) <= sizeof (uint64_t),
size_of_ecma_object_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (ECMA_OBJECT_OBJ_TYPE_SIZE <= sizeof (uint64_t) * JERRY_BITSINBYTE,
ECMA_OBJECT_OBJ_TYPE_SIZE_must_be_less_than_or_equal_to_bits_in_uint64_t);
Copy link
Member

Choose a reason for hiding this comment

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

ECMA_OBJECT_OBJ_TYPE_SIZE_must_be_less_than_or_equal_to_64_bits ? A bit shorter.

@zherczeg
Copy link
Member

Patch looks much better.

@robertsipka
Copy link
Contributor Author

Thanks, I've updated, and I've also removed the duplicated static asserts too.

@@ -1,4 +1,5 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
Copy link
Contributor

Choose a reason for hiding this comment

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

/* Copyright 2014-2016 Samsung Electronics Co., Ltd.

@akosthekiss
Copy link
Member

Patch looks good, thanks. But still, could you please provide a description of the error it fixes? At least for future reference.

@robertsipka
Copy link
Contributor Author

@akiss77 : The JERRY_STATIC_ASSERT defines a variable, where the name contains the __ LINE __ of the assert. So, in case of all-in-one build, it's possible that there are at least two variables which have the same name (redefinition), because an assert occurs in the same line in another file.

@akosthekiss
Copy link
Member

@robertsipka thanks, LGTM (FWIW)

@zherczeg
Copy link
Member

LGTM

@robertsipka robertsipka changed the title Remove redefinitions of typedef in c. Add another argument for the JERRY_STATIC_ASSERT with the description of the assert statement. Feb 25, 2016
@LaszloLango
Copy link
Contributor

LGTM

Add another argument for the JERRY_STATIC_ASSERT with the description of the assert statement.
The release.linux build fails with enabled ALL_IN_ONE option.
There is no redefinition of typedef in C99.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants