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

Assertions cleanup #1097

Merged
merged 1 commit into from Mar 13, 2017
Merged

Assertions cleanup #1097

merged 1 commit into from Mar 13, 2017

Conversation

shindere
Copy link
Contributor

Replace a few occurrences of assert and many occurrences of Assert
by CAMLassert.

For multi-line assertions, an effort has been made to keep the code
both aligned correctly and beyond the 80-characters-per-line limit.
Sighted input would be welcome to make sure this has actually been achieved.

Also, in byterun/caml/weak.h, function caml_ephe_clean, does
anybody know why the assertions have not been aligned with

header_t hd; ?

Does this need to be preserved or changed?

Similar question for byterun/compact.c, byterun/minor_gc.c, byterun/misc.c and
byterun/freelist.c.

In this file, does the big comment with all the assertions in it
need to be preserved?

In byterun/intern.c, see the comment saying: "do not do the urgent_gc
check here because it might darken intern_block into gray and break
the Assert 3 lines down.": maybe "3 lines down" could be replaced by "below"?

@xavierleroy
Copy link
Contributor

does anybody know why the assertions have not been aligned ?

Assertions hanging to the right of the page are one of @damiendoligez's mannerisms.

Does this need to be preserved or changed?

Preserved, of course, like all mannerisms from great masters.

@gasche
Copy link
Member

gasche commented Mar 10, 2017

in byterun/intern.c [...] maybe "3 lines down" could be replaced by "below"?

I wondered which of the two asserts below was being meant. The "3 lines" measure was broken by ddd51af, and the relevant assert is (as could be expected) the first one, that is the intern_color Assert. I would rephrase this as "the intern_color Assert below".

@shindere
Copy link
Contributor Author

shindere commented Mar 10, 2017 via email

@shindere
Copy link
Contributor Author

Just rebased on latest trunk. Does it look okay to be merged, now?

Replace a few occurrences of assert and many occurrences of Assert
by CAMLassert.

In asmrun/spacetime_snapshot.c, the line

  Assert(0);  /* unreachable */

in the function caml_spacetime_shape_table has been removed
rather than replaced because the caml_failwith function called
just above has the noreturn attribute which should be enough to
keep compilers happy.

The same holds in the function caml_spacetime_only_works_for_native_code
defined in byterun/spacetime.c
@xavierleroy xavierleroy merged commit 791a26c into ocaml:trunk Mar 13, 2017
@shindere shindere deleted the assertions-cleanup branch March 13, 2017 16:08
@damiendoligez
Copy link
Member

Preserved, of course, like all mannerisms from great masters.

Nah, I've grown out of this one...

@shindere
Copy link
Contributor Author

shindere commented Mar 14, 2017 via email

@damiendoligez
Copy link
Member

(2) it's not that convenient from an a11y (accessibility, like
i18n for internationalization) perspective

This is indeed a very good reason to remove it.

shindere added a commit that referenced this pull request Mar 31, 2017
This is a follow-up to the discussion that took place in PR #1097.
@shindere
Copy link
Contributor Author

shindere commented Mar 31, 2017 via email

stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants