aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/attributes.h6
-rw-r--r--src/n3.c4
-rw-r--r--src/reader.h3
3 files changed, 11 insertions, 2 deletions
diff --git a/src/attributes.h b/src/attributes.h
index 25eb91d0..502634b0 100644
--- a/src/attributes.h
+++ b/src/attributes.h
@@ -10,4 +10,10 @@
# define SERD_MALLOC_FUNC
#endif
+#ifdef __GNUC__
+# define SERD_NODISCARD __attribute__((warn_unused_result))
+#else
+# define SERD_NODISCARD
+#endif
+
#endif // SERD_ATTRIBUTES_H
diff --git a/src/n3.c b/src/n3.c
index bffc423b..09e6792b 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -997,7 +997,9 @@ read_BLANK_NODE_LABEL(SerdReader* const reader,
bool* const ate_dot)
{
eat_byte_safe(reader, '_');
- eat_byte_check(reader, ':');
+ if (!eat_byte_check(reader, ':')) {
+ return SERD_ERR_BAD_SYNTAX;
+ }
const Ref ref = *dest =
push_node(reader,
diff --git a/src/reader.h b/src/reader.h
index 689eeecb..cccaa8a9 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -4,6 +4,7 @@
#ifndef SERD_READER_H
#define SERD_READER_H
+#include "attributes.h"
#include "byte_source.h"
#include "stack.h"
@@ -131,7 +132,7 @@ eat_byte_safe(SerdReader* reader, const int byte)
return c;
}
-static inline int
+static inline int SERD_NODISCARD
eat_byte_check(SerdReader* reader, const int byte)
{
const int c = peek_byte(reader);