diff options
author | David Robillard <d@drobilla.net> | 2020-11-10 22:58:12 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-11-11 00:06:20 +0100 |
commit | 9eee20ada8974e53227fa77e8dc0013ceaca88a3 (patch) | |
tree | 4b5bedc0a6874c815baab376e1cb6bc22a489897 /src/writer.c | |
parent | 48635c1e2ce5ac764cc273b4f2b93e361016d612 (diff) | |
download | serd-9eee20ada8974e53227fa77e8dc0013ceaca88a3.tar.gz serd-9eee20ada8974e53227fa77e8dc0013ceaca88a3.tar.bz2 serd-9eee20ada8974e53227fa77e8dc0013ceaca88a3.zip |
Add nonnull and nullable attributes to API
This will warn if NULL is passed to any nonnull-annotated parameter, and is
also supported by sanitizers which can check for violations at runtime.
Unfortunately, it is currently only supported by clang. GCC has a similar
feature in the nonnull attribute, but this has a different syntax (it's a
function attribute) and is more dangerous since it is used by the optimizer to
assume a null pointer is undefined behavior. This one just warns and still
allows code to handle the situation gracefully, which I think is more
appropriate for a library API.
Note that this optimization behavior is not some unlikely edge case: switching
these attributes to the GCC one will break release builds.
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c index 5f312c30..5c84b950 100644 --- a/src/writer.c +++ b/src/writer.c @@ -694,6 +694,7 @@ write_list_obj(SerdWriter* writer, return false; } +// TODO: Make subject, predicate,object nonnull in next major release SerdStatus serd_writer_write_statement(SerdWriter* writer, SerdStatementFlags flags, |