libc: C23 conformance for <assert.h>#2203
Conversation
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
|
Thank you for taking the time to contribute to FreeBSD! Some of files have special handling: Important @concussious wants to review changes to share/man/ |
|
CC @bsdimp Some thoughts on this one:
|
a75a7d4 to
e67ed1a
Compare
Agreed. Done.
Not sure if we should still keep it, but I think its sole purpose is backward compatibility as same-name functions with a leading underscore were seen as implementation internals back in early days of UNIX. I was not born back then, though, so I could be completely wrong.
Why should we document feature test macros? That's not something user needs to be concerned with.
It is not wrong, I believe. I've frequently seen "macros with an ellipsis parameter", "variadic macros", and similar terms—especially in the standard, proposal documents, and compiler documentation. But I understand your point, I'll take care of it shortly.
Right, I'll take care of it tomorrow.
Sure, I'll add a note for that.
I deliberately didn't use it for lines 105-107, but you're right about line 80. Sure. I'll do an update on the manpage tomorrow evening (better phrasing, new examples, etc.) |
|
By the way, please accept my apologies if the branch is named |
The macro is part of the C standard, but in retrospect I didn't add it to
The important thing is that whatever term we use is consistent within FreeBSD's documentation. Perhaps @concussious can say more here. Looking forwards to your updates and don't worry about the branch name. |
|
Another thing: please add to HISTORY the version in which |
Conforming implementations must define In the meantime, I am working on a separate PR to address the remaining missing As mentioned in the shared document, the macro can be defined before full conformance (e.g. as an include guard only) as long as its value is empty or a smaller number like
You're right, it now makes complete sense to me. Fair point. Thanks.
Thanks, Robert.
Sure, will do. |
Just opened the PR as a draft. I'll add description and mark it as ready for review once my tests complete, but happy to hear any early feedback or requests in the meantime. |
e67ed1a to
98422a1
Compare
|
OT: An adjacent data point to consider for assert(): if you're profiling code bases for source code complexity metric, allegedly its use bloats the SonarSource metric. as measured by clang-tidy, and this requires a specific workaround. Found because I've been doing background research to support falsifying certain other... hypotheses. |
Interesting! Thanks for the point. I'd love to hear more about your findings. |
|
Addressed Robert's notes as best I could. I kept the ellipsis term but tried to clarify the macro signature description around it (I'm open to removing it altogether, but couldn't think of a better phrasing, to be honest). Let me know if you any suggestions. Cc: @clausecker, @concussious |
clausecker
left a comment
There was a problem hiding this comment.
More corrections.
Is the complicated definition of assert() something Jens Gustedt cooked up?
| macro handles transparently: | ||
| .Dl assert((struct iovec){ buf, len }.iov_len); | ||
| .Pp | ||
| The following asserts that the size of the S structure is 16. |
There was a problem hiding this comment.
Did you mean .Vt? .Vn doesn't appear to exist in mdoc(7). I used .Vt here, though .Sy would also be reasonable — happy to switch if you have a preference. By the way, I didn't fold it into a fixup since the file was untouched by my previous commits.
There was a problem hiding this comment.
Oh sorry, I meant .Va for variable name. .Vt is for variable types, though I think you are right that it is better. Not sure in any case.
No, Peter Sommerlad. |
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
c1663ec to
0a01996
Compare
|
@kfv Please try to avoid force-pushing unless you merely do a rebase. Force pushes make it really hard to see what changes you did relatively to the previous state. It's better if you push fix-up commits; we'll squash them on commit. |
Understood, sure, will do. |
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
clausecker
left a comment
There was a problem hiding this comment.
I think this looks pretty good.
Will do some final checks if this works in C99 mode, too, and if it does, land the change set.
|
I'm almost positive |
__STDC_VERSION_ASSERT_H__feature-test macrostatic_assertmacro definition to pre-C23 modesassertvariadic as per C23assert.3accordingly